fix(组件): ms-select过滤不存在选项时已选选项仍显示正常

This commit is contained in:
baiqi 2024-11-19 15:01:26 +08:00 committed by Craftsman
parent b7befa6a6a
commit e95b31da74
1 changed files with 3 additions and 3 deletions

View File

@ -446,12 +446,12 @@ export default defineComponent(
return props.allowClear;
});
function checkOptionExit(label?: string) {
function checkOptionExit(value?: string) {
if (typeof props.optionLabelRender === 'function') {
return label;
return value;
}
const option = remoteOriginOptions.value.find(
(e) => e[props.labelKey || 'label'].toLowerCase() === label?.toLowerCase()
(e) => e[props.valueKey || 'value'].toLowerCase() === value?.toLowerCase()
);
return option ? option[props.labelKey || 'label'] : props.optionNotExitsText || t('ms.select.optionsNotExits');
}