当我输入值并输入时,我会在输入中获得值,但代码不会生成值。
<label>Country</label>
<Dropdown
placeholder={`${enteredCountry}`}
search selection
options={countryOptions}
defaultValue={enteredCountry}
onChange =
{searchHandler
}
/>
我得到了这样的修复。。。
const searchHandler = (e,data) =>{
setEnteredCountry(e.target.textContent);
console.log('text value ',e.target.textContent)
if(e.code === 'Enter'){
console.log('data.....',data);
data.options.forEach(element => {
element.value === data.value && setEnteredCountry(element.text)
});
}
}