获取当前网页的完整路径如:https://www.runoob.com/jsref/
getFullPath() {
        let pathName = function () {
          //返回当前 URL 的路径部分。
            var arr = window.location.pathname.split('/');
            return arr.splice(0, arr.length - 1).join('/') + '/'
        }();
        //获取网页当前的协议+域名
        let origin = window.location.origin
        return origin + pathName
    },

HappyCodingTop
526 声望847 粉丝

Talk is cheap, show the code!!