Vue 1.x/2.x: Get vue-router path url from a $route object

For future people looking to do this

I believe this is the Vue 2.x way

var path = this.$router.resolve({name: 'SomePath', params: {id: 1}}).href

then if you want the full url you would do

var fullUrl = window.location.origin + "/" + path

In Vue 2.0 maybe you can try my way: this.$route.path can get the URL path without domain. For example: http://localhost:8000/#/reg only gets the /reg part; the domain part you can get it easily outside the VueRouter. BTW: after creating const router = new VueRouter ..., you can get the URL by using router.history.current.path;. This method can get the URL like /reg too.