优化Select
parent
2bbfa0b022
commit
3246c6aae4
|
|
@ -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 (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue