From 1326782a8dae261a056166c5e64648f82a582f1c Mon Sep 17 00:00:00 2001 From: airyland Date: Sat, 30 Sep 2017 22:39:36 +0800 Subject: [PATCH] qrcode: fix errors when value is undefined (fix #2070) --- src/components/qrcode/index.vue | 4 ++++ src/components/qrcode/metas.yml | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/components/qrcode/index.vue b/src/components/qrcode/index.vue index 4cb428d26..67ca9d15d 100755 --- a/src/components/qrcode/index.vue +++ b/src/components/qrcode/index.vue @@ -66,6 +66,10 @@ export default { }, methods: { render () { + if (typeof this.value === 'undefined') { + return + } + const qrcode = new QRCodeImpl(-1, ErrorCorrectLevel[this.level]) qrcode.addData(this.value) qrcode.make() diff --git a/src/components/qrcode/metas.yml b/src/components/qrcode/metas.yml index d13086ac5..ae5555e15 100755 --- a/src/components/qrcode/metas.yml +++ b/src/components/qrcode/metas.yml @@ -30,6 +30,11 @@ props: en: 'render type, can be `img` or `canvas`' zh-CN: '渲染类型,可以为`img`(适合需要在微信需要长按识别的场景)和`canvas`' changes: + next: + en: + - '[fix] fix errors when value is undefined #2070' + zh-CN: + - '[fix] 修复 value 为 undefined 时报错的问题 #2070' v2.1.0-rc.47: zh-CN: - '[feature] 支持渲染类型为图片 #900 @keepgoingwm' \ No newline at end of file