mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-12 23:24:35 +01:00
fix value clear
This commit is contained in:
@@ -62,7 +62,11 @@ export default class DirInput extends React.Component<IProps, IState> {
|
||||
render() {
|
||||
return (
|
||||
<div className='DirInput'>
|
||||
<TextInput value={this.state.value} placeholder={this.state.placeholder} readOnly={true} />
|
||||
<TextInput value={this.state.value} placeholder={this.state.placeholder} readOnly={true} onChange={(text: string) => {
|
||||
this.setState({ value: text })
|
||||
|
||||
if (this.props.onChange) this.props.onChange(text)
|
||||
}}/>
|
||||
<div className="FileSelectIcon" onClick={this.handleIconClick}>
|
||||
<img src={File} />
|
||||
</div>
|
||||
|
||||
@@ -44,6 +44,8 @@ export default class TextInput extends React.Component<IProps, IState> {
|
||||
}} />
|
||||
<div className="TextClear" onClick={() => {
|
||||
this.setState({ value: '' })
|
||||
|
||||
if (this.props.onChange) this.props.onChange('')
|
||||
}}>
|
||||
<img src={Close} className="TextInputClear" />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user