写个空白页,调微信重定向接口
获取 let urls= success.data.data
// 重定向
window.location.replace(urls)
再写个空白页,截取code和state
let result= []
let query= urls.split('?')[1]
//截取code和state
let query= window.location.href.split('?')[1]
console.log(query)
if (query) {
let queryArr= query.split('&')
console.log(queryArr)
queryArr.forEach(function (item) {
let value= item.split('=')[1]
let key= item.split('=')[0]
result[key]= value
})
console.log('code:' + result.code,'state:' + result.state)
网友评论