wx.scanCode返回path带参地址IOS和Android不一致
// 扫描小程序带参数的二维码地址
wx.scanCode({
success(res) {
const { scanType, path } = res
// path在iOS和Android不一致,Android地址未编译。
// iOS: src/pages/word?scene=id%3D178%26book%3D123
// Android: src/pages/word?scene=id=178&book=123
if (scanType === 'WX_CODE' && path) {
wx.redirectTo({
url: '/' + path,
})
} else {
console.log(res)
}
}
})
onLoad: function (query) {
// 重新进入后query.scene读区错误
const scene = decodeURIComponent(query.scene || '');
console.log(query, scene)
},