Open zonleer opened 4 years ago
同出现了这个问题,不过我是页面上配置的,在v-for渲染的列表里使用了vue-qr
vue-qr.js:1 TypeError: Cannot read property 'nodeName' of null at r.draw (vue-qr.js:1) at L.makeCode (vue-qr.js:1) at L.create (vue-qr.js:1) at vue-qr.js:1 at h (vue-qr.js:1) at Generator._invoke (vue-qr.js:1) at Generator.next (vue-qr.js:1) at r (vue-qr.js:1) at s (vue-qr.js:1) at vue-qr.js:1
同问,我是v-if 来控制组件显示与否的,在不显示的时候出现了这个问题,是不是只要引入了组件,如果隐藏了html部分。js部分就找不到元素会出现这个问题? vue-qr.js?658f:formatted:2558 TypeError: Cannot read property 'nodeName' of null at r.draw (vue-qr.js?658f:formatted:2551) at E.makeCode (vue-qr.js?658f:formatted:2725) at E.create (vue-qr.js?658f:formatted:2716) at eval (vue-qr.js?658f:formatted:876) at h (vue-qr.js?658f:formatted:236) at Generator.eval [as _invoke] (vue-qr.js?658f:formatted:224) at Generator.eval [as next] (vue-qr.js?658f:formatted:275) at r (vue-qr.js?658f:formatted:70) at s (vue-qr.js?658f:formatted:86) at eval (vue-qr.js?658f:formatted:89)
========报错 es6.promise.js?551c:75TypeError: Cannot read property 'nodeName' of null at r.draw (webpack-internal:///./node_modules/vue-qr/dist/vue-qr.js:1:61939) at d.makeCode (webpack-internal:///./node_modules/vue-qr/dist/vue-qr.js:1:64673) at d.create (webpack-internal:///./node_modules/vue-qr/dist/vue-qr.js:1:64496) at VueComponent.e.a.methods.render (webpack-internal:///./node_modules/vue-qr/dist/vue-qr.js:1:7186) at VueComponent.eval (webpack-internal:///./node_modules/vue-qr/dist/vue-qr.js:1:7083) at n (webpack-internal:///./node_modules/vue-qr/dist/vue-qr.js:1:25216) at a.eval [as _invoke] (webpack-internal:///./node_modules/vue-qr/dist/vue-qr.js:1:26261) at a.t.(anonymous function) [as next] (webpack-internal:///./node_modules/vue-qr/dist/vue-qr.js:1:25395) at n (webpack-internal:///./node_modules/vue-qr/dist/vue-qr.js:1:31507) at eval (webpack-internal:///./node_modules/vue-qr/dist/vue-qr.js:1:31603)
================================== //vue-qr.js void 0 !== this._callback && this._callback(this._elCanvas.toDataURL()), void 0 !== this._bindElement) try { var lt = document.getElementById(this._bindElement); //**lt在微信开发工具里这个变量是null,创建的img元素id为空,导致二维码显示不出来,好奇怪 if ("IMG" === lt.nodeName) lt.src = this._elCanvas.toDataURL(); else { var ft = lt.style; ft["background-image"] = "url(" + this._elCanvas.toDataURL() + ")", ft["background-size"] = "contain", ft["background-repeat"] = "no-repeat" } } catch (t) {