同一手机多次扫不同带参二维码,读取的参数还是上次的,怎么解决?

小程序 文章 2022-04-12 16:40 597 0 全屏看文

AI助手支持GPT4.0

同一手机多次扫不同带参二维码,读取的参数还是上次的,怎么解决?The same mobile phone scans the QR code with different parameters multiple times, and the parameters read are the same as the last time. How to solve it?

同一手机多次扫不同带参二维码,读取的参数还是上次的,怎么解决?

生成多个带参小程序码,同一部手机依次扫码,小程序每次接收的参数都是第一次扫的码的参数。 参数有在onshow onlanch 中接收赋值到页面。

Generate multiple applet codes with parameters. The same mobile phone scans the codes in turn. The parameters received by the applet each time are the parameters of the code scanned for the first time. Parameters are assigned to the page received in Onshow onlanch.

回答:

沉冰:

没打开小程序时,扫码打开可以在onLaunch中query里获取到scene

打开之后需要在页面的onload中options获取scene(因为小程序已打开,所以不会触发app 的onlaunch方法

app.js

index.js(扫码打开的页面)

青团社:

看下 onLaunch、onShow、onLoad的代码

八九:

之前我遇到过这个问题,重复扫码参数不变的问题。看下你的代码逻辑怎么写的

-EOF-

AI助手支持GPT4.0