This is a playground
to test code. It runs a full Node.js
environment and already has all of npm
’s 400,000 packages pre-installed, including @tsx-react-ui/backtop
with all npm
packages installed. Try it out:
require()
any package directly from npmawait
any promise instead of using callbacks (example)This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
The backtop component of the react written in Typescript
组件使用 npm
进行管理,请使用以下命令进行组件安装:
npm i @tsx-react-ui/backtop --save
npm install -g cnpm --registry=https://registry.npm.taobao.org
最少配置参数为:
<Backtop />
详细配置:
<Backtop className="custom-back-top" showHeight={300} target={() => document.getElementById('target')} >
<div className="custom-back-top-icon">UP</div>
</Backtop>
Prop | Type | Default | Description |
---|---|---|---|
showHeight | number | 200 | 当滚动高度超过此值时显示"返回顶部"按钮 |
className | string | undefined | 自定义样式 |
target | function | () => window | 返回指定滚动的DOM元素,默认为window |
children | ReactNode | undefined | 自定义图标 |