Tabs: Fixed issue where Promise rejection was hitting application (#14816)

pull/15207/head
Sam Hulick 2019-04-22 01:38:36 -05:00 committed by hetech
parent 9ac51576e6
commit d1e0f9812c
1 changed files with 8 additions and 5 deletions

View File

@ -92,11 +92,14 @@
if (this.currentName !== value && this.beforeLeave) { if (this.currentName !== value && this.beforeLeave) {
const before = this.beforeLeave(value, this.currentName); const before = this.beforeLeave(value, this.currentName);
if (before && before.then) { if (before && before.then) {
before.then(() => { before
changeCurrentName(); .then(() => {
changeCurrentName();
this.$refs.nav && this.$refs.nav.removeFocus(); 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) { } else if (before !== false) {
changeCurrentName(); changeCurrentName();
} }