๐ฉโ๐ป element ui plus ๅปบ็ฝฎ
็ๆฌโ
- vue: 3.2.41
- vite: 3.2.0
- typescript: 4.6.4
- element-plus: 2.3.12
ๅฎ่ฃโ
ๅฎ่ฃ element-plusโ
yarn add element-plus
ๅฎ่ฃๅฅไปถโ
unplugin-vue-components ๅ unplugin-auto-import
ๅฏไปฅๅจ้่ฆๆๅจๅฐๅ ฅUI๏ผ้ไฝๅฐๆก็ๅคงๅฐ
yarn add unplugin-vue-components unplugin-auto-import
ๆผ vite.config.ts ๅ ๅ ฅ่จญๅฎ
import { defineConfig } from 'vite'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [vue(),
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
}),]
})
ๅ ๅ ฅๅฐๅ จๅโ
import { createApp } from "vue";
import { createPinia } from "pinia";
import ElementPlus from 'element-plus'
import router from "./router/index";
import App from "./App.vue";
import './style.css'
const app = createApp(App);
app.use(router).use(createPinia()).use(ElementPlus, { size: 'small', zIndex: 3000 }).mount("#app");