Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android和Windows上界面初始化次数不一样 #206

Open
202225feng opened this issue Oct 22, 2024 · 3 comments
Open

Android和Windows上界面初始化次数不一样 #206

202225feng opened this issue Oct 22, 2024 · 3 comments
Labels
invalid This doesn't seem right

Comments

@202225feng
Copy link

写了一个用wxs函数计数代码,基础库3.6.0后Android和Windows上运行不一样了。
界面一个计数器函数,函数被调用的时候会加一并返回次数。Android上一打开界面是1,Windows上是2.
代码片段::https://developers.weixin.qq.com/s/PwIK9UmS7uUo
Android界面

initA

Windows界面:

initW

代码:

微信截图_20241014153307

@LastLeaf
Copy link
Member

关于为什么不同,可以参考 #203 。有关 WXS 状态的问题,请参考 #205

至于为什么 Android 和 Windows 表现不同,可能是因为它们用到的 glass-easel 版本不同。可以打开 vConsole 的 system 栏看一下 WeChatLib 栏标注的实际基础库版本号。

@202225feng
Copy link
Author

基础库版本都一样,都是3.6.2。基础库3.6.0之后出现的这个现象,测试过3.6.1、3.6.2和3.6.3都会这样。

@LastLeaf
Copy link
Member

看起来是因为,在 PC 调试的时候,有时候会生成一次 reLaunch (参考 重加载 章节)。

因为 count 是个全局量,页面被二次加载它是会继续计数的。(所以说 wxs 函数被调用的时机是很难控制的。)

@LastLeaf LastLeaf added the invalid This doesn't seem right label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants