32 lines
616 B
JavaScript
32 lines
616 B
JavaScript
const drawQrcode = require('../../utils/weapp.qrcode.esm.js').default
|
|
|
|
Component({
|
|
data: {
|
|
visible: false,
|
|
qrcodeId: '',
|
|
loading: true
|
|
},
|
|
|
|
methods: {
|
|
show(id) {
|
|
this.setData({ visible: true, qrcodeId: id, loading: true })
|
|
wx.nextTick(() => {
|
|
drawQrcode({
|
|
width: 200,
|
|
height: 200,
|
|
canvasId: 'qrcodeCanvas',
|
|
_this: this,
|
|
text: id,
|
|
callback: () => {
|
|
this.setData({ loading: false })
|
|
}
|
|
})
|
|
})
|
|
},
|
|
|
|
onClose() {
|
|
this.setData({ visible: false, qrcodeId: '' })
|
|
}
|
|
}
|
|
})
|