feat(components): [table] expose scroll event (#12524)

* feat(components): [table] expose scroll event

* chore: update doc
This commit is contained in:
blesstosam 2024-11-20 21:49:22 +08:00 committed by GitHub
parent 897ba8bb9d
commit f1e95dc3a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View File

@ -312,6 +312,7 @@ table/table-layout
| current-change | triggers when current row changes | ^[Function]`(currentRow: any, oldCurrentRow: any) => void` | | current-change | triggers when current row changes | ^[Function]`(currentRow: any, oldCurrentRow: any) => void` |
| header-dragend | triggers after changing a column's width by dragging the column header's border | ^[Function]`(newWidth: number, oldWidth: number, column: any, event: MouseEvent) => void` | | header-dragend | triggers after changing a column's width by dragging the column header's border | ^[Function]`(newWidth: number, oldWidth: number, column: any, event: MouseEvent) => void` |
| expand-change | triggers when user expands or collapses a row (for expandable table, second param is expandedRows; for tree Table, second param is expanded) | ^[Function]`(row: any, expandedRows: any[]) => void & (row: any, expanded: boolean) => void` | | expand-change | triggers when user expands or collapses a row (for expandable table, second param is expandedRows; for tree Table, second param is expanded) | ^[Function]`(row: any, expandedRows: any[]) => void & (row: any, expanded: boolean) => void` |
| scroll ^(2.9.0) | Invoked after scrolled | ^[Function]`({ scrollLeft: number, scrollTop: number }) => void` |
### Table Slots ### Table Slots

View File

@ -65,6 +65,7 @@
:wrap-style="scrollbarStyle" :wrap-style="scrollbarStyle"
:always="scrollbarAlwaysOn" :always="scrollbarAlwaysOn"
:tabindex="scrollbarTabindex" :tabindex="scrollbarTabindex"
@scroll="$emit('scroll', $event)"
> >
<table <table
ref="tableBody" ref="tableBody"
@ -229,6 +230,7 @@ export default defineComponent({
'current-change', 'current-change',
'header-dragend', 'header-dragend',
'expand-change', 'expand-change',
'scroll',
], ],
setup(props) { setup(props) {
type Row = typeof props.data[number] type Row = typeof props.data[number]