From cc445dfc00b241b3ff3b7eda6baa8a6a90d5a922 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 16 Jul 2019 20:48:32 +0800 Subject: [PATCH] [bugfix] Dialog: closeOnPopstate can't be disabled (#3868) --- src/mixins/close-on-popstate.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mixins/close-on-popstate.ts b/src/mixins/close-on-popstate.ts index 2ede0f115..0a63d6246 100644 --- a/src/mixins/close-on-popstate.ts +++ b/src/mixins/close-on-popstate.ts @@ -3,9 +3,11 @@ import { on, off } from '../utils/dom/event'; import { BindEventMixin } from './bind-event'; export const CloseOnPopstateMixin = Vue.extend({ - mixins: [BindEventMixin(function (this: any, bind, isBind) { - this.onPopstate(isBind); - })], + mixins: [ + BindEventMixin(function (this: any, bind, isBind) { + this.handlePopstate(isBind && this.closeOnPopstate); + }) + ], props: { closeOnPopstate: Boolean @@ -19,12 +21,12 @@ export const CloseOnPopstateMixin = Vue.extend({ watch: { closeOnPopstate(val: boolean) { - this.onPopstate(val); + this.handlePopstate(val); } }, methods: { - onPopstate(bind: boolean) { + handlePopstate(bind: boolean) { /* istanbul ignore if */ if (this.$isServer) { return;