From 4f15391dd268eec45e006d292f9fde0dde90de71 Mon Sep 17 00:00:00 2001 From: Dsaquel <291874700n@gmail.com> Date: Sun, 25 May 2025 23:44:02 +0200 Subject: [PATCH] wip --- docs/en-US/component/scrollbar.md | 46 +++++++++---------- docs/examples/scrollbar/infinite-scroll.vue | 2 +- .../components/scrollbar/src/constants.ts | 2 + .../components/scrollbar/src/scrollbar.ts | 18 +++++--- .../components/scrollbar/src/scrollbar.vue | 8 +++- packages/components/scrollbar/src/thumb.vue | 23 ++++++++-- packages/components/scrollbar/src/util.ts | 6 ++- packages/theme-chalk/src/scrollbar.scss | 27 +++++++++++ 8 files changed, 95 insertions(+), 37 deletions(-) diff --git a/docs/en-US/component/scrollbar.md b/docs/en-US/component/scrollbar.md index ba1efe7496..1e6e0ed57a 100644 --- a/docs/en-US/component/scrollbar.md +++ b/docs/en-US/component/scrollbar.md @@ -39,9 +39,9 @@ scrollbar/manual-scroll ::: -## Infinite scroll ^(2.9.11) +## Infinite scroll ^(2.9.12) -:::demo When the end of the scroll is reached `endReached` is called. It can be used for infinite scroll. +:::demo When the end of the scroll is reached `bottom-reached` is called. It can be used for infinite scroll. scrollbar/infinite-scroll @@ -51,25 +51,26 @@ scrollbar/infinite-scroll ### Attributes -| Name | Description | Type | Default | -| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | ------- | -| height | height of scrollbar | ^[string] / ^[number] | — | -| max-height | max height of scrollbar | ^[string] / ^[number] | — | -| native | whether to use the native scrollbar style | ^[boolean] | false | -| wrap-style | style of wrap container | ^[string] / ^[object]`CSSProperties \| CSSProperties[] \| string[]` | — | -| wrap-class | class of wrap container | ^[string] | — | -| view-style | style of view | ^[string] / ^[object]`CSSProperties \| CSSProperties[] \| string[]` | — | -| view-class | class of view | ^[string] | — | -| noresize | do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance | ^[boolean] | false | -| tag | element tag of the view | ^[string] | div | -| always | always show scrollbar | ^[boolean] | false | -| min-size | minimum size of scrollbar | ^[number] | 20 | -| id ^(2.4.0) | id of view | ^[string] | — | -| role ^(2.4.0) ^(a11y) | role of view | ^[string] | — | -| aria-label ^(2.4.0) ^(a11y) | aria-label of view | ^[string] | — | -| aria-orientation ^(2.4.0) ^(a11y) | aria-orientation of view | ^[enum]`'horizontal' \| 'vertical'` | — | -| tabindex ^(2.8.3) | tabindex of wrap container | ^[number] / ^[string] | — | -| end-reached ^(2.9.11) | Invoked when the end of the scroll is reached. Useful for infinite scroll. | (options: [InfiniteLoadScrollOptions](#typings)) => Awaitable | — | +| Name | Description | Type | Default | +| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | ------- | +| height | height of scrollbar | ^[string] / ^[number] | — | +| max-height | max height of scrollbar | ^[string] / ^[number] | — | +| native | whether to use the native scrollbar style | ^[boolean] | false | +| wrap-style | style of wrap container | ^[string] / ^[object]`CSSProperties \| CSSProperties[] \| string[]` | — | +| wrap-class | class of wrap container | ^[string] | — | +| view-style | style of view | ^[string] / ^[object]`CSSProperties \| CSSProperties[] \| string[]` | — | +| view-class | class of view | ^[string] | — | +| noresize | do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance | ^[boolean] | false | +| tag | element tag of the view | ^[string] | div | +| always | always show scrollbar | ^[boolean] | false | +| min-size | minimum size of scrollbar | ^[number] | 20 | +| id ^(2.4.0) | id of view | ^[string] | — | +| role ^(2.4.0) ^(a11y) | role of view | ^[string] | — | +| aria-label ^(2.4.0) ^(a11y) | aria-label of view | ^[string] | — | +| aria-orientation ^(2.4.0) ^(a11y) | aria-orientation of view | ^[enum]`'horizontal' \| 'vertical'` | — | +| tabindex ^(2.8.3) | tabindex of wrap container | ^[number] / ^[string] | — | +| bottom-reached ^(2.9.12) | invoked when the end of the scroll is reached. Useful for infinite scroll. | (options: [ScrollOptions](#typings)) => Awaitable | — | +| direction ^(2.9.12) | direction to use the infinite scroll scroll. | ^[enum]`'top'\| 'bottom' \| 'left'\| 'right'` | bottom | ### Events @@ -104,8 +105,7 @@ import { useScroll } from '@vueuse/core' import type { UnwrapNestedRefs } from 'vue' type Awaitable = Promise | T - -type InfiniteLoadScrollOptions = UnwrapNestedRefs> +type ScrollOptions = UnwrapNestedRefs> ``` diff --git a/docs/examples/scrollbar/infinite-scroll.vue b/docs/examples/scrollbar/infinite-scroll.vue index 9090aed5a9..8f6a621bd9 100644 --- a/docs/examples/scrollbar/infinite-scroll.vue +++ b/docs/examples/scrollbar/infinite-scroll.vue @@ -1,5 +1,5 @@