本文最后更新于:2024年4月25日 上午
初始化
项目包
vite
+vue3
+vue-router
+typescript
+axios
+element-plus
+pinia
+scss
安装
1 2 3 4 5
| pnpm create vite todo-frontend
> vue
> vue-ts
|
1 2 3 4 5 6
| pnpm i vue-router@4 pnpm i pinia pnpm i axios pnpm i element-plus pnpm i @element-plus/icons-vue pnpm i --save-D sass
|
全局引入
main.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| import { createApp } from 'vue' import { createPinia } from 'pinia' import router from '@/router' import App from './App.vue' import ElementPlus from 'element-plus' import * as ElIcons from '@element-plus/icons-vue' import 'element-plus/dist/index.css'
const app = createApp(App)
for (const name in ElIcons){ app.component(name,(ElIcons as any)[name]) }
app.use(createPinia()) .use(router) .use(ElementPlus) .mount('#app')
|