为什么扫描二维码获取不到scene参数值问题?

发布于 7 年前作者 yang074351 次浏览最后编辑 7 年前来自 issues

在微信开发工具模拟扫描生成的商品二维码进入页面:

根据文档所说:

调试阶段可以使用开发工具的条件编译自定义参数 scene=xxxx 进行模拟,开发工具模拟时的 scene 的参数值需要进行 encodeURIComponent

onLoad: function (options) {
    console.log(encodeURIComponent(options.scene))
 
}

打印出来是id?为什么?

这是生成二维码的参数不知道有没有问题:

let params = {
  "scene": `id=${id}&title=${'goods'}`,
  "page""pages/information/information"
}
2 回复
junshen
junshen1 楼6 年前

不能先拼好scene再log出来看看是否正确吗?

chaozhang
chaozhang2 楼5 年前

scene 不是这样写的。如果是一个参数,就是scene:1 ;如果是多个你可以用其它字符拼接起来,比如scene:1,2  接受之后再去分割