feat: 新增预约二维码弹窗功能
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
const drawQrcode = require('../../utils/weapp.qrcode.esm.js').default
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
visible: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
qrcodeId: {
|
||||
type: String,
|
||||
value: ''
|
||||
}
|
||||
},
|
||||
|
||||
data: {
|
||||
loading: true
|
||||
},
|
||||
|
||||
observers: {
|
||||
'visible'(val) {
|
||||
if (val && this.data.qrcodeId) {
|
||||
this.setData({ loading: true })
|
||||
this.draw()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
draw() {
|
||||
wx.nextTick(() => {
|
||||
drawQrcode({
|
||||
width: 200,
|
||||
height: 200,
|
||||
canvasId: 'qrcodeCanvas',
|
||||
_this: this,
|
||||
text: this.data.qrcodeId,
|
||||
callback: () => {
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
onClose() {
|
||||
this.triggerEvent('close')
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user