From 2b49ca60f4c2ea9251dcc64b9f479d8aec0f2728 Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 19 Oct 2020 11:06:53 +0800 Subject: [PATCH] fix(Popup): can't disable close-on-popstate (#7357) --- src/mixins/close-on-popstate.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mixins/close-on-popstate.js b/src/mixins/close-on-popstate.js index ed98c5c18..21822a3d9 100644 --- a/src/mixins/close-on-popstate.js +++ b/src/mixins/close-on-popstate.js @@ -25,6 +25,11 @@ export const CloseOnPopstateMixin = { }, methods: { + onPopstate() { + this.close(); + this.shouldReopen = false; + }, + handlePopstate(bind) { /* istanbul ignore if */ if (this.$isServer) { @@ -34,10 +39,7 @@ export const CloseOnPopstateMixin = { if (this.bindStatus !== bind) { this.bindStatus = bind; const action = bind ? on : off; - action(window, 'popstate', () => { - this.close(); - this.shouldReopen = false; - }); + action(window, 'popstate', this.onPopstate); } }, },