fix: time-picker bug (#1176)

当使用backspace删除所有字符后,输入第一个字符控制台报错,并无字符显示
pull/1248/head
zkwolf 5 years ago committed by tangjinzhou
parent a678e3b550
commit c897d32a00

@ -28,7 +28,6 @@ const Header = {
currentSelectPanel: PropTypes.string,
focusOnOpen: PropTypes.bool,
// onKeyDown: PropTypes.func,
showStr: PropTypes.bool.def(true),
clearIcon: PropTypes.any,
},
data() {
@ -70,7 +69,6 @@ const Header = {
return;
}
this.showStr = true;
this.setState({
str,
});
@ -192,14 +190,14 @@ const Header = {
},
getInput() {
const { prefixCls, placeholder, inputReadOnly, invalid, str, showStr } = this;
const { prefixCls, placeholder, inputReadOnly, invalid, str } = this;
const invalidClass = invalid ? `${prefixCls}-input-invalid` : '';
return (
<input
class={`${prefixCls}-input ${invalidClass}`}
ref="input"
onKeydown={this.onKeyDown}
value={showStr ? str : ''}
value={str}
placeholder={placeholder}
onInput={this.onInputChange}
readOnly={!!inputReadOnly}

@ -57,7 +57,6 @@ const Panel = {
sValue: this.value,
selectionRange: [],
currentSelectPanel: '',
showStr: true,
};
},
watch: {
@ -65,11 +64,6 @@ const Panel = {
if (val) {
this.setState({
sValue: val,
showStr: true,
});
} else {
this.setState({
showStr: false,
});
}
},
@ -132,7 +126,6 @@ const Panel = {
inputReadOnly,
sValue,
currentSelectPanel,
showStr,
$listeners = {},
} = this;
const clearIcon = getComponentFromProp(this, 'clearIcon');
@ -181,7 +174,6 @@ const Panel = {
focusOnOpen={focusOnOpen}
onKeydown={keydown}
inputReadOnly={inputReadOnly}
showStr={showStr}
clearIcon={clearIcon}
/>
<Combobox

Loading…
Cancel
Save