A Back-to-top component for Vue.js, which scroll page to the top when clicked
See demo.
npm install vue-backtotop --save
Import for global usage
import Vue from 'vue'
import BackToTop from 'vue-backtotop'
Vue.use(BackToTop);
...
Or on a single component
import BackToTop from 'vue-backtotop'
...
},
components: { BackToTop }
...
- Currently, the vue-backtotop has a property named "text", that is the text which will be visible on button. The default value is "Voltar ao topo".
<back-to-top text="Back to top"></back-to-top>
- The button to back to top become visible at window scroll at 600 > px. If you want to change this value, pass a property named "visibleOffset" with a number value.
<back-to-top text="Back to top" visibleOffset="500"></back-to-top>