mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-25 07:49:15 +08:00
fix(Popup): can't disable close-on-popstate (#7357)
This commit is contained in:
parent
efc05af6f6
commit
2b49ca60f4
@ -25,6 +25,11 @@ export const CloseOnPopstateMixin = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
onPopstate() {
|
||||||
|
this.close();
|
||||||
|
this.shouldReopen = false;
|
||||||
|
},
|
||||||
|
|
||||||
handlePopstate(bind) {
|
handlePopstate(bind) {
|
||||||
/* istanbul ignore if */
|
/* istanbul ignore if */
|
||||||
if (this.$isServer) {
|
if (this.$isServer) {
|
||||||
@ -34,10 +39,7 @@ export const CloseOnPopstateMixin = {
|
|||||||
if (this.bindStatus !== bind) {
|
if (this.bindStatus !== bind) {
|
||||||
this.bindStatus = bind;
|
this.bindStatus = bind;
|
||||||
const action = bind ? on : off;
|
const action = bind ? on : off;
|
||||||
action(window, 'popstate', () => {
|
action(window, 'popstate', this.onPopstate);
|
||||||
this.close();
|
|
||||||
this.shouldReopen = false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user