[bugfix] Popup modal display error

This commit is contained in:
陈嘉涵
2017-10-16 16:24:10 +08:00
parent ed26ed2284
commit ade8a97d6d
7 changed files with 100 additions and 236 deletions

View File

@@ -1,35 +1,15 @@
import Vue from 'vue';
const _global = Vue.prototype.$isServer ? global : window;
const DEFAULT_CONTEXT = {
const PopupContext = {
idSeed: 1,
zIndex: 2000,
hasModal: false,
instances: {},
modalStack: []
};
if (!_global.popupContext) {
_global.popupContext = {
...DEFAULT_CONTEXT
};
}
const PopupContext = {
getContext(key) {
return _global.popupContext[key];
},
setContext(key, value) {
_global.popupContext[key] = value;
},
modalStack: [],
plusKeyByOne(key) {
const oldVal = +_global.popupContext[key];
_global.popupContext[key] = oldVal + 1;
return this[key]++;
},
return oldVal;
get topModal() {
return this.modalStack[this.modalStack.length - 1];
}
};