Vue 3 引入vue的方法错误
Vue3 引入Vue 方法 (main.js 全部代码)
* 注意:element-ui 不支持 Vue3,可使用 element-plus
element-plus 下载方法: npm install --save element-plus
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
const Vue = createApp(App)
Vue.use(ElementPlus)
Vue.use(router)
Vue.use(store)
Vue.mount('#app')
Vue3引入router方法 ( router.js 代码)
import { createRouter , createWebHistory } from 'vue-router' const routes = [ { path:'/', name:'home', component:()=>require('../view/common/main.vue'), children:[ { path:'/first-model', name:'first-model', component:()=>require('../view/first-model/first-model.vue'), mate:{title:'页面一'}}, ]} ] const router = createRouter({ history:createWebHistory(), routes }) export default router
Vue3引入store方法 (store.js 代码)
import { createStore } from 'vuex'
const store = createStore({
state:{},
mutations:{},
})
export default store