chore: remove closeOnPopstate mixin

This commit is contained in:
chenjiahan
2020-09-14 20:43:30 +08:00
parent a4743fa648
commit d783fcf2f4
2 changed files with 9 additions and 47 deletions
-44
View File
@@ -1,44 +0,0 @@
import { on, off } from '../utils/dom/event';
import { BindEventMixin } from './bind-event';
export const CloseOnPopstateMixin = {
mixins: [
BindEventMixin(function (bind, isBind) {
this.handlePopstate(isBind && this.closeOnPopstate);
}),
],
props: {
closeOnPopstate: Boolean,
},
data() {
return {
bindStatus: false,
};
},
watch: {
closeOnPopstate(val) {
this.handlePopstate(val);
},
},
methods: {
handlePopstate(bind) {
/* istanbul ignore if */
if (this.$isServer) {
return;
}
if (this.bindStatus !== bind) {
this.bindStatus = bind;
const action = bind ? on : off;
action(window, 'popstate', () => {
this.close();
this.shouldReopen = false;
});
}
},
},
};