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

微信小程序 横屏跳转竖屏 #476

Open
0zcl opened this issue Sep 11, 2023 · 4 comments
Open

微信小程序 横屏跳转竖屏 #476

0zcl opened this issue Sep 11, 2023 · 4 comments

Comments

@0zcl
Copy link

0zcl commented Sep 11, 2023

官方DEMO: https://github.com/mescroll/mescroll/blob/master/mescroll-uni/pages/base/mescroll-uni-part.vue

有个问题,我有一个竖屏的小程序A,使用了类似上面的Demo.

场景:横屏小程序 跳转到 竖屏的小程序A。在IOS16版本时,mescroll 的bodyHeight貌似是横屏时的bodyHeight,这导致了无法下拉滚动。当我刷新后,bodyHeight就是竖屏时的bodyHeight,就正常了。

目前场景只在IOS 16 && 横屏小程序 跳转到 竖屏的小程序 出现

@0zcl
Copy link
Author

0zcl commented Sep 12, 2023

看了下源码

// mescroll-uni/components/mescroll-uni/mescroll-uni.vue组件
// 使用created初始化mescroll对象; 如果用mounted部分css样式编译到H5会失效”
const sys = `uni.getSystemInfoSync()
vm.mescroll.setBodyHeight(sys.windowHeight);

由于 在created初始化对象。

在IOS16版本 &&竖屏的小程序A时,sys.windowHeight 其实是宽度

@0zcl
Copy link
Author

0zcl commented Sep 12, 2023

https://developers.weixin.qq.com/community/develop/doc/0002ee8ce94820355b5f80d8b51000?highLine=created%2520windowHeight

如果开发者请求wx.getSystemInfoSync().windowHeigh的时机很早,早到视图都没有布局完成,我们会返回一个经验值;布局完成后再请求wx.getSystemInfoSync().windowHeigh,这时我们会返回实际值。经验值和实际值可能会有出入

https://developers.weixin.qq.com/community/develop/doc/000ea808414a8885534d0bf7b56c00?highLine=created%28%29%2520%2520windowHeight

@0zcl
Copy link
Author

0zcl commented Sep 12, 2023

@Leotw @rni-l @cuteCloud @Skura23 大大们,看着在微信小程序中 在created初始化对象 sys.windowHeight 是有问题的,看看可以对小程序特殊处理,在onReady初始化吗,或者其它方法

@agracehopper
Copy link

this.height = uni.getSystemInfoSync().windowHeight 写在onReady里,mescroll 无法触发上拉加载,页面卡死

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants