簡體   English   中英

反應語義下拉不適用於 Enter 鍵

[英]react semantic dropdown not working on Enter key

當我輸入值並輸入時,我在輸入中獲取了值,但代碼沒有生成值。

      <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)
                  });   
              }   
      }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM