鍍金池/ 問答/網(wǎng)絡(luò)營銷  HTML/ 微信網(wǎng)頁授權(quán)登錄code如何獲?。?/span>

微信網(wǎng)頁授權(quán)登錄code如何獲取?

微信掃碼后跳回登錄頁面顯示的網(wǎng)址是這樣的:
圖片描述

export default new Router({
    mode: 'history', //后端支持可開
    scrollBehavior: () => ({
        y: 0
    }),
    routes: constantRouterMap
})

打開history模式后,掃碼先跳:
圖片描述

后跳:圖片描述

請問腫么獲取到code?

回答
編輯回答
毀憶

vue
this.$route.query.code

2017年5月26日 10:22
編輯回答
礙你眼

獲取url,對url進(jìn)行字符串的截取

2018年2月23日 06:30
編輯回答
不歸路

這不是獲取 網(wǎng)址中的參數(shù)嗎

function GetRequest(value) {

//url例子:www.bicycle.com?id="123456"&Name="bicycle";  
var url = decodeURI(location.search); //?id="123456"&Name="bicycle";
var object = {};
if(url.indexOf("?") != -1)//url中存在問號,也就說有參數(shù)。  
{   
  var str = url.substr(1);  //得到?后面的字符串
  var strs = str.split("&");  //將得到的參數(shù)分隔成數(shù)組[id="123456",Name="bicycle"];
  for(var i = 0; i < strs.length; i ++)  
    {   

        object[strs[i].split("=")[0]]=strs[i].split("=")[1]
      }
  }

return object[value];  

}

2017年11月24日 00:04