如何在语义ui react下拉菜单上设置默认值

时间:2019-03-29 04:55:59

标签: javascript reactjs semantic-ui

我有一个Semantic UI React Dropdown Form.Field,我正在尝试将默认值设置为English,我该怎么做?

<Form.Field
   name="languageSkills"
   label=""
   placeholder="Language"
   value={this.state.reviewerSearch.languageSkills['English']}
   onChange={this.handleSearchFilterChange}
   category={'languages'}
   control={LookupDropdown}
   fluid
   multiple
   search
   selection
/>

1 个答案:

答案 0 :(得分:1)

我认为您正在寻找defaultValue,

<Form.Field
   name="languageSkills"
   label=""
   placeholder="Language"
   defaultValue={this.state.reviewerSearch.languageSkills['English']}
   onChange={this.handleSearchFilterChange}
   category={'languages'}
   control={LookupDropdown}
   fluid
   multiple
   search
   selection
/>