Skip to content
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

fix(tree): on-scroll prop doesn't work when virtual-scroll prop is enabled #6678

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Fix `n-data-table` may have multiple expand trigger with tree data.
- Fix `n-date-picker`'s `confirm`, `now`, `clear` slots doesn't work with `'month'`, `'monthrange'`, `'quarter'`, `'quarterrange'`, `'year'` and `'yearrange'` type.
- Fix `n-input`'s `render-count` prop doesn't work when type is not `'textarea'`.
- Fix `n-tree`'s `on-scroll` prop doesn't work when `virtual-scroll` prop is enabled.

## 2.40.4

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- 修复 `n-data-table` 在使用树形数据的时候出现多个展开 icon
- 修复 `n-date-picker` 的 `confirm`、`now`、`clear` 插槽对 `'month'`、`'monthrange'`、`'quarter'`、`'quarterrange'`、`'year'` 和 `'yearrange'` 类型不生效
- 修复 `n-input` 的 `render-count` 属性在类型非 `'textarea'` 时不生效
- 修复 `n-tree` 的 `on-scroll` 回调在开启了虚拟滚动后没调用

## 2.40.4

Expand Down
6 changes: 5 additions & 1 deletion src/tree/src/Tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1540,8 +1540,12 @@ export default defineComponent({
})
resetDndState()
}
function handleScroll(): void {
function handleScroll(e: Event): void {
syncScrollbar()
const { virtualScroll, scrollbarProps } = props
if (virtualScroll && scrollbarProps?.onScroll) {
scrollbarProps?.onScroll(e)
}
}
function handleResize(): void {
syncScrollbar()
Expand Down