this.$router.addRoutes();
參數(shù)是一個(gè)數(shù)組,里面的對象就是添加上去的路由。
例子:
this.$router.addRoutes([
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? //測試專用
? ? ? ? ? ? ? ? path:'/ceshi',
? ? ? ? ? ? ? ? name:'ceshi',
? ? ? ? ? ? ? ? component:pathMap['/ceshi']
? ? ? ? ? ? ? ? },
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? //菜單管理頁面
? ? ? ? ? ? ? ? path:'/MenuManagement',
? ? ? ? ? ? ? ? name:'MenuManagement',
? ? ? ? ? ? ? ? component:pathMap['/MenuManagement']
? ? ? ? ? ? ? ? },
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? //角色管理頁面
? ? ? ? ? ? ? ? path:'/RoleManagement',
? ? ? ? ? ? ? ? name:'RoleManagement',
? ? ? ? ? ? ? ? component:pathMap['/RoleManagement']
? ? ? ? ? ? ? ? },
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? //用戶信息管理頁面
? ? ? ? ? ? ? ? path:'/UserInformationManagement',
? ? ? ? ? ? ? ? name:'UserInformationManagement',
? ? ? ? ? ? ? ? component:pathMap['/UserInformationManagement']
? ? ? ? ? ? ? ? }
? ? ? ? ]);
跳轉(zhuǎn)到指定路由:
this.$router.push();
參數(shù)可以是一個(gè)字符串。
例子:
this.$router.push("/MenuManagement");