I use vue-scroller of the vue Plugins in my project. It work on the initial load but when the page is refreshed锛孖 get 2 errors, the first is "document is not defined" then if I refresh the page again i'll get "Error: render function or template not defined in component: anonymous".
I have already set SSR to false for vue-scroller in the nuxt.config.js but not resolved the 'document is not defined'
<template>
...
<scroller style="top: 97px" :on-infinite="loadMore">
</scroller>
....
</template>
...
<script>
import Vue from 'vue';
import Scroller from 'vue-scroller';
Vue.use(Scroller)
...
</script>
...
plugins: [
{
src:'~plugins/vue-scroll.js',
ssr:false
}
],
...
import Vue from 'vue';
import Scroller from'vue-scroller';
Vue.use(Scroller);
Hey. Two potentially typos in your .vue example. You should only have one root element inside <templates. Also Vue.use should not be inside .vue anymore (or you will get more SSR problems). Please provide your full .vue file for better help.
in vue-scroll.js
Can you try:
Vue.component('scroller', Scroller);
I had a similar issue with vue-flickity
I also have the same problem, trying to use Vue.component ('scroller', Scroller); but it doesn't work.
@kennsand try this
as specified, do not import the component when you want to use it, as it's registered globally
@syffs thanks a lot - this helped me fixed my problem.
It doesn't matter in my case, but isn't it bad that i have to declare the component globally?
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
@kennsand try this
as specified, do not import the component when you want to use it, as it's registered globally