kempsteven / vue-html2pdf

vue-html2pdf converts any vue component or element into PDF, vue-html2pdf is basically a vue wrapper only and uses html2pdf.js behind the scenes.
https://www.npmjs.com/package/vue-html2pdf
MIT License
440 stars 74 forks source link

Property 'generatePdf' does not exist on type 'Vue'. #36

Closed jeffersonbabuyo closed 4 years ago

jeffersonbabuyo commented 4 years ago

I am getting this error when using it on vuejs with typescript.

I have imported it and register it in my @Component()

image

jeffersonbabuyo commented 4 years ago

all good now, simply add $refs!: any ....closing this issue

s4sebin commented 3 years ago

Could you please share the working demo? where I need to add any?

kempsteven commented 3 years ago

@s4sebin

here you go: Demo Site: https://vue-html2pdf-demo.netlify.com/

Demo Github repo: https://github.com/kempsteven/vue-html2pdf-demo

lartheon commented 3 years ago

all good now, simply add $refs!: any ....closing this issue

I'm experiencing this issue, can you please explain where do you add this? Also I'm using typescript so I can't use 'any', what is the proper type to replace it with?

Master-Y0da commented 3 years ago

Same error here ... @jeffersonbabuyo could you please share the complete instruction ?

kempsteven commented 3 years ago

Hey guys can you try this? if this is a typescript error, i think this could be the fix

const html2pdfComponent: any = this.$refs.html2pdf 
html2pdfComponent.generatePdf()

or have a look at this, this is where $refs type are inserted. https://class-component.vuejs.org/guide/refs-type-extension.html image