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

Download Link Broken #11

Open
ericfrancisco opened this issue Feb 18, 2022 · 7 comments
Open

Download Link Broken #11

ericfrancisco opened this issue Feb 18, 2022 · 7 comments

Comments

@ericfrancisco
Copy link

Download link doesn't work. Looks like when this was forked the function tied to the Download button was deleted.
@click="onDownloadClick"

The onDownloadClick function is not referenced anywhere and thus never happens

@kdbagwe
Copy link

kdbagwe commented Jun 28, 2022

Is it fixed?

@JosephShepin
Copy link

no it's not fixed. Wish it was though!

@mat813
Copy link

mat813 commented Oct 9, 2022

And with vue-tsc 1.0, it now errors out on compilation even if download is disabled :(

$ vue-tsc --noEmit && vite build
node_modules/qrcode-vue3/src/QRCodeVue3.vue:7:23 - error TS2339: Property 'onDownloadClick' does not exist on type '{ $: ComponentInternalInstance; $data: { imageUrl: string; qrCode: QRCodeStyling; }; $props: Partial<{ download: boolean; imageOptions: Record<string, any>; ... 13 more ...; downloadOptions: Record<...>; }> & Omit<...>; ... 10 more ...; $watch(source: string | Function, cb: Function, options?: WatchOptions<...>): Wa...'.

7       <button @click="onDownloadClick" :class="downloadButton">
                        ~~~~~~~~~~~~~~~


Found 1 error in node_modules/qrcode-vue3/src/QRCodeVue3.vue:7

@JosephShepin
Copy link

JosephShepin commented Oct 11, 2022

And with vue-tsc 1.0, it now errors out on compilation even if download is disabled :(

$ vue-tsc --noEmit && vite build
node_modules/qrcode-vue3/src/QRCodeVue3.vue:7:23 - error TS2339: Property 'onDownloadClick' does not exist on type '{ $: ComponentInternalInstance; $data: { imageUrl: string; qrCode: QRCodeStyling; }; $props: Partial<{ download: boolean; imageOptions: Record<string, any>; ... 13 more ...; downloadOptions: Record<...>; }> & Omit<...>; ... 10 more ...; $watch(source: string | Function, cb: Function, options?: WatchOptions<...>): Wa...'.

7       <button @click="onDownloadClick" :class="downloadButton">
                        ~~~~~~~~~~~~~~~


Found 1 error in node_modules/qrcode-vue3/src/QRCodeVue3.vue:7

This package has a lot of problems. The best thing to do if you really need it is to fork it and fix it yourself. I did that but I never fixed the download button - it looks like an easy fix tho.

@yxw770
Copy link

yxw770 commented Feb 9, 2023

You can try this code:
const image = document.querySelector(".wallet__img-qrcode img") const canvas = document.createElement("canvas"); canvas.width = image.width; canvas.height = image.height; const context = canvas.getContext("2d"); context.drawImage(image, 0, 0, image.width, image.height); // Get the base64 encoded data of the image const url = canvas.toDataURL("image/png"); var link = document.createElement("a"); document.body.appendChild(link); // for Firefox link.setAttribute("href", url); const fileName = (new Date()).toLocaleString() + '-qr-code.png' link.setAttribute("download", fileName); link.click();

@Gimanh
Copy link

Gimanh commented May 2, 2023

@scholtz
Copy link
Owner

scholtz commented May 18, 2023

Fixed in last update. Demo is here: https://github.com/scholtz/qrcode-vue3-sample/blob/master/src/App.vue#L12

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

7 participants