0

我在设置 selectedKey 时遇到问题。此下拉菜单在调用 api 后设置它的选择,this.state.typeOfRequest 最初设置为 null,然后设置为下拉键之一。看起来我在 this.state.typeOfRequest 中有正确的键值,但下拉列表不会更新其选择。有任何想法吗?

     componentDidMount() {
         const id = this.props.match.params.id;
         getRequest(id).then(res=> {
             this.setState({typeOfRequest: res.value})
  })
}

..... in render() ...
    <Dropdown 
         placeholder="Select the type of request"
         label="Type of Request"
         options={dropDownOptions.typeOfRequest}
         onChange={this.handleTypeOfRequestChange}
         selectedKey={this.state.typeOfRequest}
     />

4

0 回答 0