vue中有多个router-view 时,哪个view 显示你要显示的组件呢
1、给router-view取个名字:<router-view name = "view_home"/>2、在index.js中这样写export default new Router({routes: [{path: '/',redirect: 'HomePage'},{path: '/Ho...
·
1、给router-view取个名字:
<router-view name = "view_home"/>
2、在index.js中这样写
export default new Router({
routes: [
{
path: '/',
redirect: 'HomePage'
},
{
path: '/HomePage',
name: 'HomePage',
components: {
view_home: HomePage
}
}
],
mode:'history'
})
to到对应path的时候在components属性中按name属性确定要更新的router-view
更多推荐
已为社区贡献1条内容
所有评论(0)