🌐 AI搜索 & 代理 主页
Skip to content

Commit 57dc410

Browse files
authored
Update mixin-filtering.js
1 parent 7defeb4 commit 57dc410

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

src/components/table/helpers/mixin-filtering.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,26 @@ export default {
9898
}
9999
},
100100
// Watch for changes to the filter criteria, and debounce if necessary
101-
filter(newFilter, oldFilter) {
102-
// DEBUG
103-
console.log('Filter Changed Detected:', newFilter)
104-
const timeout = this.computedFilterDebounce
105-
if (this.$_filterTimer) {
106-
clearTimeout(this.$_filterTimer)
107-
this.$_filterTimer = null
108-
}
109-
if (timeout) {
110-
// If we have a debounce time, delay the update of this.localFilter
111-
this.$_filterTimer = setTimeout(() => {
101+
filter: {
102+
// We need a deep watcher incase the user passes
103+
// an object when using `filter-function`
104+
deep: true,
105+
handler(newFilter, oldFilter) {
106+
const timeout = this.computedFilterDebounce
107+
if (this.$_filterTimer) {
108+
clearTimeout(this.$_filterTimer)
112109
this.$_filterTimer = null
110+
}
111+
if (timeout) {
112+
// If we have a debounce time, delay the update of this.localFilter
113+
this.$_filterTimer = setTimeout(() => {
114+
this.$_filterTimer = null
115+
this.localFilter = this.filterSanitize(this.filter)
116+
}, timeout)
117+
} else {
118+
// Otherwise, immediately update this.localFilter
113119
this.localFilter = this.filterSanitize(this.filter)
114-
}, timeout)
115-
} else {
116-
// Otherwise, immediately update this.localFilter
117-
this.localFilter = this.filterSanitize(this.filter)
120+
}
118121
}
119122
},
120123
// Watch for changes to the filter criteria and filtered items vs localItems).

0 commit comments

Comments
 (0)