You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
844 B
35 lines
844 B
Vue.component("qr", {
|
|
template: '<div ref="qr" v-show="this.value !== \'\'"></div>',
|
|
name: 'qr',
|
|
props: {
|
|
value: [String, Number],
|
|
width: {
|
|
"type": Number,
|
|
"default": function () {
|
|
return 128;
|
|
}
|
|
}
|
|
},
|
|
watch: {
|
|
value: {
|
|
immediate: true,
|
|
handler: function (value) {
|
|
if (this.qrcode) {
|
|
this.qrcode.makeCode(value + "");
|
|
}
|
|
}
|
|
}
|
|
},
|
|
mounted: function () {
|
|
this.qrcode = new QRCode(this.$refs.qr, {
|
|
text: this.value + "",
|
|
width: this.width,
|
|
height: this.width
|
|
});
|
|
},
|
|
methods: {
|
|
handleChange: function (e) {
|
|
this.$emit("change", this.checked, e);
|
|
}
|
|
}
|
|
});
|