How can Vue router get current route path of lazy-loaded modules on page load? How can Vue router get current route path of lazy-loaded modules on page load? vue.js vue.js

How can Vue router get current route path of lazy-loaded modules on page load?


There is a currentRoute property that worked for me: this.$router.currentRoute


May be you need to use $route not $router

check here : https://jsfiddle.net/nikleshraut/chyLjpv0/19/

You can also do it by $router this way

https://jsfiddle.net/nikleshraut/chyLjpv0/20/


Use this.$route.path. Simple and effective.