[Vuejs]-Vue router get full path based on nested route

0👍

You can access them within your component like this: this.$route.path.matched, it will give you an array of current matched routes, so lets say you are in /meteorologija/meteorolosko-bdenje/aktuelni-podaci/podaci path, then it will return somethin like this (it will also contain some other info):

[
    { path:'/meteorologija', name:'meteorologija' },
    { path:'/meteorolosko-bdenje', name:'meteorolosko bdenje' },
    { path:'/aktuelni-podaci', name:'aktuelni podaci' },
    { path:'/podaci', name:'Podaci' },
]

So i took a second look at your code and found this, you should not have leading slash in your children paths, so you should change it like this:

{ path:'/meteorologija', name:'meteorologija', component:()=>import('../pages/BlogPage'), children:[
        { 
            path:'meteorolosko-bdenje', name:'meteorolosko bdenje', component:()=>import('../pages/BlogPage'), 
            children:[
                { path:'aktuelni-podaci', name:'aktuelni podaci', component:()=>import('../pages/BlogPage'),
                    children:[
                        { path:'podaci', name:'Podaci', component:()=>import('../pages/BlogPage') },
                        { path:'trenutne-temerature', name:'Trenutne temperature', component:()=>import('../pages/BlogPage') },  
                        { path:'ekstremne-temperature', name:'Ekstremne Temperature', component:()=>import('../pages/BlogPage') },  
                        { path:'pritisak', name:'Pritisak', component:()=>import('../pages/BlogPage') },  
                        { path:'vjetar', name:'Vjetar', component:()=>import('../pages/BlogPage') },  
                        { path:'kolicina-padavina', name:'Kolicina padavina', component:()=>import('../pages/BlogPage') },  
                        { path:'radarska-slika', name:'Radarska Slika', component:()=>import('../pages/BlogPage') },  


                    ] 
                },

Leave a comment