嵌套路由
https://element.eleme.cn/#/zh-CN/component/container
路由模式
除去页面路径 #
expor睿共享 t default new Router({
mode:'history',
)}
设置404模式
如果项目没有的路径,输入空的路径返回404
{
path: '*',
component: NotFound
}
export default new Router({
mode: 'history',
routes: [{
//登录页
path: '/login',
name: 'Login',
component: Login
},
{
path: '',
name: '',
component: ,
children:
[{
//
path: '',
name: '',
component:
}]
},
{
path: '*',
component: 睿共享 NotFound
}
]
})
路由钩子函数+异步请求axios
安装axios
npm install axios -s
vuex
Vuex 是一个专为Vue.js应用程序开发的状态管理模式,它采用集中式存储管理应用的所有组件的状态,并以相应的规则保证状态以一种可预测的方式发生变化
安装
在项
npm install vuex –save
修改main.js文件,导入Vuex,关键代码如下
import Vuex from 'vuex'
Vue.use(Vuex);