mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
docs(components): [anchor] add selectScrollTop prop (#19293)
* docs(components): [anchor] add `scrollTop` prop * feat: rename
This commit is contained in:
@@ -77,15 +77,16 @@ anchor/affix
|
||||
|
||||
### Anchor Attributes
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
| --------- | ---------------------------------------------------------- | -------------------------------------- | ---------- |
|
||||
| container | scroll container. | `string` \| `HTMLElement` \| `Window ` | — |
|
||||
| offset | set the offset of the anchor scroll. | `number` | 0 |
|
||||
| bound | the offset of the element starting to trigger the anchor. | `number` | 15 |
|
||||
| duration | set the scroll duration of the container, in milliseconds. | `number` | 300 |
|
||||
| marker | whether to show the marker. | ^[boolean] | true |
|
||||
| type | set Anchor type. | ^[enum]`'default' \| 'underline'` | `default` |
|
||||
| direction | Set Anchor direction. | ^[enum]`'vertical' \| 'horizontal'` | `vertical` |
|
||||
| Property | Description | Type | Default |
|
||||
| -------------------------- | ---------------------------------------------------------- | -------------------------------------- | ---------- |
|
||||
| container | scroll container. | `string` \| `HTMLElement` \| `Window ` | — |
|
||||
| offset | set the offset of the anchor scroll. | `number` | 0 |
|
||||
| bound | the offset of the element starting to trigger the anchor. | `number` | 15 |
|
||||
| duration | set the scroll duration of the container, in milliseconds. | `number` | 300 |
|
||||
| marker | whether to show the marker. | ^[boolean] | true |
|
||||
| type | set Anchor type. | ^[enum]`'default' \| 'underline'` | `default` |
|
||||
| direction | Set Anchor direction. | ^[enum]`'vertical' \| 'horizontal'` | `vertical` |
|
||||
| select-scroll-top ^(2.9.2) | scroll whether link is selected at the top | ^[boolean] | false |
|
||||
|
||||
### Anchor Events
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ export const anchorProps = buildProps({
|
||||
/**
|
||||
* @description Scroll whether link is selected at the top
|
||||
*/
|
||||
scrollTop: {
|
||||
selectScrollTop: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
|
||||
@@ -139,7 +139,7 @@ const getCurrentHref = () => {
|
||||
const next = anchorTopList[i + 1]
|
||||
|
||||
if (i === 0 && scrollTop === 0) {
|
||||
return props.scrollTop ? item.href : ''
|
||||
return props.selectScrollTop ? item.href : ''
|
||||
}
|
||||
if (item.top <= scrollTop && (!next || next.top > scrollTop)) {
|
||||
return item.href
|
||||
|
||||
Reference in New Issue
Block a user