Closed sbefort closed 6 years ago
Hello @sbefort . Sorry for replying so late. Have some personal stuff these days. The window
is generated by the build script. Will try to find a solution. Hope this component works well in your project.
The component works very well so thank you for that. Many people are using server-side rendering tools like Nuxt for SEO purposes so if you could make it server-side compatible by somehow getting rid of client-side objects like window
and document
that would be awesome.
I built successfully without window
and document
by removing the style tag of Paginate
https://github.com/lokyoung/vuejs-paginate/blob/master/src/components/Paginate.vue#L215-L219
Thanks I'll check it out!
In Nuxt (or SSR in general) when you set this plugin to not happen in the server, errors referencing window
not being available are gone but you get this in the browser instead:
The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>. Bailing hydration and performing full client-side render.
As posted by @InstanceOfMichael in #32, you need to import Paginate from 'vuejs-paginate/src/components/Paginate';
directly. Otherwise, importing vuejs-paginate
will pull package.json's main file, which is dist/index.js
. That's the one I assume is generated by webpack and contains the reference to window
.
@johnRivs Thank you so much.
@sbefort You can import the library by import Paginate from 'vuejs-paginate/src/components/Paginate';
for SSR. Any question please reopen this issue.
Please see this issue that has just been updated: https://github.com/lokyoung/vuejs-paginate/issues/32