How to Get the Current URL with VueJS

How to Get the Current URL with VueJS?

Today, We want to share with you How to Get the Current URL with VueJS?.In this post we will show you vue js window.location.pathname, hear for Get current URL/path in vuejs (without domain) we will give you demo and example for implement.In this post, we will learn about Get URL and URL Parts in vuejs with an example.

How to Get the Current URL with VueJS?

There are the Following The simple About How to Get the Current URL with VueJS? Full Information With Example and source code.

As I will cover this Post with live Working example to develop How to get current URL, parameters and Hash tag using VueJS, so the how to get current url in vue router for this example is following below.

  jQuery Find Nested Parent Child Elements HTML DOM

How to get current URL in Vue JS?

index.html

<!DOCTYPE html>
<html>
<head>
    <title>How to get current URL in Vue JS?- pakainfo.com</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>
<body>
<div id="root">
  {{ comments }}
</div>
<script type="text/javascript">
    var root = new Vue({
      el: '#root',
      data: {
        comments: 'Welcome to Pakainfo.com!'
      },
      created: function(){
        var liveURL = window.location.pathname;
        console.log(liveURL);
      }
    })
</script>
</body>
</html>

If We are use $route

this.$route.query.page

Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about How to Get the Current URL with VueJS?.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Reply

avatar
  Subscribe  
Notify of