使用wx.getSystemInfoSync()获取设置宽高不生效 ?

小程序 文章 2022-02-17 23:40 481 0 全屏看文

AI助手支持GPT4.0

使用wx.getSystemInfoSync()获取设置宽高不生效 ?Using wx.getSystemInfoSync() to get the set width and height does not take effect?

使用wx.getSystemInfoSync()获取设置宽高不生效 ?

使用wx.getSystemInfoSync()获取到的screenWidth和screenHeight,设置为view的 宽高 ,为什么不生效 ?设置固定值 生效 。能确定 wx.getSystemInfoSync()有值。

Use Wx The screenwidth and screenheight obtained by getsysteminfosync () are set to the width and height of the view. Why doesn't it take effect? Setting a fixed value takes effect. Can you confirm Wx Getsysteminfosync() has a value.

回答:

微盟:

这种问题应该是api返回数据在页面渲染之前进行的

老张:

1、猜是异步原因。

-EOF-

AI助手支持GPT4.0