如何使用$router.push
导航到子状态?
我的路线:
const routes = [
{
path: "/customers", name: 'Customers',
components: {content: CustomersMain},
props: {header: true, content: false},
children: [
{
path: '',
component: CustomerDetailsEmpty
},
{
path: ':id',
name: 'CustomerDetails',
component: CustomerDetails
}
]
}
];
如何使用设置为CustomerDetails
的参数导航到id
$router.push
?
答案 0 :(得分:2)
这可以解决问题:
this.$router.push({ name: `CustomerDetails`, params: {id} });