每次点击都会添加img标签
解决如下:
handleExtendDialog(row) {
// this.qrcode();
// 必须这样调用 否则会出现 appendChild null 就是id为qrcode的dom获取不到 返回结果为null
this.$nextTick(function() {
let dom = document.getElementById("qrcode");
// firstChild 属性返回被选节点的第一个子节点。
while (dom.firstChild) {
dom.removeChild(dom.firstChild);
}
//这里调用创建二维码
this.qrcode();
});
},