-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
vue 2.7 vue-qrcode 2.2.0 #164
Comments
Hello, for the v2.2.0, can I do like this instead?
|
Sure, does anything work unexpectedly? |
I dont know what happen, but it seem the QR wont appear, even copying directly from demo, doesnt do anything. there is no error being display, also when I inspect the element, it show 0x0 size. |
Can you provide an online reproduction? |
This comment was marked as off-topic.
This comment was marked as off-topic.
For Vue 2.7 this part of the code is invalid: vue/packages/vue-qrcode/index.ts Lines 120 to 123 in ef9104a
For Vue 2.7 it must look like this: h('img', {
attrs: { ...attrs, src: dataUrlRef.value },
}) |
@susnux Interesting, would you like to raise a PR for it? |
Probably something like this is needed: const version = Number(Vue.version.split('.')[0])
if (version === 2) {
// Vue v2 code
} else {
// current code
} |
the demo:
<script> import VueQrcode from 'vue-qrcode' export default { data() { return { dataUrl: null, } }, components: { VueQrcode, }, methods: { onDataUrlChange(dataUrl) { this.dataUrl = dataUrl }, }, } </script><vue-qrcode
value="https://www.1stg.me"
@change="onDataUrlChange"
/>
the error:
[Vue warn]: Missing required prop: "color"
Vue warn]: Missing required prop: "type"
change demo:
data() {
return {
qrcode: {
color: {
dark: 'black', // 设置二维码的主要颜色
light: 'white' // 设置二维码的背景颜色
}
},
codeText: 'test qrcode text',
no error, but there is no a qrcode in the page
The text was updated successfully, but these errors were encountered: