vite.config.ts完整代码如下:
import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import vue from '@vitejs/plugin-vue'
import path from "path";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [uni(), vue()],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'), // 将'@'指向项目src目录
},
},
});
app.vue中完整代码
<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
onLaunch(() => {
console.log("App Launch");
});
onShow(() => {
console.log("App Show");
});
onHide(() => {
console.log("App Hide");
});
</script>
<style></style>
1 个回复
1***@163.com - 573219
同问,解决了吗