你能告诉我如何在 react js 的下拉列表中设置值吗?几秒钟后我得到下拉数据 3000 然后我需要设置下拉值
const App = ({ children }) => {
const val = "ax";
const [state, setState] = useState([]);
setTimeout(() => {
setState(countryOptions);
}, 2000);
return (
<Container style={{ margin: 20 }}>
<Example countryOptions={state} />
</Container>
);
};
https://codesandbox.io/s/semantic-ui-example-utev4 应选择预期输出 奥兰群岛。{ key: "ax", value: "ax", text: "Aland Islands" },
三秒后我想选择这个元素
const val = "ax";