Skip to content

Commit

Permalink
Merge pull request #1795 from DevCloudFE/dev
Browse files Browse the repository at this point in the history
fix(editable-select): 已有自定义于远程筛选,不进行默认label过滤 (#1794)
  • Loading branch information
GreatZPP authored Mar 18, 2024
2 parents de295d9 + a1b1141 commit 5c72c32
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { computed, ComputedRef, getCurrentInstance, nextTick, onMounted, reactive, ref, Ref, SetupContext, watch } from 'vue';
import { EditableSelectProps, Option, Options } from '../editable-select-types';
import { createI18nTranslate } from '../../../locale/create';
import { isNil } from 'lodash';
import { isFunction, isNil } from 'lodash';

export interface UseSelectStatesReturnType {
hoveringIndex: number;
Expand Down Expand Up @@ -54,9 +54,16 @@ export function useSelect(
const t = createI18nTranslate('DEditableSelect', app);
const cachedOptions = ref(props.options);

const hasCustomFilter = () => {
return (props.remote && isFunction(props.remoteMethod)) || isFunction(props.filterMethod);
};

// computed
const filteredOptions = computed(() => {
return cachedOptions.value.filter((option) => {
if (hasCustomFilter()) {
return true;
}
return option.label.toLocaleLowerCase().includes(states.query.toLocaleLowerCase().trim());
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-devui",
"version": "1.6.3-markdown.2",
"version": "1.6.3-editable-select.1",
"license": "MIT",
"description": "DevUI components based on Vite and Vue3",
"keywords": [
Expand Down

0 comments on commit 5c72c32

Please sign in to comment.