在我的项目中,我的路线:
New-BrokerHostingPowerAction -Action Shutdown -MachineName "$domain_name\$machine_name'
我的项目中有const routes = [{
path: '/',
meta: {
title: ''
},
component: (resolve) => require(['./views/index.vue'], resolve),
children: [
{
path: 'a',
name: 'a',
title:'a',
component: (resolve) => require(['./views/a/a.vue'], resolve)
},
{
path: 'b',
name: 'b',
title:'b',
component: (resolve) => require(['./views/b/b.vue'], resolve),
children: [
{
path: 'c',
name: 'c',
title:'c',
component: (resolve) => require(['./views/b/ccc.vue'], resolve)
},
]
},
]
}];
,index.vue
,a.vue
和b.vue
个组件。
我的c.vue
模板中有<Menu>
:
index.vue
您看到菜单<Menu mode="horizontal" active-name="1" @on-select="select_item">
<MenuItem name="a">
<Icon type="ios-paper"></Icon>
go to a
</MenuItem>
<MenuItem name="b">
<Icon type="ios-people"></Icon>
go to b
</MenuItem>
<MenuItem name="c">
<Icon type="settings"></Icon>
go to c
</MenuItem>
</Menu>
绑定到@on-select
方法,并在脚本的方法中返回名称,并按名称推送到路径:
select_item
我点击了MenuItem select_item(name){
console.log(name)
this.$router.push({name: name})
}
和go to a
一切正常,但是当我点击go to b
时,它无效。
我检查了我的代码,但我不知道问题出在哪里。
答案 0 :(得分:0)
b
和c
中有嵌套路线:
{
path: 'b',
name: 'b',
title:'b',
component: (resolve) => require(['./views/b/b.vue'], resolve),
children: [
{
path: 'c',
name: 'c',
title:'c',
component: (resolve) => require(['./views/b/ccc.vue'], resolve)
},
]
},
index.vue
&#39; <router-view>
是该组件的最高导出,您的路线中的导出为/a
和/b
。 /b/c
b.vue
<router-view>
中应该 {
path: 'c',
name: 'c',
title:'c',
component: (resolve) => require(['./views/b/ccc.vue'], resolve)
},
。
要解决您的问题,您应该提出
a
与路线b
和路线<router-view/>
处于同一级别。
或者,您应该在b.vue
中添加 $(document).on('focusout','#addedstudent-id',function() {
console.log('d');
});
,您可以看到效果。