2021-10-22 19:32:39 +08:00
|
|
|
---
|
2021-10-25 15:21:08 +08:00
|
|
|
title: Backtop
|
2021-10-22 19:32:39 +08:00
|
|
|
lang: en-US
|
|
|
|
---
|
|
|
|
|
2021-09-17 00:18:50 +08:00
|
|
|
# Backtop
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2022-03-24 15:35:15 +08:00
|
|
|
A button to back to top.
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2022-03-24 15:35:15 +08:00
|
|
|
## Basic Usage
|
2020-08-13 15:18:26 +08:00
|
|
|
|
|
|
|
Scroll down to see the bottom-right button.
|
2021-09-17 00:18:50 +08:00
|
|
|
|
2020-08-13 15:18:26 +08:00
|
|
|
:::demo
|
|
|
|
|
2021-09-17 00:18:50 +08:00
|
|
|
backtop/basic
|
2020-08-13 15:18:26 +08:00
|
|
|
|
|
|
|
:::
|
|
|
|
|
2021-09-17 00:18:50 +08:00
|
|
|
## Customizations
|
2020-08-13 15:18:26 +08:00
|
|
|
|
|
|
|
Display area is 40px \* 40px.
|
2021-09-17 00:18:50 +08:00
|
|
|
|
2020-08-13 15:18:26 +08:00
|
|
|
:::demo
|
|
|
|
|
2021-09-17 00:18:50 +08:00
|
|
|
backtop/custom
|
2020-08-13 15:18:26 +08:00
|
|
|
|
|
|
|
:::
|
|
|
|
|
2022-03-24 15:35:15 +08:00
|
|
|
## Backtop API
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2022-03-24 15:35:15 +08:00
|
|
|
### Backtop Attributes
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2022-03-24 15:35:15 +08:00
|
|
|
| Name | Description | Type | Default |
|
|
|
|
| ------------------- | -------------------------------------------------------------------- | -------- | ------- |
|
|
|
|
| `target` | the target to trigger scroll. | `string` | — |
|
|
|
|
| `visibility-height` | the button will not show until the scroll height reaches this value. | `number` | `200` |
|
|
|
|
| `right` | right distance. | `number` | `40` |
|
|
|
|
| `bottom` | bottom distance. | `number` | `40` |
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2022-03-24 15:35:15 +08:00
|
|
|
## Backtop Events
|
2021-10-04 08:26:51 +08:00
|
|
|
|
2022-03-24 15:35:15 +08:00
|
|
|
| Name | Description | Parameters |
|
|
|
|
| ------- | -------------------- | --------------------------- |
|
|
|
|
| `click` | triggers when click. | `(evt: MouseEvent) => void` |
|
2021-10-04 08:26:51 +08:00
|
|
|
|
2022-03-24 15:35:15 +08:00
|
|
|
## Backtop Slots
|
|
|
|
|
|
|
|
| Name | Description |
|
|
|
|
| --------- | -------------------------- |
|
|
|
|
| `default` | customize default content. |
|