fix(Popup): can't disable close-on-popstate (#7357)

This commit is contained in:
neverland 2020-10-19 11:06:53 +08:00 committed by GitHub
parent efc05af6f6
commit 2b49ca60f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}
},
},