vuetify-material-dashboard icon indicating copy to clipboard operation
vuetify-material-dashboard copied to clipboard

Nested routes not working with router setup

Open travisbotello opened this issue 5 years ago • 7 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.

travisbotello avatar May 08 '19 09:05 travisbotello

how can solve this problem

shijianzhong avatar Jun 13 '19 02:06 shijianzhong

@shijianzhong this is the fix:

https://github.com/travisbotello/vuetify-material-dashboard/commit/6e8484bb6b2cdd7682e7da9da413ef254e266dcd

travisbotello avatar Jun 13 '19 02:06 travisbotello

@shijianzhong this is the fix:

travisbotello@6e8484b

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

KostovV avatar Jun 28 '19 11:06 KostovV

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

travisbotello avatar Jun 28 '19 11:06 travisbotello

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...

KostovV avatar Jun 28 '19 12:06 KostovV

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

travisbotello avatar Jun 28 '19 12:06 travisbotello

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

KostovV avatar Jun 28 '19 12:06 KostovV