1、编写跳转后的vue页面
2、编写路由,且菜单隐藏
import Layout from '@/views/layout/Layout'
const userTagRouter = {
path: '/userTag',
component: Layout,
redirect: '/userTag/userTag',
name: 'UserTag',
meta: { title: 'UserTag', icon: 'peoples', roles: ['SUPERMANAGER', 'SUPER', 'ADMIN', 'OPERATOR', 'PROMOTER', 'COMPOS'] },
hidden: true, //菜单隐藏
children: [
{
path: '/test/:id',
name: 'test',
component: () => import('@/views/test'),
meta: { title: 'test', icon: 'user', roles: ['SUPERMANAGER', 'SUPER', 'ADMIN', 'OPERATOR', 'PROMOTER', 'COMPOS'] },
hidden: true //菜单隐藏
},
]
}
export default userTagRouter
3、注册到router index.js中
4、带参数跳转。注意使其唯一,不然不能多次打开同一页面
initTest(data){
this.$router.push({ path: `/Test/${data}`,params:{id:data} })
},
本文介绍如何在Vue项目中实现特定页面的跳转及路由配置,并通过设置菜单隐藏属性来优化用户体验。主要内容包括:编写跳转后的Vue页面、设置路由菜单隐藏、注册到routerindex.js文件中以及如何进行带参数的跳转。
6097

被折叠的 条评论
为什么被折叠?



