[Vuejs]-Condiconal to send params via $emit according to the route you are VUE.js

0👍

I assume you are using Vue 2 and Vue-router for routing. In this case you can get current route information via this.$route, for example:

if (this.$route.path == '/page') { 
    
}

this.$route contains the following properties:

{ 
   name: 'Name of the route',
   path: '/path/to/route', 
   params: { /* object with route parameters */ },
   query: { /* everything after the question mark in url (example: #/page?id=1&a=b) */} 
}

Leave a comment