diff --git a/packages/vant/src/back-top/BackTop.tsx b/packages/vant/src/back-top/BackTop.tsx index 89468fe05..a3e2c0b7a 100644 --- a/packages/vant/src/back-top/BackTop.tsx +++ b/packages/vant/src/back-top/BackTop.tsx @@ -33,7 +33,7 @@ export const backTopProps = { right: makeNumericProp(30), bottom: makeNumericProp(40), target: [String, Object] as PropType, - visibilityHeight: makeNumericProp(200), + offset: makeNumericProp(200), teleport: { type: [String, Object] as PropType, 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(() => { diff --git a/packages/vant/src/back-top/README.md b/packages/vant/src/back-top/README.md index b9ab37057..c07da982e 100644 --- a/packages/vant/src/back-top/README.md +++ b/packages/vant/src/back-top/README.md @@ -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 diff --git a/packages/vant/src/back-top/README.zh-CN.md b/packages/vant/src/back-top/README.zh-CN.md index d130dbc08..9b3d3aad2 100644 --- a/packages/vant/src/back-top/README.zh-CN.md +++ b/packages/vant/src/back-top/README.zh-CN.md @@ -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