Vue routing configuration

is there anything wrong with me to configure routing like this? Why does clicking on page1 page2 not change the sub-route but jump the whole page?

Mar.29,2021

you try adding the name attribute to the child route, and then jump there and directly : to= {name: 'xxxx'} try this


because I wrote a VFF answer Alive.However, it is assumed in the route that the child node will inherit the attribute of the parent node


after adding a new page vue, to components, import the corresponding vue, under index.js of router and configure it in routes

 routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld
    },
    {
      path: '/demo1',
      name: 'Demo1',
      component: Demo1
    }
  ]

then make a route jump on the specified page.

<button
          target="_blank"
          @click="sendDemo1"
        >
          
        </button>

its corresponding route jump method

sendDemo1(){
      this.$router.push({
        path:'/demo1',
        name:'Demo1'
      })
    }
Menu