Skip to content

Commit 6c05e25

Browse files
committed
feat: input not trigger input event when chinese not complete #1281
1 parent bad8cc0 commit 6c05e25

File tree

9 files changed

+15
-14
lines changed

9 files changed

+15
-14
lines changed

components/input/Input.jsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export default {
124124
},
125125

126126
handleChange(e) {
127+
if (e.target.composing) return;
127128
this.setValue(e.target.value, e);
128129
},
129130

@@ -237,6 +238,7 @@ export default {
237238
]);
238239
const { stateValue, getInputClassName, handleKeyDown, handleChange, $listeners } = this;
239240
const inputProps = {
241+
directives: [{ name: 'ant-input' }],
240242
domProps: {
241243
value: fixControlledValue(stateValue),
242244
},
@@ -251,7 +253,6 @@ export default {
251253
ref: 'input',
252254
key: 'ant-input',
253255
};
254-
inputProps.directives = [{ name: 'ant-input' }];
255256
return this.renderLabeledIcon(prefixCls, <input {...inputProps} />);
256257
},
257258
},
@@ -263,8 +264,9 @@ export default {
263264
attrs: this.$attrs,
264265
on: {
265266
...$listeners,
266-
change: this.handleChange,
267+
input: this.handleChange,
267268
keydown: this.handleKeyDown,
269+
change: noop,
268270
},
269271
directives: [
270272
{

components/input/TextArea.jsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ export default {
116116
},
117117

118118
handleTextareaChange(e) {
119+
if (e.target.composing) return;
119120
if (!hasProp(this, 'value')) {
120121
this.stateValue = e.target.value;
121122
this.resizeTextarea();
@@ -163,6 +164,7 @@ export default {
163164
});
164165

165166
const textareaProps = {
167+
directives: [{ name: 'ant-input' }],
166168
attrs: { ...otherProps, ...$attrs },
167169
on: {
168170
...$listeners,
@@ -171,9 +173,6 @@ export default {
171173
change: noop,
172174
},
173175
};
174-
if ($listeners['change.value']) {
175-
textareaProps.directives = [{ name: 'ant-input' }];
176-
}
177176
return (
178177
<textarea
179178
{...textareaProps}

components/vc-calendar/src/date/DateInput.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ const DateInput = {
8282
this.__emit('clear', null);
8383
},
8484
onInputChange(event) {
85+
if (event.target.composing) return;
8586
const str = event.target.value;
8687
// https://github.com/vueComponent/ant-design-vue/issues/92
8788
if (isIE && !isIE9 && this.str === str) {

components/vc-pagination/Options.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export default {
3232
return `${opt.value} ${this.locale.items_per_page}`;
3333
},
3434
handleChange(e) {
35+
if (e.target.composing) return;
3536
this.setState({
3637
goInputText: e.target.value,
3738
});
@@ -126,7 +127,7 @@ export default {
126127
disabled={disabled}
127128
type="text"
128129
value={goInputText}
129-
onChange={this.handleChange}
130+
onInput={this.handleChange}
130131
onKeyup={this.go}
131132
onBlur={this.handleBlur}
132133
{...{

components/vc-pagination/Pagination.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ export default {
171171
}
172172
},
173173
handleKeyUp(e) {
174+
if (e.target.composing) return;
174175
const value = this.getValidValue(e);
175176
const stateCurrentInputValue = this.stateCurrentInputValue;
176177

components/vc-select/Select.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ const Select = {
303303
},
304304

305305
onInputChange(event) {
306+
if (event.target.composing) return;
306307
const { tokenSeparators } = this.$props;
307308
const val = event.target.value;
308309
if (

components/vc-time-picker/Header.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const Header = {
6363

6464
methods: {
6565
onInputChange(event) {
66+
if (event.target.composing) return;
6667
const str = event.target.value;
6768
// https://github.com/vueComponent/ant-design-vue/issues/92
6869
if (isIE && !isIE9 && this.str === str) {

components/vc-time-picker/TimePicker.jsx

-7
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,6 @@ export default {
377377
autoFocus={autoFocus}
378378
readOnly={!!inputReadOnly}
379379
id={id}
380-
{...{
381-
directives: [
382-
{
383-
name: 'ant-input',
384-
},
385-
],
386-
}}
387380
/>
388381
{inputIcon || <span class={`${prefixCls}-icon`} />}
389382
{this.renderClearButton()}

components/vc-tree-select/src/Select.jsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,9 @@ const Select = {
789789
this.setOpenState(open, true);
790790
},
791791

792-
onSearchInputChange({ target: { value } }) {
792+
onSearchInputChange(event) {
793+
if (event.target.composing) return;
794+
const value = event.target.value;
793795
const { _treeNodes: treeNodes, _valueEntities: valueEntities } = this.$data;
794796
const { filterTreeNode, treeNodeFilterProp } = this.$props;
795797
this.__emit('update:searchValue', value);

0 commit comments

Comments
 (0)