【发布时间】:2019-01-05 23:16:23
【问题描述】:
我在 vue-router 文档中找到了这个例子:
const router = new VueRouter({
mode: 'history',
routes: [{
path: '/settings',
// You could also have named views at tho top
component: UserSettings,
children: [{
path: 'emails',
component: UserEmailsSubscriptions
}, {
path: 'profile',
components: {
default: UserProfile,
helper: UserProfilePreview
}
}]
}]
})
我试图做这样的事情:
https://jsfiddle.net/pt9o6h8e/
const router = new VueRouter({
mode: 'history',
routes: [{
path: '/settings',
components: {
default: UserSettings,
test: TestComponent
}
children: [{
path: 'emails',
component: UserEmailsSubscriptions
}, {
path: 'profile',
components: {
default: UserProfile,
helper: UserProfilePreview
}
}]
}]
})
但 TestComponent 不可见。 为什么?
【问题讨论】:
标签: javascript vue.js vue-router