wxml:
<view>
<text>DPR:{{vDPR}}</text>
</view>
<view>
<text>width:{{vwidth}}</text>
</view>
<view>
<text>height:{{vheight}}</text>
</view>
js:
data: {
vDPR:”,
vwidth:”,
vheight:”
},
onLoad: function () {
const that=this
wx.getSystemInfo({
success: function(res) {
that.setData({
vDPR:res.pixelRatio,
vwidth:res.screenWidth,
vheight:res.screenHeight
})
}
})
}
})
结果:
自己添加吧。