vant/packages/mixins/popup/popup-context.js
WyTiny 1418117681 Add deep-select component and fix a popup bug. (#103)
* feat: new deep select

* fix: add deep-select test

* fix: import

* fix: icon import
2017-09-01 10:15:53 +08:00

37 lines
612 B
JavaScript

import Vue from 'vue';
const _global = Vue.prototype.$isServer ? global : window;
const DEFAULT_CONTEXT = {
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;
},
plusKeyByOne(key) {
const oldVal = +_global.popupContext[key];
_global.popupContext[key] = oldVal + 1;
return oldVal;
}
};
export default PopupContext;