Skip to content

Commit e2e2fd3

Browse files
committed
按需加载
1 parent be89cc8 commit e2e2fd3

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
lines changed

auto-imports.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Generated by 'unplugin-auto-import'
2+
export {}
3+
declare global {
4+
5+
}

components.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// generated by unplugin-vue-components
2+
// We suggest you to commit this file into source control
3+
// Read more: https://github.com/vuejs/core/pull/3399
4+
import '@vue/runtime-core'
5+
6+
export {}
7+
8+
declare module '@vue/runtime-core' {
9+
export interface GlobalComponents {
10+
OSChart: typeof import('./src/components/OSChart.vue')['default']
11+
WaveGen: typeof import('./src/components/WaveGen.vue')['default']
12+
WaveGenChart: typeof import('./src/components/WaveGenChart.vue')['default']
13+
}
14+
}

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,20 @@
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
12+
"@vueuse/core": "8.9.4",
1213
"echarts": "^5.3.3",
1314
"element-plus": "^2.2.9",
1415
"vue": "^3.2.37"
1516
},
1617
"devDependencies": {
18+
"@types/node": "^18.6.3",
1719
"@vitejs/plugin-vue": "^3.0.1",
1820
"@vue/compiler-sfc": "^3.2.37",
1921
"sass": "^1.53.0",
2022
"typescript": "^4.7.4",
23+
"unplugin-auto-import": "^0.10.3",
2124
"unplugin-element-plus": "^0.4.1",
25+
"unplugin-vue-components": "^0.22.0",
2226
"vite": "^3.0.2",
2327
"vite-plugin-inspect": "^0.6.0",
2428
"vue-tsc": "^0.38.8"

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"compilerOptions": {
33
"baseUrl": ".",
44
"target": "esnext",
5+
"types": ["element-plus/global"],
56
"useDefineForClassFields": true,
67
"module": "esnext",
78
"moduleResolution": "node",

vite.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ import { defineConfig } from 'vite'
33
import vue from '@vitejs/plugin-vue'
44
import ElementPlus from 'unplugin-element-plus/vite'
55
import Inspect from 'vite-plugin-inspect'
6+
import AutoImport from 'unplugin-auto-import/vite'
7+
import Components from 'unplugin-vue-components/vite'
8+
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
69

710
// https://vitejs.dev/config/
811
export default defineConfig({
912
resolve: {
1013
alias: {
1114
'~/': `${path.resolve(__dirname, 'src')}/`,
15+
'@' : path.resolve(__dirname, 'src')
1216
},
1317
},
1418
css: {
@@ -25,5 +29,12 @@ export default defineConfig({
2529
defaultLocale: 'zh-cn',
2630
}),
2731
Inspect(),
32+
AutoImport({
33+
resolvers: [ElementPlusResolver()],
34+
}),
35+
Components({
36+
resolvers: [ElementPlusResolver()],
37+
}),
2838
],
39+
base:"./"
2940
})

0 commit comments

Comments
 (0)