Binaryify / vue-qr

The Vue Component for Awesome-qr.js
MIT License
849 stars 123 forks source link

text传入变量报错 #19

Closed qinhui6 closed 6 years ago

qinhui6 commented 6 years ago

image image 用 :text传入变量url报错了,麻烦帮忙看一下

Binaryify commented 6 years ago

你传的 undefined 了 image

qinhui6 commented 6 years ago

怎么获取callback值呢?生成的二维码的下载地址

Binaryify commented 6 years ago
<vue-qr :text="text" :autoColor='true' :logoSrc="src2" :size="400" :margin="0" :callback="fun"></vue-qr>
methods:{
    fun(url){
      console.log(url)
    }
  }

callback 拿到的是 base64

liuchang0108 commented 6 years ago

if (this._bindElement !== undefined) { try { var el = document.getElementById(this._bindElement); if (el.nodeName === 'IMG') { el.src = this._elCanvas.toDataURL(); } else { var elStyle = el.style; elStyle["background-image"] = 'url(' + this._elCanvas.toDataURL() + ')'; elStyle["background-size"] = 'contain'; elStyle["background-repeat"] = 'no-repeat'; } } catch (e) { console.error(e); } } 这里报错TypeError: Cannot read property 'nodeName' of null 不知道哪里出了问题

Binaryify commented 6 years ago

@liuchang0108 晚点修复