fix popup

This commit is contained in:
cookfront 2017-03-10 17:16:22 +08:00
parent ba53bc4c56
commit b2cf1d1eb2
2 changed files with 26 additions and 10 deletions

View File

@ -1,7 +1,19 @@
import Vue from 'vue';
import merge from 'src/utils/merge';
import PopupManager from './popup-manager';
let idSeed = 1;
let popupContext;
if (Vue.prototype.$isServer) {
popupContext = global.popupContext || {};
global.popupContext = popupContext;
} else {
popupContext = window.popupContext || {};
window.popupContext = popupContext;
}
popupContext = merge(popupContext, {
idSeed: 1
});
const getDOM = function(dom) {
if (dom.nodeType === 3) {
@ -58,7 +70,7 @@ export default {
},
beforeMount() {
this._popupId = 'popup-' + idSeed++;
this._popupId = 'popup-' + popupContext.idSeed++;
PopupManager.register(this._popupId, this);
},

View File

@ -1,17 +1,21 @@
import Vue from 'vue';
import merge from 'src/utils/merge';
import { addClass } from 'src/utils/dom';
let popupContext = {
let popupContext;
if (Vue.prototype.$isServer) {
popupContext = global.popupContext || {};
global.popupContext = popupContext;
} else {
popupContext = window.popupContext || {};
window.popupContext = popupContext;
}
popupContext = merge(popupContext, {
hasModal: false,
instances: {},
modalStack: []
};
if (Vue.prototype.$isServer) {
global.popupContext = popupContext;
} else {
window.popupContext = popupContext;
}
});
const getModal = function() {
let modalDom = PopupManager.modalDom;