getApp()页面跳转后获取不到值,是什么问题?

小程序 文章 2022-03-18 10:20 1702 0 全屏看文

AI助手支持GPT4.0

getApp()页面跳转后获取不到值,是什么问题?getApp() can't get the value after the page jumps, what's the problem?

getApp()页面跳转后获取不到值,是什么问题?

Uni-App H5

如图:

定义一个全局变量appData 他的值为getApp(),getInfoBy()方法中通过appData获取当前登录用户的openid。

问题:页面加载完成后获取openid没问题。问题出现在调用微信支付的时侯,输入支付金额后且成功完成支付操作。完成支付操作后路由会跳转到小程序页面,这时候通过调用getInfoBy()方法,其中appData获取openid获取不到值(appData貌似被销毁了)。

测试二维码

测试步骤:微信扫码》登录》个人中心》充值金额0.01》充值

ps:小程序右下角有vConsole按钮点击后会弹出控制台,该控制台可调试查看

PS:很多办法都试了就是不行,求大佬吗解惑。

Uni app H5 is shown in the figure: define a global variable appdata, whose value is getapp(), and get the openid of the currently logged in user through appdata in getinfoby() method. Problem: there is no problem getting openid after the page is loaded. The problem occurs when calling wechat payment. After entering the payment amount, the payment operation is successfully completed. After the payment operation is completed, the route will jump to the applet page. At this time, call the getinfoby () method, where appdata gets openid and cannot get the value (appdata seems to be destroyed). Testing QR code test steps: wechat scanning code "login" personal center "recharge amount 0.01" recharge PS: there is a vconsole button in the lower right corner of the applet. After clicking, the console will pop up. The console can be debugged and checked PS: many methods have been tried, but they can't be done. Ask the boss to solve his doubts.

回答:

工号 019743:

请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。


盲猜是异步的问题吧

下渝州:

uniapp移步他们社区去问咯

.:

globalData里面的openid是怎么写的?

-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
使用wx.openDocument打开的pdf文档 如何添加水印?
微信支付商家结算问题
我的小程序广告主收入5301,实际进账4406,是怎么回事呀?
在创建创建直播间时,如果主播微信号没在直播小程序实名过,接口返回的http状态是503
如何将通过条件查询得到的res中以某一字段为关键字遍历出来的数据赋值给新的数组?
随便看看
教育科技公司申请微信支付被拒绝? 4798
微信公众号免300认证教程 5892
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 5299
小程序广告组件通过审核,但是小程序内没有显示广告? 5067
企业微信通讯录账号被管理员误/恶意删除,怎么办? 9568
问题? 9048
如何快速搭建抽奖助手小程序(无需代码知识) 6177
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 7472
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 6793
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 6128