路由切换时根目录不变,并且不关联
1.点击siderbar里面的切换时,地址栏里的子路由切换了,父路由不变,为什吗?
2.siderbar里面的按钮和地址不关联?
3.router -> index.js
`
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router);
import Layout from '@/layout'
export const constantRouterMap = [
{
path: '/login',
component: () => import('@/views/login/index')
},
{
path: '/',
component: Layout,
redirect: '/table',
children: [
{
path: 'table-drag',
component: () => import('@/views/table/table-drag'),
}
]
},
{
path: '/table',
component: Layout,
redirect: '/table/table-complex',
name: 'Table',
children: [
{
path: 'table-drag',
component: () => import('@/views/table/table-drag'),
name: 'TableDrag'
},
{
path: 'table-complex',
component: () => import('@/views/table/table-complex'),
}
]
},
{
path: '/user',
name: 'user',
component: Layout,
redirect: '/user/list',
children: [
{
path: 'list',
component: () => import('@/views/user/list'),
},
{
path: 'details',
component: () => import('@/views/user/details'),
},
]
},
];
export default new Router({
// model: "history",
routes: constantRouterMap
});
`
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
1.'/'代表根路径
2.:default-active="$route.path"
router
加上这2条即可关联