import React, { Component, Fragment } from 'react'
import { Select, Button } from 'antd'
const Option = Select.Option
export default class SelBtn extends Component {
constructor (props) {
super(props)
this.myRef = React.createRef()
}
selBlur = () => {
this.myRef.current.blur()
}
render () {
return <Fragment>
<Select ref={this.myRef} style={{width: 300}}>
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
</Select>
<Button onClick={this.selBlur}>blur</Button>
</Fragment>
}
}
Note:
createRef ()
method requires React v16.3 or above
if the react version is lower than 16.3, use ref callback
to get ref.
Previous: The select drop-down option in vue can filter values
Next: Wechat web page is authorized to log in. Click to confirm that there is no response.
setting in state: this.state = {checkList: []}; checkList initializes it with an array of the same length as JsonPage: this.setState ({checkList:checkSaveCount}); checkSavaCount is the same length as the following JsonPage. the following creates...
use the Table component of Antd Design, first check out the data, and then select a CheckBox, but when you change pages, that CheckBox will not disappear. For example, when I select the first line on the first page, and then skip to the second page, the ...
official example of full copy: this is the official sample code: import { Select } from antd ; const Option = Select.Option; function handleChange(value) { console.log(`selected ${value}`); } ReactDOM.render( <div> <Select defaul...
Test antd document Form in the demo code const {getFieldDecorator} = this.props.form; reported an error, found that their antd version is too low, so npm install antd@beta-save installed the latest version of antd, but my project Divider reported that th...
:this.state={key1:value1,key2:value2}, :this.state={key1:value1,key2:value2,key3:value3} statekey3:value3, this.statepush(),this.state.push(key3,value3) this.state={key1:value1,key2:value2,key3:value3} this.statepush() this.state ...
use the drop-down box of React s ant design, and ask for help on how to solve the problem according to the fact that there is no multiple selection in the doc, on the official website. <Select multiple showSearch onSelect={(val,e) =&g...
data problems occur when multiple forms are submitted on a single page. For example, when I submit the second form, the console prints the contents of the first form. Is there any way to modify this? ...
use the original table component to encapsulate an extra layer of TableC, in the render method of the columns property to render switch, circularly. No matter how you modify the data view, it will not be updated, including using mobx, to ask how to solv...
how to modify the top of the Antd Transfer shuttle box like this ...
if you want to use Tooltip in antd on the same page, you also need to use Tooltip to make a chart. There is a conflict between Tooltip. I want to change the name of one of the Tooltip. Ladies and Gods, what should I do with this ? ...
<Select labelInValue value={{key:this.state.boxTypeId,label:this.state.boxType}} getPopupContainer={() => document.getElementById( boxType )} placeholder="" style={{width: 100% }} onChange={e=>this.handleSelectChange( boxType ...
Development environment: react antd I wrote a new component myself < ModelItem > put it in modelSetting and then I wrote it like this keygetModelDataAgain keykey22key22 Why, even if key is the default field, can t I overwrite it? Obviously p...
the above is the problem, and the bottom is written by yourself, but the prompt error will operate frequently ...
first is a parent component that contains a modal import React from react ; import { Button, Input, Table, Modal } from antd ; import ApplyCertificateForm from . components apply-certificate-form ; import UploadCertificateFrom from . compon...
the following is the interface simulation data. I need to perform different logic when the user clicks according to different parent nodes, that is, through recursion, the user clicks on any tree node, how to know the current layer node for example, i...
the directory I created with create-react-app, and then follow the steps of the official website to modify the color lessstyle,true ...
as I described above, for the first time, my creat-react-app project has no problem after it has been deployed with serve-s. the files under the build generated by the second, npm run build, I re-enter and deploy with the serve-s command, but when I op...
the current project needs to add buried point statistics system to the official account project, but after query, it is found that there is no mature solution for React. an unelegant react burying system ...
select how to match the background fields with the selected state of select. my operation is to splice the value. Is there a simple way < Select style= {{width: 120}} onChange= {this.handleselect.bind (this)} > { ...
as shown in the figure below, my project is the scaffolding of create-react-app. There is no problem running under ie 9. Running under ie 11 reported the following error. I went to Baidu, and some people said that I did not quote babel-polyfill, so npm...