Skip to content

Commit

Permalink
qrcode: fix errors when value is undefined (fix #2070)
Browse files Browse the repository at this point in the history
  • Loading branch information
airyland committed Sep 30, 2017
1 parent 95f47aa commit 1326782
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/qrcode/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 5 additions & 0 deletions src/components/qrcode/metas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

0 comments on commit 1326782

Please sign in to comment.