mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(BackTop): rename visibility-height prop to offset (#11309)
This commit is contained in:
parent
7042d1c06e
commit
a318807eb5
@ -33,7 +33,7 @@ export const backTopProps = {
|
||||
right: makeNumericProp(30),
|
||||
bottom: makeNumericProp(40),
|
||||
target: [String, Object] as PropType<TeleportProps['to']>,
|
||||
visibilityHeight: makeNumericProp(200),
|
||||
offset: makeNumericProp(200),
|
||||
teleport: {
|
||||
type: [String, Object] as PropType<TeleportProps['to']>,
|
||||
default: 'body',
|
||||
@ -72,7 +72,7 @@ export default defineComponent({
|
||||
};
|
||||
|
||||
const scroll = () => {
|
||||
show.value = getScrollTop(target) >= props.visibilityHeight;
|
||||
show.value = getScrollTop(target) >= props.offset;
|
||||
};
|
||||
|
||||
const getTarget = () => {
|
||||
@ -95,7 +95,7 @@ export default defineComponent({
|
||||
);
|
||||
};
|
||||
|
||||
useEventListener('scroll', throttle(scroll, 300), { target: scrollParent });
|
||||
useEventListener('scroll', throttle(scroll, 100), { target: scrollParent });
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
|
@ -113,7 +113,7 @@ export default {
|
||||
| target | Can be a `selector` or `HTMLElement` | _string \| HTMLElement_ | - |
|
||||
| right | Right distance of the page, the default unit is px | _number \| string_ | `30` |
|
||||
| bottom | Bottom distance of the page, the default unit is px | _number \| string_ | `40` |
|
||||
| visibility-height | The button will not show until the scroll height reaches this value | _number_ | `200` |
|
||||
| offset | The button will not show until the scroll height reaches this value | _number_ | `200` |
|
||||
| teleport | Specifies a target element where BackTop will be mounted | _string \| Element_ | `body` |
|
||||
|
||||
### Slots
|
||||
|
@ -115,7 +115,7 @@ export default {
|
||||
| target | 触发滚动的目标对象,支持传入选择器或 `HTMLElement` | _string \| HTMLElement_ | - |
|
||||
| right | 距离页面右侧的距离,默认单位为 `px` | _number \| string_ | `30` |
|
||||
| bottom | 距离页面底部的距离,默认单位为 `px` | _number \| string_ | `40` |
|
||||
| visibility-height | 滚动高度达到此参数值才显示 | _number_ | `200` |
|
||||
| offset | 滚动高度达到此参数值才显示 | _number_ | `200` |
|
||||
| teleport | 指定挂载的节点,等同于 Teleport 组件的 [to 属性](https://v3.cn.vuejs.org/api/built-in-components.html#teleport) | _string \| Element_ | `body` |
|
||||
|
||||
### Slots
|
||||
|
Loading…
x
Reference in New Issue
Block a user