[bugfix] Dialog: closeOnPopstate can't be disabled (#3868)

This commit is contained in:
neverland 2019-07-16 20:48:32 +08:00 committed by GitHub
parent 2a2e43ef90
commit cc445dfc00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;