首页 > Web开发 > 详细

vue.js get current url

时间:2020-12-02 09:51:00      阅读:33      评论:0      收藏:0      [点我收藏+]

在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)
Source Code

 

vue.js get current url

原文:https://www.cnblogs.com/insus/p/14071840.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!