A button that, when you click it, brings your screen to the top
npm install vue-gototop-button
npm i vue-gototop-button
`
使用
全局加载组件
`js
// main.js
import { createApp } from 'vue'
import { gtbutton } from 'vue-gototop-button'
import App from './App.vue'
// ...
createApp(App).use(gtbutton).mount('#app')
`
手动导入
`html
↑
`
参数
| 属性名 | 说明 |
|------|----|
| top | 当屏幕滚动小于该值时显示按钮 |
修改 css
在node_modules/vue-gototop-button/GoTopButton.css修改
默认值:
`css
button{
position: fixed;
right: 50px;
bottom: 50px;
}
``