开通会员卡后,onShow中数据重复问题

小程序 文章 2021-04-07 17:22 377 0 全屏看文

AI助手支持GPT4.0

开通会员卡后,onShow中数据重复问题After the membership card is activated, the problem of data duplication in onShow

开通会员卡后,onShow中数据重复问题
框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug navigateToMiniProgram 微信iOS客户端 8.0.2 2.16.0

用户通过navigateToMiniProgram方法跳转到开卡小程序完成开卡后,返回我们的小程序,我们在app.onShow中拿到开通结果,做出开卡后的处理。

此时用户再次触发app.onShow方法,该方法会再次携带开卡参数执行一遍。

我们目前可以用其他方法解决这个问题,但是这个坑得填。

Framework type problem type API / component name terminal type wechat version basic library version applet bug navigatetominiprogram wechat IOS client 8.0.2 2.16.0 users jump to the card opening applet through the navigatetominiprogram method. After the card is opened, we return to our applet app.onShow Get the result of opening and make the processing after opening. At this point, the user triggers again app.onShow Method, which will carry the card opening parameters again. We can solve this problem in other ways at present, but this pit has to be filled.

回答:

少侠:

你可以去了解下小程序的展示机制,跳转到别的小程序,当前小程序会进入后台,返回以后会进入前台,自然会触发onShow。

你们最好埋个钩子在onShow里面,必要的时候再执行对应逻辑

Brother斌🎈:

只能说是你自己没弄明白onShow机制导致的坑

ᝰꫛꫀꪝ .:

只要返回当前页 onshow就会启动,更改为onload 或者onshow里进行判断。

-EOF-

AI助手支持GPT4.0