I am trying to build a website using nuxtjs mainly for server side rendering purpose. I have used vuejs but in this everything gets executed at client side, I don't want this to happen.

I have several pages where i am fetching data dynamically. On initial load i have used nuxtServerInit in actions to fetch data from server side and it works perfectly but what my problem is i have infinite scroll page and when i scroll to the bottom for the next 10 array of objects it gets executed on client side and this brings me to same concern as i have with vuejs.

I am using vue-infinite-loading, it works but this is clearly not compatible with ssr, is there any other library for the same to achieve the goal

<infinite-loading @infinite="infiniteHandler" ref="infiniteLoading">
    <span slot="no-more">no more data...</span>
</infinite-loading>

method

infiniteHandler () {
    let object = {
       current_page: this.Question.current_page + 1,
       orderBy: this.orderBy
     }
     this.$store.dispatch('Question/getAllQuestions', object)
        .then(
           response => {
             console.log('worked')
           }
        }
     )
}

How can i make it server side rendering when i scroll to bottom, how can i achieve the same what nuxtServerInit does on initial load i.e server side rendering.

0 Answers