Open prasetyo-jeanu opened 1 year ago
@prasetyo-jeanu you can use provide/inject
to access it, I've try it
/* your main.js*/
...
app.provide("$htmlToPaper", app.config.globalProperties.$htmlToPaper);
...
<script>
/*where you want to print*/
...
const $htmlToPaper = inject("$htmlToPaper");
const printThis = () => {
$htmlToPaper("printArea");
};
</script>
It works !
ps: getCurrentInstance
is deprecated in latest Vue version
I cant access htmlToPaper in vue 3 composition API