Tutorialsplane

Vue.js get location pathname


We can use location pathname property to get the current pathname in Vue.js. Here in this tutorial, we are going to explain how you can get location pathname in Vue.js. You can also use our online editor to edit and run the code online.


Vue.js get location pathname JavaScript Example

You can get the location.pathname simply as below-

Example:

<div id="app">
	<p>{{result}}</p>
	<button>Click Me</button>
</div>
  

Try it ยป

Output of above example-