Change route view based on route name

Asked By: Anonymous

At the moment I am displaying google maps in a div, whenever I change route, I want to replace the view with another view. I tried to set it as below, but it doesn’t work

 .map-col(ref="mapCol" v-if="route.name == 'Adventure'")
 .map-col(v-else)
    router-view
{
        path: "/adventures/id",
        name: "Adventure",
        component: Adventure,
        children: [
       
          {
            path: "points/id/clues/new",
            name: "NewClue",
            component: NewClue
          }
        ]
      }

console.log(route.name) Outputs Adventure so it’s fine.

Error I am getting
Uncaught (in promise) TypeError: Cannot read property 'name' of undefined and screen page going fully white.


Solution

Answered By: Anonymous

You should use $route instead of route :

.map-col(ref="mapCol" v-if="$route.name == 'Adventure'")
techinplanet staff

techinplanet staff


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno