const qrCode = require('@/lib/weapp-qrcode.js')
data() {
return {
zdyWH: 0
}
},
onLoad: function () {
query
.select(".application_list")
.boundingClientRect((data) => {
console.log("宽" + data.width / 2.1)
this.zdyWH = data.width / 2.1
})
.exec()
},
<view
style="width: 400rpx; height: 400rpx; background-color: #ffffff; border-radius: 20rpx; display: flex; justify-content: center; align-items: center;border: 1rpx solid #A7D3FF;">
<canvas style="width: 358rpx;height: 358upx;" canvas-id="openDoorQrcode"></canvas>
</view>
new qrCode('openDoorQrcode', {
text: _this.qrCode,
width: _this.zdyWH,
height: _this.zdyWH,
colorDark: "#333333",
colorLight: "#FFFFFF",
correctLevel: qrCode.CorrectLevel.L
})