creativetimofficial / vuetify-material-dashboard

Vuetify Material Dashboard - Open Source Material Design Admin by Creative Tim

Home Page:https://www.creative-tim.com/product/vuetify-material-dashboard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nested routes not working with router setup

travisbotello opened this issue · comments

Nested/children routes are not working with the current vue router setup, e.g.

 {
    path: '/user/:id',
    view: 'User',
    children: [
      {
        path: 'profile',
        view: 'UserProfile'
      }
    ]
  },

children option is being ignored by function route.

how can solve this problem

@shijianzhong this is the fix:

travisbotello@6e8484b

Your approach doesn't work. Something missing...
Router doesn't show child component.

Just tested it again on my local machine. For me it is working. What is the output of console.log in line 49?

No errors in console.
console.log(router) is printing VueRouter {} with everything inside...

Browser switch to /parent/child and i am expecting to see child component, but on screen is still parent component...

So inside VueRouter {} you see the correct parent/child structure? If this is true, then you might have to adjust your templates. Because you also need nested <vue-router /> elements inside parent view to make nested routes working correctly. Example here: https://router.vuejs.org/guide/essentials/nested-routes.html

Ohhh yaeh :(
Sorry for this, forgot to put <router-view/>
Sorry for loosing your time and thanks for help :)
Have e great weekend :)