feat(InputMenu/SelectMenu): allow lazy search (#1705)

Co-authored-by: chenying <chenying@addcn.com>
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
chenying
2024-04-26 21:43:29 +08:00
committed by GitHub
parent ed5c74dc17
commit 7e6ba78681
4 changed files with 16 additions and 0 deletions

View File

@@ -249,6 +249,10 @@ export default defineComponent({
type: Array,
default: null
},
searchLazy: {
type: Boolean,
default: false
},
debounce: {
type: Number,
default: 200
@@ -407,6 +411,8 @@ export default defineComponent({
return child !== null && child !== undefined && String(child).search(new RegExp(query.value, 'i')) !== -1
})
})
}, [], {
lazy: props.searchLazy
})
watch(container, (value) => {

View File

@@ -249,6 +249,10 @@ export default defineComponent({
type: String,
default: 'Search...'
},
searchableLazy: {
type: Boolean,
default: false
},
clearSearchOnClose: {
type: Boolean,
default: () => configMenu.default.clearSearchOnClose
@@ -470,6 +474,8 @@ export default defineComponent({
return child !== null && child !== undefined && String(child).search(new RegExp(query.value, 'i')) !== -1
})
})
}, [], {
lazy: props.searchableLazy
})
const createOption = computed(() => {