wzx155
V2EX  ›  Vue.js

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

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