小程序在PC端打开时如何适配PC的宽度和高度?
发布于 6 年前 作者 yongyan 9084 次浏览 来自 官方Issues

大家好,我在小程序上适配PC的宽度和高度时在app.js中使用如下语句,却提示windowWidth和windowHeigth没有定义,麻烦问下我该如何设置呢?谢谢

wx.getSystemInfo({

success: function (res) {

windowWidth = res.windowWidth;

windowHeigth = res.windowHeight;

}

})

2 回复

这个好像是JS的基础问题吧~你定义了那2个变量了吗?

let windowWidth = res.windowWidth;

回到顶部