main.js
//vue版本为3.5.13
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import 'element-plus/dist/index.css'
import router from './router/index'
const app = createApp(App)
app.use(ElementPlus)
app.use(router)
app.mount('#app')
vite.config.js
// vite版本6.0.1
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: [
// ...
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
}),
vue(),
],
})
index.js
//router版本4.5.0
import { createRouter,createWebHistory } from "vue-router";
import HelloWorld from '../components/HelloWorld.vue';
const router = createRouter({
history:createWebHistory(),
routes:[
{
path:'/',
component:HelloWorld,
},
]
})
export default router;
版本不匹配可能会出现报错,或者前端页面不显示的问题。而且vue版本不同配置文件也会有所差别,出现问题建议检查是否为版本问题
标签:13,vue,vite6.0,配置文件,app,版本,router,import,vite From: https://www.cnblogs.com/brave--heart/p/18619337