uni.getSystemInfo(OBJECT)

获取屏幕高度宽度

  • screenWidth 屏幕宽度
  • screenHeight 屏幕高度
  • windowWidth 可使用窗口宽度
  • windowHeight 可使用窗口高度
  • windowTop 可使用窗口的顶部位置 App、H5
  • windowBottom 可使用窗口的底部位置 App、H5
  • statusBarHeight 状态栏的高
onLoad() {
	let _this = this
	uni.getSystemInfo({
	    success: function (res) {
	        console.log(res.model);
        	console.log(res.pixelRatio);
	        console.log(res.windowWidth);
	        console.log(res.windowHeight);
	        console.log(res.language);
	        console.log(res.version);
	        console.log(res.platform);
	    }
	});
},

获取元素的宽度、高度、定位

  • bottom:
  • dataset,如ref
  • proto:
  • height:
  • id
  • left:
  • right:
  • top:
  • width:
uni.getSystemInfo({
  success: function (res) { // res - 各种参数
  	//如 <view class="box"></view>  	.select('.box')
    let obj = uni.createSelectorQuery().select('.类名')
    obj.boundingClientRect(function (data) { // data - 各种参数
      console.log(data)
    }).exec()
  }
})