在vue.js中,获取当前页面的URL:

vue.js get current url

 

var url = window.location.href;     // Returns full URL (http://localhost:13336/Sites/newslist.html?t=c&tv=1)

                var pathname = window.location.pathname; // Returns path only (/Sites/newslist.html)

                var origin = window.location.origin;   // Returns base URL (http://localhost:13336)

                console.log(this.$route.path);  // Returns path only (/Sites/newslist.html)

                console.log(this.$route.fullPath);  // Returns full URL without origin  (/Sites/newslist.html?t=c&tv=1)
Source Code

相关文章:

  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
  • 2022-12-23
  • 2021-12-17
  • 2021-11-09
猜你喜欢
  • 2022-01-08
  • 2021-05-17
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案