微信小程序 添加自定义机型

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
        })
      }
    })
  }
})
结果:
自己添加吧。

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注