优化Select

master
LiuJiaNan 2025-11-06 16:31:49 +08:00
parent 2bbfa0b022
commit 3246c6aae4
1 changed files with 3 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import { getLabelName } from "../../../utils";
*/ */
function BasicSelect(props) { function BasicSelect(props) {
const { const {
onChange,
onGetLabel, onGetLabel,
placeholder = "", placeholder = "",
data = [], data = [],
@ -14,11 +15,12 @@ function BasicSelect(props) {
...restProps ...restProps
} = props; } = props;
const handleChange = (event) => { const handleChange = (event, option) => {
if (event) if (event)
onGetLabel?.(getLabelName({ list: data, status: event, idKey, nameKey })); onGetLabel?.(getLabelName({ list: data, status: event, idKey, nameKey }));
else else
onGetLabel?.(""); onGetLabel?.("");
onChange?.(event, option);
}; };
return ( return (