然后在弹出的网页上:
在左下角查看是不是所需项目;在依赖-安装依赖安装所需依赖
main.js中引用所需要的依赖
import { createApp } from 'vue'
import App from './App.vue'
const app = createApp(App)
// router路由
import router from './router/index.js'
app.use(router)
// vuex
import Vuex from 'vuex'
app.use(Vuex)
// // axios
// import axios from 'axios'
// app.use(axios)
// store
import store from './store/index.js'
app.use(store)
app.mount('#app')
router/index.js
import {
createRouter,
createWebHashHistory
} from 'vue-router' //引入vue-router
export const constRouter = [{
path: '/index',
name: 'index',
component: () =>
import ('@/views/home/MyIndex.vue'),
meta: {
title: '首页'
}
}, ]
const router = createRouter({
history: createWebHashHistory(),
routes: constRouter
})
export default router
store/index.js
import { createStore } from 'vuex'
// 自定义modules
import permission from './modules/permission'
import user from './modules/user'
export default createStore({
state: {},
mutations: {},
actions: {},
modules: {
permission,
user
},
getters: {}
})