-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backtop: Add backtop component #15541
Merged
Merged
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
98f3982
init backtop
iamkun 99ca4d1
add backtop
iamkun 901ec15
rm build in backtop
iamkun 27d1ffd
update doc
iamkun a31cd2c
update types
iamkun 125653c
update docs
iamkun 1b0774c
add test
iamkun d5270c9
update review
iamkun fe4aa75
update docs
iamkun 1ededb4
update review
iamkun 5be8cf6
update doc
iamkun 635c794
Merge branch 'dev' into feat/back-to-top
iamkun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
## Backtop | ||
|
||
A button to back to top | ||
|
||
### Basic usage | ||
|
||
Scroll down to see the bottom-right button. | ||
:::demo | ||
|
||
```html | ||
<template> | ||
Scroll down to see the bottom-right button. | ||
<el-backtop target=".page-component__scroll .el-scrollbar__wrap"></el-backtop> | ||
</template> | ||
``` | ||
|
||
::: | ||
|
||
### Customizations | ||
|
||
Display area is 40px \* 40px. | ||
:::demo | ||
|
||
```html | ||
<template> | ||
Scroll down to see the bottom-right button. | ||
<el-backtop target=".page-component__scroll .el-scrollbar__wrap" bottom="100"> | ||
<div | ||
style="{ | ||
height: 100%; | ||
width: 100%; | ||
background-color: #f2f5f6; | ||
box-shadow: 0 0 6px rgba(0,0,0, .12); | ||
text-align: center; | ||
line-height: 40px; | ||
color: #1989fa; | ||
}" | ||
> | ||
UP | ||
</div> | ||
</el-backtop> | ||
</template> | ||
``` | ||
|
||
::: | ||
|
||
### Attributes | ||
|
||
| Attribute | Description | Type | Accepted Values | Default | | ||
| ----------------- | ------------------------------------------------------------------- | --------------- | --------------- | ------- | | ||
| target | the target to trigger scroll | string | | | | ||
| visibility-height | the button will not show until the scroll height reaches this value | string / number | | 200 | | ||
| right | right distance | string / number | | 40 | | ||
| bottom | bottom distance | string / number | | 40 | | ||
|
||
### Events | ||
|
||
| Event Name | Description | Parameters | | ||
| ---------- | ------------------- | ----------- | | ||
| click | triggers when click | click event | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
## Backtop | ||
|
||
A button to back to top | ||
|
||
### Basic usage | ||
|
||
Scroll down to see the bottom-right button. | ||
:::demo | ||
|
||
```html | ||
<template> | ||
Scroll down to see the bottom-right button. | ||
<el-backtop target=".page-component__scroll .el-scrollbar__wrap"></el-backtop> | ||
</template> | ||
``` | ||
|
||
::: | ||
|
||
### Customizations | ||
|
||
Display area is 40px \* 40px. | ||
:::demo | ||
|
||
```html | ||
<template> | ||
Scroll down to see the bottom-right button. | ||
<el-backtop target=".page-component__scroll .el-scrollbar__wrap" bottom="100"> | ||
<div | ||
style="{ | ||
height: 100%; | ||
width: 100%; | ||
background-color: #f2f5f6; | ||
box-shadow: 0 0 6px rgba(0,0,0, .12); | ||
text-align: center; | ||
line-height: 40px; | ||
color: #1989fa; | ||
}" | ||
> | ||
UP | ||
</div> | ||
</el-backtop> | ||
</template> | ||
``` | ||
|
||
::: | ||
|
||
### Attributes | ||
|
||
| Attribute | Description | Type | Accepted Values | Default | | ||
| ----------------- | ------------------------------------------------------------------- | --------------- | --------------- | ------- | | ||
| target | the target to trigger scroll | string | | | | ||
| visibility-height | the button will not show until the scroll height reaches this value | string / number | | 200 | | ||
| right | right distance | string / number | | 40 | | ||
| bottom | bottom distance | string / number | | 40 | | ||
|
||
### Events | ||
|
||
| Event Name | Description | Parameters | | ||
| ---------- | ------------------- | ----------- | | ||
| click | triggers when click | click event | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
## Backtop | ||
|
||
A button to back to top | ||
|
||
### Basic usage | ||
|
||
Scroll down to see the bottom-right button. | ||
:::demo | ||
|
||
```html | ||
<template> | ||
Scroll down to see the bottom-right button. | ||
<el-backtop target=".page-component__scroll .el-scrollbar__wrap"></el-backtop> | ||
</template> | ||
``` | ||
|
||
::: | ||
|
||
### Customizations | ||
|
||
Display area is 40px \* 40px. | ||
:::demo | ||
|
||
```html | ||
<template> | ||
Scroll down to see the bottom-right button. | ||
<el-backtop target=".page-component__scroll .el-scrollbar__wrap" bottom="100"> | ||
<div | ||
style="{ | ||
height: 100%; | ||
width: 100%; | ||
background-color: #f2f5f6; | ||
box-shadow: 0 0 6px rgba(0,0,0, .12); | ||
text-align: center; | ||
line-height: 40px; | ||
color: #1989fa; | ||
}" | ||
> | ||
UP | ||
</div> | ||
</el-backtop> | ||
</template> | ||
``` | ||
|
||
::: | ||
|
||
### Attributes | ||
|
||
| Attribute | Description | Type | Accepted Values | Default | | ||
| ----------------- | ------------------------------------------------------------------- | --------------- | --------------- | ------- | | ||
| target | the target to trigger scroll | string | | | | ||
| visibility-height | the button will not show until the scroll height reaches this value | string / number | | 200 | | ||
| right | right distance | string / number | | 40 | | ||
| bottom | bottom distance | string / number | | 40 | | ||
|
||
### Events | ||
|
||
| Event Name | Description | Parameters | | ||
| ---------- | ------------------- | ----------- | | ||
| click | triggers when click | click event | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
## Backtop 回到顶部 | ||
|
||
返回页面顶部的操作按钮 | ||
|
||
### 基础用法 | ||
|
||
滑动页面即可看到右下方的按钮。 | ||
:::demo | ||
|
||
```html | ||
<template> | ||
Scroll down to see the bottom-right button. | ||
<el-backtop target=".page-component__scroll .el-scrollbar__wrap"></el-backtop> | ||
</template> | ||
``` | ||
|
||
::: | ||
|
||
### 自定义显示内容 | ||
|
||
显示区域被固定为 40px \* 40px 的区域, 其中的内容可支持自定义。 | ||
:::demo | ||
|
||
```html | ||
<template> | ||
Scroll down to see the bottom-right button. | ||
<el-backtop target=".page-component__scroll .el-scrollbar__wrap" bottom="100"> | ||
<div | ||
style="{ | ||
height: 100%; | ||
width: 100%; | ||
background-color: #f2f5f6; | ||
box-shadow: 0 0 6px rgba(0,0,0, .12); | ||
text-align: center; | ||
line-height: 40px; | ||
color: #1989fa; | ||
}" | ||
> | ||
UP | ||
</div> | ||
</el-backtop> | ||
</template> | ||
``` | ||
|
||
::: | ||
|
||
### Attributes | ||
|
||
| 参数 | 说明 | 类型 | 可选值 | 默认值 | | ||
| ----------------- | -------------------------------- | --------------- | ------ | ------ | | ||
| target | 触发滚动的对象 | string | | | | ||
| visibility-height | 滚动高度达到此参数值才出现 | string / number | | 200 | | ||
| right | 控制其显示位置, 距离页面右边距 | string / number | | 40 | | ||
| bottom | 控制其显示位置, 距离页面底部距离 | string / number | | 40 | | ||
|
||
### Events | ||
|
||
| 事件名 | 说明 | 回调参数 | | ||
| ------ | ------------------ | -------- | | ||
| click | 点击按钮触发的事件 | 点击事件 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
缩进
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1