wzx155
V2EX  ›  Vue.js

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

  •  
  •   wzx155 · Mar 30, 2021 via Android · 2517 views
    This topic created in 1884 days ago, the information mentioned may be changed or developed.
    4 replies    2021-03-30 14:06:41 +08:00
    liyang5945
        1
    liyang5945  
       Mar 30, 2021
    router.push( ... )
    router.repalce( ... )
    togou
        2
    togou  
       Mar 30, 2021
    父页面放 router-view 然后父页面路由里面放相应的子组件的两个路由 {
    path:/test
    comp.... father.vue
    chilrder:[
    {path:/xxx
    comp... child1 .vue
    }
    {xxx}
    ]
    }
    TomatoYuyuko
        3
    TomatoYuyuko  
       Mar 30, 2021
    啊这,官网文档就有啊,好好看看,子路由,children 。在'/children1/page1'里触发 router.push 到'/children2'
    doommm
        4
    doommm  
       Mar 30, 2021
    router-view? portal-vue?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3157 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 12:45 · PVG 20:45 · LAX 05:45 · JFK 08:45
    ♥ Do have faith in what you're doing.