扫码进入页面问题

发布于 6 年前作者 kangyang7159 次浏览最后编辑 6 年前来自 ask

后端写的scene是“uid=1023&aid=1221”,那么我在小程序页面里面如何获取数据呢?

我在小程序页面是通过onLoad获取:

// 这是首页的 jsPage({
  onLoad: function(options) {    // options 中的 scene 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene
    var scene = decodeURIComponent(options.scene)
  }
})

那我拿uid是怎么拿?scene.uid?

拿aid是用:scene.aid??

2 回复
qianglu
qianglu1 楼6 年前

@wxu谢谢,我们试一下

taoqian
taoqian2 楼4 年前

scene =“uid=1023&aid=1221”;//“uid=1023&aid=1221”属于字符串,使用字符串切割就可以获取到了。