Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qrcode在后台数据加载完成前,因没有this.value报错 #2070

Closed
shiLinQing407 opened this issue Sep 30, 2017 · 2 comments
Closed

Comments

@shiLinQing407
Copy link

<qrcode :value="member_data.card_no" :size="160" type="img"></qrcode>

:value 绑定后台加载过来的数据。在模板渲染时,因为数据还未加载完成,所以Qrcode/index.vue文件中:
第70行:
qrcode.addData(this.value)
value值为undefined,导致报错

vue.common.js?e881:481 [Vue warn]: Error in nextTick: "TypeError: Cannot read property 'length' of undefined"

请教大佬们有什么办法能不报错吗?(虽然不影响使用,反正有数据后会重新渲染一次)

@airyland
Copy link
Owner

暂时可以用 v-if 实现在有值时渲染。

@shiLinQing407
Copy link
Author

多谢指教!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants