fix #5060
This commit is contained in:
parent
57bd5393c5
commit
f43bc792be
1 changed files with 19 additions and 1 deletions
|
@ -30,6 +30,9 @@
|
||||||
@keydown="handleKeydown"
|
@keydown="handleKeydown"
|
||||||
@focus="handleFocus"
|
@focus="handleFocus"
|
||||||
@blur="handleBlur"
|
@blur="handleBlur"
|
||||||
|
@compositionstart="handleComposition"
|
||||||
|
@compositionupdate="handleComposition"
|
||||||
|
@compositionend="handleComposition"
|
||||||
@input="handleInput"
|
@input="handleInput"
|
||||||
@change="handleChange">
|
@change="handleChange">
|
||||||
<div :class="[prefixCls + '-group-append']" v-if="append" v-show="slotReady"><slot name="append"></slot></div>
|
<div :class="[prefixCls + '-group-append']" v-if="append" v-show="slotReady"><slot name="append"></slot></div>
|
||||||
|
@ -62,6 +65,9 @@
|
||||||
@keydown="handleKeydown"
|
@keydown="handleKeydown"
|
||||||
@focus="handleFocus"
|
@focus="handleFocus"
|
||||||
@blur="handleBlur"
|
@blur="handleBlur"
|
||||||
|
@compositionstart="handleComposition"
|
||||||
|
@compositionupdate="handleComposition"
|
||||||
|
@compositionend="handleComposition"
|
||||||
@input="handleInput">
|
@input="handleInput">
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
@ -179,7 +185,8 @@
|
||||||
slotReady: false,
|
slotReady: false,
|
||||||
textareaStyles: {},
|
textareaStyles: {},
|
||||||
showPrefix: false,
|
showPrefix: false,
|
||||||
showSuffix: false
|
showSuffix: false,
|
||||||
|
isOnComposition: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -244,7 +251,18 @@
|
||||||
this.dispatch('FormItem', 'on-form-blur', this.currentValue);
|
this.dispatch('FormItem', 'on-form-blur', this.currentValue);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handleComposition(event) {
|
||||||
|
if (event.type === 'compositionstart') {
|
||||||
|
this.isOnComposition = true;
|
||||||
|
}
|
||||||
|
if (event.type === 'compositionend') {
|
||||||
|
this.isOnComposition = false;
|
||||||
|
this.handleInput(event);
|
||||||
|
}
|
||||||
|
},
|
||||||
handleInput (event) {
|
handleInput (event) {
|
||||||
|
if (this.isOnComposition) return;
|
||||||
|
|
||||||
let value = event.target.value;
|
let value = event.target.value;
|
||||||
if (this.number && value !== '') value = Number.isNaN(Number(value)) ? value : Number(value);
|
if (this.number && value !== '') value = Number.isNaN(Number(value)) ? value : Number(value);
|
||||||
this.$emit('input', value);
|
this.$emit('input', value);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue