mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 18:54:24 +00:00
[bugfix] Popup modal display error
This commit is contained in:
@@ -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];
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user