This commit is contained in:
fxy060608 2021-12-02 20:56:45 +08:00
parent 479f72eb03
commit c218ad3eda
10 changed files with 56 additions and 46 deletions

View File

@ -9,6 +9,6 @@
</head> </head>
<body> <body>
<div id="app"><!--app-html--></div> <div id="app"><!--app-html--></div>
<script type="module" src="/src/main.js"></script> <script type="module" src="/src/main.ts"></script>
</body> </body>
</html> </html>

View File

@ -52,6 +52,7 @@
"@dcloudio/uni-cli-shared": "^3.0.0-alpha-3030020211201003", "@dcloudio/uni-cli-shared": "^3.0.0-alpha-3030020211201003",
"@dcloudio/vite-plugin-uni": "^3.0.0-alpha-3030020211201003", "@dcloudio/vite-plugin-uni": "^3.0.0-alpha-3030020211201003",
"autoprefixer": "^10.4.0", "autoprefixer": "^10.4.0",
"typescript": "^4.5.2",
"vite": "^2.6.14" "vite": "^2.6.14"
} }
} }

View File

@ -1,17 +1,13 @@
<script> <script setup lang="ts">
export default { import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
onLaunch: function () { onLaunch(() => {
console.log('App Launch') console.log("App Launch");
}, });
onShow: function () { onShow(() => {
console.log('App Show') console.log("App Show");
}, });
onHide: function () { onHide(() => {
console.log('App Hide') console.log("App Hide");
}, });
}
</script> </script>
<style></style>
<style>
/*每个页面公共css */
</style>

8
src/env.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
/// <reference types="vite/client" />
declare module '*.vue' {
import { DefineComponent } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>
export default component
}

View File

@ -1,10 +0,0 @@
import {
createSSRApp
} from "vue";
import App from "./App.vue";
export function createApp() {
const app = createSSRApp(App);
return {
app,
};
}

8
src/main.ts Normal file
View File

@ -0,0 +1,8 @@
import { createSSRApp } from "vue";
import App from "./App.vue";
export function createApp() {
const app = createSSRApp(App);
return {
app,
};
}

View File

@ -1,22 +1,15 @@
<template> <template>
<view class="content"> <view class="content">
<image class="logo" src="/static/logo.png"></image> <image class="logo" src="/static/logo.png" />
<view class="text-area"> <view class="text-area">
<text class="title">{{ title }}</text> <text class="title">{{ title }}</text>
</view> </view>
</view> </view>
</template> </template>
<script> <script setup lang="ts">
export default { import { ref } from 'vue'
data() { const title = ref('Hello')
return {
title: 'Hello',
}
},
onLoad() {},
methods: {},
}
</script> </script>
<style> <style>

15
tsconfig.json Normal file
View File

@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "esnext",
"useDefineForClassFields": true,
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"jsx": "preserve",
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"]
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
}

View File

@ -1,8 +0,0 @@
import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
uni(),
],
})

7
vite.config.ts Normal file
View File

@ -0,0 +1,7 @@
import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [uni()],
});