mirror of https://github.com/ElemeFE/element
Tabs: Fixed issue where Promise rejection was hitting application (#14816)
parent
9ac51576e6
commit
d1e0f9812c
|
@ -92,11 +92,14 @@
|
|||
if (this.currentName !== value && this.beforeLeave) {
|
||||
const before = this.beforeLeave(value, this.currentName);
|
||||
if (before && before.then) {
|
||||
before.then(() => {
|
||||
changeCurrentName();
|
||||
|
||||
this.$refs.nav && this.$refs.nav.removeFocus();
|
||||
});
|
||||
before
|
||||
.then(() => {
|
||||
changeCurrentName();
|
||||
this.$refs.nav && this.$refs.nav.removeFocus();
|
||||
}, () => {
|
||||
// https://github.com/ElemeFE/element/pull/14816
|
||||
// ignore promise rejection in `before-leave` hook
|
||||
});
|
||||
} else if (before !== false) {
|
||||
changeCurrentName();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue