vue.js get current url
在vue.js中,获取当前页面的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)