mycurelabs / vue-html-to-paper

Vue mixin for paper printing html elements.
MIT License
298 stars 101 forks source link

how to use in nuxt ? #95

Open morteza-mortezai opened 3 years ago

morteza-mortezai commented 3 years ago

i'm trying to use vue-html-to-paper in nuxt and as i use it just in a single page then i imported it locally but i get this error every time . "VueHtmlToPaper" is not a function

so how can i use it locally ?

cvalues commented 3 years ago

Hi,

load it as plugin: Create a print.js in the plugins dir, add the following code:

`import Vue from 'vue'; import VueHtmlToPaper from 'vue-html-to-paper';

const options = { name: '_blank', specs: [ 'fullscreen=yes', 'titlebar=yes', 'scrollbars=yes' ], styles: [ 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css', 'https://unpkg.com/kidlat-css/css/kidlat.css' ], timeout: 1000, // default timeout before the print window appears autoClose: true, // if false, the window will not close after printing windowTitle: window.document.title, // override the window title }

Vue.use(VueHtmlToPaper, options);

// or, using the defaults with no stylesheet Vue.use(VueHtmlToPaper);`

and load it as plugin in your nuxt.config.js

renansantos-fpass commented 5 months ago

How do i use it in Nuxt 3?