bee-backtop
react bee-backtop component for tinper-bee
返回顶部
使用方法
import BackTop from 'bee-backtop';
class BackTopDemo extends Component {
render() {
return (
<BackTop/>
)
}
}
样式引入
- 可以使用link引入build目录下BackTop.css
<link rel="stylesheet" href="./node_modules/bee-backtop/build/BackTop.css">
- 可以在js中import样式
import "./node_modules/bee-backtop/src/BackTop.scss"
//或是
import "./node_modules/bee-backtop/build/BackTop.css"
API
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
visibilityHeight | 当滚动条高度达到多少显示backtop | number |
400 |
target | 设置要监听滚动事件的元素 | function |
() => window |
click | 点击backTop时的回调函数 | function |
- |
character | 自定义字符 |
ReactNode /string
|
开发调试
$ npm install -g bee-tools
$ git clone https://github.com/tinper-bee/bee-backtop
$ cd bee-backtop
$ npm install
$ npm run dev