getCurrentPages 获取当前网页完整的URL

 

 

 

// 获取当前网页的完整 URL 地址:
        let pages = getCurrentPages()
        let targetURL = pages[pages.length - 1]
        let urlParams = ''
        for (let item in targetURL.options) {
          let itemStr = item + '=' + targetURL.options[item] + '&'
          urlParams += itemStr
        }
        let tempURL = targetURL.route + '?' + urlParams
        let finalURL = tempURL.slice(0, tempURL.length - 1)

  

posted @ 2020-10-23 14:46  牧羊狼  阅读(573)  评论(0编辑  收藏  举报