V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
wzx155
V2EX  ›  Vue.js

大佬们,父页面默认加载组件 1,组件 1 中有一个 router-link,点击后组件 2 在父页面中替换组件 1,怎么弄啊?

  •  
  •   wzx155 · 2021-03-30 12:01:06 +08:00 via Android · 1418 次点击
    这是一个创建于 1095 天前的主题,其中的信息可能已经有所发展或是发生改变。
    4 条回复    2021-03-30 14:06:41 +08:00
    liyang5945
        1
    liyang5945  
       2021-03-30 12:11:22 +08:00
    router.push( ... )
    router.repalce( ... )
    togou
        2
    togou  
       2021-03-30 12:33:19 +08:00
    父页面放 router-view 然后父页面路由里面放相应的子组件的两个路由 {
    path:/test
    comp.... father.vue
    chilrder:[
    {path:/xxx
    comp... child1 .vue
    }
    {xxx}
    ]
    }
    TomatoYuyuko
        3
    TomatoYuyuko  
       2021-03-30 13:38:45 +08:00
    啊这,官网文档就有啊,好好看看,子路由,children 。在'/children1/page1'里触发 router.push 到'/children2'
    doommm
        4
    doommm  
       2021-03-30 14:06:41 +08:00
    router-view? portal-vue?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2657 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 15:21 · PVG 23:21 · LAX 08:21 · JFK 11:21
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.