修复 search-method 自定义搜索逻辑不生效

This commit is contained in:
就眠儀式
2022-11-29 21:48:34 +08:00
parent 0c0d4d19f3
commit ad047574b4
2 changed files with 12 additions and 7 deletions

View File

@@ -60,14 +60,13 @@ const selected = computed(() => {
}
});
// 首次加载, 不启用 search-method 方法。
const isFirst = ref(true);
const first = ref(true);
const display = computed(() => {
if (searchMethod && !isFirst.value) {
isFirst.value = false;
if (searchMethod && !first.value) {
return searchMethod(searchValue.value, props);
}
first.value = false;
return (
props.keyword?.toString().indexOf(searchValue.value) > -1 ||
props.label?.toString().indexOf(searchValue.value) > -1