我有一个嵌套的路线设置
let routes = [
{
name: 'Admin',
path: '/prod/:id',
component: Admin,
meta: {
requiresAuth: true,
title: 'Admin - Fraud tool'
},
children:[
{
path: 'users',
component: Users
}
]
}];
然后我的网址看起来像这样
http://localhost/prod/admin/users
如何在vue js中获取此路线中的admin
答案 0 :(得分:3)
试试这个$route.params.id
或$route.params
,它会为您提供对象结果
https://jsfiddle.net/yyx990803/L7hscd8h/
https://router.vuejs.org/guide/essentials/dynamic-matching.html