<el-button type="primary" @click="OpenSource">生成二维码</el-button>
import QRCode from 'qrcode'
//生成二维码
OpenSource() {
const check = /^[1-9][0-9]*$/
if (!check.test(this.sourceNum) || (this.sourceNum && this.sourceNum.length > 9)) {
this.$message.error('只能输入最多9位数的数字!')
return
}
this.sourceLinkling = `${this.previewWebUrl}
&channel=${this.sourceNum}`
QRCode.toDataURL(this.sourceLinkling)
.then(url => {
this.channelUrl = url
})
.catch(err => {
console.error(err)
})
},