Skip to content

Commit

Permalink
fix(auto-complete): option-list value escapeRegExp (#3668)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZWkang authored Dec 1, 2023
1 parent 240f1bd commit 3f11bbd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/auto-complete/option-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import log from '../_common/js/log';
import { usePrefixClass } from '../hooks/useConfig';
import { on, off } from '../utils/dom';
import isString from 'lodash/isString';
import escapeRegExp from 'lodash/escapeRegExp';

export default defineComponent({
name: 'AutoCompleteOptionList',
Expand Down Expand Up @@ -63,7 +64,7 @@ export default defineComponent({
options = options.filter((option) => props.filter(props.value, option));
} else if (props.filterable) {
// 默认过滤规则
const regExp = new RegExp(props.value, 'i');
const regExp = new RegExp(escapeRegExp(props.value), 'i');
options = options.filter((item) => regExp.test(item.text));
}
return options;
Expand Down

0 comments on commit 3f11bbd

Please sign in to comment.