react antd Radio單選框選中提交后刷新頁面回顯


Radio渲染數據

<Radio.Group className={styles.content} value={vote.msg}> {data.judgeVoteList && data.judgeVoteList.map((item) => { return ( <Col span={5} offset={3} style={{ paddingTop: '28px' }}> <Radio.Button // disabled={vote.code === 2} value={item.de768} className={styles.btnInfo} onClick={() => handleClick(item)} > <div className={styles.btnInfoDiv}> <img src={man} /> <p className={styles.infoName}>{item.de281}</p> </div>
// 返回人員加上提示標簽 {vote.msg === item.de281 && ( <NewEnergyIcon style={{ position: 'absolute', top: -10, left: 140, }} /> )} </Radio.Button>

 Radio.Group value 參數與 Radio.Button value 參數一致 可以回顯選中的的數據

 Radio.Button 點擊事件Click

  function handleClick(data) {
    setDataName(data);
    setVote({
      ...(vote ? vote : {}),
      msg: data.de768,
    });
  }

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM