微信小程序生成指定頁面並且帶有參數的太陽碼,掃碼進入該頁面拿不到太陽碼裏邊帶的參數,記錄一下
解決辦法:
微信提供encodeURIComponent方法獲取
文檔:
實例:
onLoad:function(query) {
let that = this;
if (query.scene){
const scene = decodeURIComponent(query.scene)
console.log(sence) // 22&shopname
var id = scene.split('&')[0]
var shopName = scene.split('&')[1]
that.setData({
sid: id,
shopName: shopName
})
}
}