mirror of https://github.com/ElemeFE/element
MessageBox: listen for keydown instead of keyup (#9908)
parent
da2c87a03d
commit
f681b4bded
|
@ -37,10 +37,7 @@
|
||||||
<el-input
|
<el-input
|
||||||
v-model="inputValue"
|
v-model="inputValue"
|
||||||
:type="inputType"
|
:type="inputType"
|
||||||
@compositionstart.native="handleComposition"
|
@keydown.enter.native="handleAction('confirm')"
|
||||||
@compositionupdate.native="handleComposition"
|
|
||||||
@compositionend.native="handleComposition"
|
|
||||||
@keyup.enter.native="handleKeyup"
|
|
||||||
:placeholder="inputPlaceholder"
|
:placeholder="inputPlaceholder"
|
||||||
ref="input"></el-input>
|
ref="input"></el-input>
|
||||||
<div class="el-message-box__errormsg" :style="{ visibility: !!editorErrorMessage ? 'visible' : 'hidden' }">{{ editorErrorMessage }}</div>
|
<div class="el-message-box__errormsg" :style="{ visibility: !!editorErrorMessage ? 'visible' : 'hidden' }">{{ editorErrorMessage }}</div>
|
||||||
|
@ -145,18 +142,6 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
handleComposition(event) {
|
|
||||||
if (event.type === 'compositionend') {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.isOnComposition = false;
|
|
||||||
}, 100);
|
|
||||||
} else {
|
|
||||||
this.isOnComposition = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleKeyup() {
|
|
||||||
!this.isOnComposition && this.handleAction('confirm');
|
|
||||||
},
|
|
||||||
getSafeClose() {
|
getSafeClose() {
|
||||||
const currentId = this.uid;
|
const currentId = this.uid;
|
||||||
return () => {
|
return () => {
|
||||||
|
|
Loading…
Reference in New Issue