caiofsouza / vue-backtotop

A Back-to-top component for Vue.js, which scroll page to the top when clicked
https://caiofsouza.github.io/vue-backtotop/example/
MIT License
182 stars 42 forks source link

How to use with Nuxt JS ? #27

Open uzzal-ht opened 4 years ago

uzzal-ht commented 4 years ago

How to use with Nuxt JS ? Can anyone share an example code?

mellson commented 4 years ago

@uzzal-ht you need to create a plugin called vuebacktotop.js in your plugins folder. Add the following content to the file:

import Vue from 'vue'
import BackToTop from 'vue-backtotop'

Vue.use(BackToTop)

Then add this to the plugins section of your nuxt.config.js:

plugins: [
    { src: '~plugins/vue-backtotop.js', ssr: false } // add this line
  ]