uniapp 获取屏幕分辨率
作者:互联网
uni-app提供了异步(uni.getSystemInfo
)和同步(uni.getSystemInfoSync
)的2个API获取系统信息。
具体使用:
//data声明变量 windowWidth windowHeight //created 获取信息 uni.getSystemInfo({ success: (res) => { this.windowWidth = res.windowWidth; this.windowHeight = res.windowHeight; console.log("宽度:", this.windowWidth); console.log("高度:", this.windowHeight); }, });
返回的数据:
标签:uniapp,windowWidth,console,res,分辨率,uni,windowHeight,屏幕,getSystemInfo 来源: https://www.cnblogs.com/sunqiaozhen/p/16393335.html