ant design Select下拉选中后,选中内容可编辑

ant design 下拉选中选项后输入框可编辑

问题 : 当选择option后,无法编辑选择项

	import React,{Component} from "react"
	import { Select } from 'antd';
	const { Option } = Select;
	
	class Select extends Component {
		state = {value:""}
		handleSelect=(value)=>{
			this.setState({value})
		}	
		onDropdownVisibleChange =(status)=>{
			const {value} = this.state;
			// 展开option时触发
			if(status === true){  
				setTimeout(()=>{
					document.getElementsByClassName('ant-select-search__field)[0].value=value
					//当点击下拉组件,找到组件对应的Input,设置上次选择的值.
				})
			}
	}
		render(){
			return (<Select
		    showSearch
		    optionFilterProp="children"
		   	onSelect = {(val)=>{this.handleSelect(val)}
		   	onDropdownVisibleChange = {this.onDropdownVisibleChange}
		  >
		    <Option value="jack">Jack</Option>
		    <Option value="lucy">Lucy</Option>
		    <Option value="tom">Tom</Option>
		  </Select>)
		}
		

你可能感兴趣的:(reactjs)