亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Material UI - 無線電不會評估我的狀態

Material UI - 無線電不會評估我的狀態

莫回無 2023-12-14 15:51:59
我是全棧開發新手,我正在嘗試編寫一些代碼來更好地理解 React JS 和 Material UI 的前端。我編寫了一個對話框來將帖子發送到后端,并嘗試使用一些無線電來選擇每個值,但它們沒有正確評估。我是新手,所以請耐心等待,我向您展示我的代碼:class NewAdv extends Component {    state = {        open:false,        type:'Sell',        body:'',        errors:{}    };       radioChange = (event) => {        this.setState({type: event.target.value});        console.log(this.state.type)      };render() {       return (           <RadioGroup aria-label="Type" name="type" color="primary" value={this.state.type} onChange={this.radioChange}>                                    <FormControlLabel type="Sell" control={<Radio />} label="Sell" />                                    <FormControlLabel type="Trade" control={<Radio />} label="Trade" />                                    <FormControlLabel type="Other" control={<Radio />} label="Other" />                                </RadioGroup>    )}我能怎么做?
查看完整描述

1 回答

?
慕尼黑5688855

TA貢獻1848條經驗 獲得超2個贊

您正在從目標中獲取價值,但您的目標并未定義該價值。


在 FormControlLabel 上,將類型與值交換


做這個


<RadioGroup aria-label="Type" name="type" color="primary" 

  value={this.state.type} onChange={this.radioChange}>

  <FormControlLabel value="Sell" control={<Radio />} label="Sell" />

  <FormControlLabel value="Trade" control={<Radio />} label="Trade" />

  <FormControlLabel value="Other" control={<Radio />} label="Other" />

</RadioGroup>


查看完整回答
反對 回復 2023-12-14
  • 1 回答
  • 0 關注
  • 125 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號