fix(组件): ms-select过滤不存在选项时已选选项仍显示正常
This commit is contained in:
parent
b7befa6a6a
commit
e95b31da74
|
@ -446,12 +446,12 @@ export default defineComponent(
|
||||||
return props.allowClear;
|
return props.allowClear;
|
||||||
});
|
});
|
||||||
|
|
||||||
function checkOptionExit(label?: string) {
|
function checkOptionExit(value?: string) {
|
||||||
if (typeof props.optionLabelRender === 'function') {
|
if (typeof props.optionLabelRender === 'function') {
|
||||||
return label;
|
return value;
|
||||||
}
|
}
|
||||||
const option = remoteOriginOptions.value.find(
|
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');
|
return option ? option[props.labelKey || 'label'] : props.optionNotExitsText || t('ms.select.optionsNotExits');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue