我想延迟react-select的选项元素上的onClick事件。
例子:
import React from "react";
import { components } from "react-select";
const Option = props => {
const { label, data, onClick } = props;
return (
<components.Option
{...props}
onClick={() => {
setTimeout(onClick, 100);
}}>
<div>Some custom stuff here</div>
</components.Option>
);
};
export default Option;
Run Code Online (Sandbox Code Playgroud)
预期行为:
我已经在和组件上尝试过使用 props selectOption、onChange、 和,但它不起作用。onClickSelectcomponents.Options