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

How to call $htmlToPaper in js file ? #22

Closed
brwa-ata opened this issue Nov 10, 2019 · 2 comments
Closed

How to call $htmlToPaper in js file ? #22

brwa-ata opened this issue Nov 10, 2019 · 2 comments

Comments

@brwa-ata
Copy link

Hello, guys
You did a great job and this is what I was looking for, everything works well.
But I have a question in my project there are many components I should add print to it, so I created a JS file and wrote my code there in this way any where I want to print just call that function and it should do it.
The problem is when I write this.$htmlToPaper inside the function in JS file it gives me an error
Error in v-on handler: "TypeError: Cannot read property '$htmlToPaper' of undefined".
Please how can I call that $htmlToPaper in JS file?

@yzx9
Copy link
Contributor

yzx9 commented Nov 19, 2019

You can't use this.$htmlToPaper in JS file, because ES6 module prevent this pointer to global,
and $htmlToPaper mount on Vue Instance. but I also like use like import { htmlToPaper } from 'vue-html-to-paper', it's more like Vue3

@brwa-ata
Copy link
Author

ok, thanks

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

Successfully merging a pull request may close this issue.

2 participants