mirror of https://github.com/ElemeFE/element
Merge branch 'ElemeFE:dev' into dev
commit
ae71d7da1c
|
@ -116,8 +116,8 @@
|
|||
// if no callback, return promise
|
||||
if (typeof callback !== 'function' && window.Promise) {
|
||||
promise = new window.Promise((resolve, reject) => {
|
||||
callback = function(valid) {
|
||||
valid ? resolve(valid) : reject(valid);
|
||||
callback = function(valid, invalidFields) {
|
||||
valid ? resolve(valid) : reject(invalidFields);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
@ -337,15 +337,18 @@
|
|||
this.focused = true;
|
||||
this.$emit('focus', event);
|
||||
},
|
||||
handleCompositionStart() {
|
||||
handleCompositionStart(event) {
|
||||
this.$emit('compositionstart', event);
|
||||
this.isComposing = true;
|
||||
},
|
||||
handleCompositionUpdate(event) {
|
||||
this.$emit('compositionupdate', event);
|
||||
const text = event.target.value;
|
||||
const lastCharacter = text[text.length - 1] || '';
|
||||
this.isComposing = !isKorean(lastCharacter);
|
||||
},
|
||||
handleCompositionEnd(event) {
|
||||
this.$emit('compositionend', event);
|
||||
if (this.isComposing) {
|
||||
this.isComposing = false;
|
||||
this.handleInput(event);
|
||||
|
|
|
@ -52,8 +52,8 @@
|
|||
@blur="softFocus = false"
|
||||
@keyup="managePlaceholder"
|
||||
@keydown="resetInputState"
|
||||
@keydown.down.prevent="navigateOptions('next')"
|
||||
@keydown.up.prevent="navigateOptions('prev')"
|
||||
@keydown.down.prevent="handleNavigate('next')"
|
||||
@keydown.up.prevent="handleNavigate('prev')"
|
||||
@keydown.enter.prevent="selectOption"
|
||||
@keydown.esc.stop.prevent="visible = false"
|
||||
@keydown.delete="deletePrevTag"
|
||||
|
@ -84,11 +84,14 @@
|
|||
@focus="handleFocus"
|
||||
@blur="handleBlur"
|
||||
@input="debouncedOnInputChange"
|
||||
@keydown.native.down.stop.prevent="navigateOptions('next')"
|
||||
@keydown.native.up.stop.prevent="navigateOptions('prev')"
|
||||
@keydown.native.down.stop.prevent="handleNavigate('next')"
|
||||
@keydown.native.up.stop.prevent="handleNavigate('prev')"
|
||||
@keydown.native.enter.prevent="selectOption"
|
||||
@keydown.native.esc.stop.prevent="visible = false"
|
||||
@keydown.native.tab="visible = false"
|
||||
@compositionstart="handleComposition"
|
||||
@compositionupdate="handleComposition"
|
||||
@compositionend="handleComposition"
|
||||
@mouseenter.native="inputHovering = true"
|
||||
@mouseleave.native="inputHovering = false">
|
||||
<template slot="prefix" v-if="$slots.prefix">
|
||||
|
@ -440,6 +443,11 @@
|
|||
},
|
||||
|
||||
methods: {
|
||||
handleNavigate(direction) {
|
||||
if (this.isOnComposition) return;
|
||||
|
||||
this.navigateOptions(direction);
|
||||
},
|
||||
handleComposition(event) {
|
||||
const text = event.target.value;
|
||||
if (event.type === 'compositionend') {
|
||||
|
|
|
@ -921,8 +921,8 @@ describe('Form', () => {
|
|||
};
|
||||
}
|
||||
}, true);
|
||||
vm.$refs.form.validate().catch(validFailed => {
|
||||
expect(validFailed).to.false;
|
||||
vm.$refs.form.validate().catch(invalidFields => {
|
||||
expect(invalidFields.name[0].message).to.be.equal('长度至少为5');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue