feat: input not trigger input event when chinese not complete #1281

pull/1431/head
tanjinzhou 2019-11-15 16:56:28 +08:00
parent bad8cc0626
commit 6c05e25f23
9 changed files with 15 additions and 14 deletions

View File

@ -124,6 +124,7 @@ export default {
}, },
handleChange(e) { handleChange(e) {
if (e.target.composing) return;
this.setValue(e.target.value, e); this.setValue(e.target.value, e);
}, },
@ -237,6 +238,7 @@ export default {
]); ]);
const { stateValue, getInputClassName, handleKeyDown, handleChange, $listeners } = this; const { stateValue, getInputClassName, handleKeyDown, handleChange, $listeners } = this;
const inputProps = { const inputProps = {
directives: [{ name: 'ant-input' }],
domProps: { domProps: {
value: fixControlledValue(stateValue), value: fixControlledValue(stateValue),
}, },
@ -251,7 +253,6 @@ export default {
ref: 'input', ref: 'input',
key: 'ant-input', key: 'ant-input',
}; };
inputProps.directives = [{ name: 'ant-input' }];
return this.renderLabeledIcon(prefixCls, <input {...inputProps} />); return this.renderLabeledIcon(prefixCls, <input {...inputProps} />);
}, },
}, },
@ -263,8 +264,9 @@ export default {
attrs: this.$attrs, attrs: this.$attrs,
on: { on: {
...$listeners, ...$listeners,
change: this.handleChange, input: this.handleChange,
keydown: this.handleKeyDown, keydown: this.handleKeyDown,
change: noop,
}, },
directives: [ directives: [
{ {

View File

@ -116,6 +116,7 @@ export default {
}, },
handleTextareaChange(e) { handleTextareaChange(e) {
if (e.target.composing) return;
if (!hasProp(this, 'value')) { if (!hasProp(this, 'value')) {
this.stateValue = e.target.value; this.stateValue = e.target.value;
this.resizeTextarea(); this.resizeTextarea();
@ -163,6 +164,7 @@ export default {
}); });
const textareaProps = { const textareaProps = {
directives: [{ name: 'ant-input' }],
attrs: { ...otherProps, ...$attrs }, attrs: { ...otherProps, ...$attrs },
on: { on: {
...$listeners, ...$listeners,
@ -171,9 +173,6 @@ export default {
change: noop, change: noop,
}, },
}; };
if ($listeners['change.value']) {
textareaProps.directives = [{ name: 'ant-input' }];
}
return ( return (
<textarea <textarea
{...textareaProps} {...textareaProps}

View File

@ -82,6 +82,7 @@ const DateInput = {
this.__emit('clear', null); this.__emit('clear', null);
}, },
onInputChange(event) { onInputChange(event) {
if (event.target.composing) return;
const str = event.target.value; const str = event.target.value;
// https://github.com/vueComponent/ant-design-vue/issues/92 // https://github.com/vueComponent/ant-design-vue/issues/92
if (isIE && !isIE9 && this.str === str) { if (isIE && !isIE9 && this.str === str) {

View File

@ -32,6 +32,7 @@ export default {
return `${opt.value} ${this.locale.items_per_page}`; return `${opt.value} ${this.locale.items_per_page}`;
}, },
handleChange(e) { handleChange(e) {
if (e.target.composing) return;
this.setState({ this.setState({
goInputText: e.target.value, goInputText: e.target.value,
}); });
@ -126,7 +127,7 @@ export default {
disabled={disabled} disabled={disabled}
type="text" type="text"
value={goInputText} value={goInputText}
onChange={this.handleChange} onInput={this.handleChange}
onKeyup={this.go} onKeyup={this.go}
onBlur={this.handleBlur} onBlur={this.handleBlur}
{...{ {...{

View File

@ -171,6 +171,7 @@ export default {
} }
}, },
handleKeyUp(e) { handleKeyUp(e) {
if (e.target.composing) return;
const value = this.getValidValue(e); const value = this.getValidValue(e);
const stateCurrentInputValue = this.stateCurrentInputValue; const stateCurrentInputValue = this.stateCurrentInputValue;

View File

@ -303,6 +303,7 @@ const Select = {
}, },
onInputChange(event) { onInputChange(event) {
if (event.target.composing) return;
const { tokenSeparators } = this.$props; const { tokenSeparators } = this.$props;
const val = event.target.value; const val = event.target.value;
if ( if (

View File

@ -63,6 +63,7 @@ const Header = {
methods: { methods: {
onInputChange(event) { onInputChange(event) {
if (event.target.composing) return;
const str = event.target.value; const str = event.target.value;
// https://github.com/vueComponent/ant-design-vue/issues/92 // https://github.com/vueComponent/ant-design-vue/issues/92
if (isIE && !isIE9 && this.str === str) { if (isIE && !isIE9 && this.str === str) {

View File

@ -377,13 +377,6 @@ export default {
autoFocus={autoFocus} autoFocus={autoFocus}
readOnly={!!inputReadOnly} readOnly={!!inputReadOnly}
id={id} id={id}
{...{
directives: [
{
name: 'ant-input',
},
],
}}
/> />
{inputIcon || <span class={`${prefixCls}-icon`} />} {inputIcon || <span class={`${prefixCls}-icon`} />}
{this.renderClearButton()} {this.renderClearButton()}

View File

@ -789,7 +789,9 @@ const Select = {
this.setOpenState(open, true); this.setOpenState(open, true);
}, },
onSearchInputChange({ target: { value } }) { onSearchInputChange(event) {
if (event.target.composing) return;
const value = event.target.value;
const { _treeNodes: treeNodes, _valueEntities: valueEntities } = this.$data; const { _treeNodes: treeNodes, _valueEntities: valueEntities } = this.$data;
const { filterTreeNode, treeNodeFilterProp } = this.$props; const { filterTreeNode, treeNodeFilterProp } = this.$props;
this.__emit('update:searchValue', value); this.__emit('update:searchValue', value);