小程序 - 获取扫码进入小程序携带的参数

参考文档获取二维码 - 接口 B:适用于需要的码数量极多的业务场景

前端需要关注以下的文档

后台开发者会将携带的参数放在scene中,演示获取scene中携带的id,代码如下

onLoad: function (options) {
    let scene = decodeURIComponent(options.scene);
    console.log(scene.id);
}

拓展:encodeURIencodeURIComponent都是对URL编码的方法,encodeURIComponent编码的范围更大。

参考博客:简单明了区分escape、encodeURI和encodeURIComponent

猜你喜欢

转载自blog.csdn.net/sinat_33184880/article/details/85071866
今日推荐