/**
* 獲取場景值(scene)
*/
getSceneData(query) {
console.log(query)
return query.scene ? this.scene_decode(query.scene) : {};
},
// 解析scene里面的參數(shù)
scene_decode(e) {
if (e === undefined)
return {};
let scene = decodeURIComponent(e),
params = scene.split(','),
data = {};
for (let i in params) {
var val = params[i].split(':');
console.log(val)
val.length > 0 && val[0] && (data[val[0]] = val[1] || null)
}
//data中有你想要的數(shù)據(jù)
console.log(data)
},
在app.vue? onLaunch中調(diào)用獲取場景值的方法即可(建議在onShow中調(diào)用,避免掃碼冷啟動(dòng))文章來源地址http://www.zghlxwxcb.cn/news/detail-556157.html
文章來源:http://www.zghlxwxcb.cn/news/detail-556157.html
到了這里,關(guān)于uniapp微信小程序 獲取從二維碼進(jìn)入小程序所攜帶的參數(shù)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!