Skip to content

Commit bd594a7

Browse files
author
xuqingkai
committed
fix: 🐛 修复debounce调整后导致tabs无法切换的问题
1 parent 997a219 commit bd594a7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/uni_modules/wot-design-uni/components/common/util.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,12 +542,13 @@ type DebounceOptions = {
542542
trailing?: boolean // 是否在延迟时间结束时调用函数
543543
}
544544

545-
export function debounce<T extends (...args: any[]) => any>(func: T, wait: number, options: DebounceOptions = { leading: false, trailing: true }): T {
545+
export function debounce<T extends (...args: any[]) => any>(func: T, wait: number, options: DebounceOptions = {}): T {
546546
let timeoutId: ReturnType<typeof setTimeout> | null = null
547547
let lastArgs: any[] | undefined
548548
let lastThis: any
549549
let result: ReturnType<T> | undefined
550-
const { leading, trailing } = options
550+
const leading = isDef(options.leading) ? options.leading : false
551+
const trailing = isDef(options.trailing) ? options.trailing : true
551552

552553
function invokeFunc() {
553554
if (lastArgs !== undefined) {

src/uni_modules/wot-design-uni/components/wd-table/wd-table.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const reactiveState = reactive({
7979
setColumns
8080
})
8181
82-
const scroll = debounce(handleScroll, 100) // 滚动事件
82+
const scroll = debounce(handleScroll, 100, { leading: false }) // 滚动事件
8383
8484
provide('wdTable', reactiveState)
8585

0 commit comments

Comments
 (0)