element-ui使用 el-menu-item 路由(route)跳转
el-menu 添加 :default-active=“this.$router.path” 和 router (default-active前面要有 “:” )
router.js文件下应该配置好路由路径。建议用路由懒加载方式
//import main from './pages/main.vue' Vue.use(Router); export default new Router({ mode:'history', routes:[ {path:'/',component: resolve => require(['./pages/login.vue'], resolve)}, // 路由懒加载 {path:'/login',component: resolve => require(['./pages/login.vue'], resolve)}, { path:'/main', component:main, children:[ {path:'', component: resolve => require(['./pages/news.vue'], resolve)}, {path:'/news', component: resolve => require(['./pages/news.vue'], resolve)}, {path:'/practiceInfo', component: resolve => require(['./pages/practiceInfo.vue'], resolve)}, {path:'/myDesign', component: import(/* webpackChunkName: "testProject" */ './pages/myDesign.vue')}, // 路由懒加载 - 分模块 {path:'/allDesign', component: import(/* webpackChunkName: "testProject" */ './pages/allDesign.vue')}}, {path:'/recruit', component: import(/* webpackChunkName: "testProject" */ './pages/recruit.vue')}}, ] } ] })