Commit 840c4b57 authored by Leopoldthecoder's avatar Leopoldthecoder Committed by 杨奕

Loading: use popup-manager to handle fullscreen z-index

parent cdc14756
import Vue from 'vue'; import Vue from 'vue';
import Loading from './loading.vue'; import Loading from './loading.vue';
import { addClass, removeClass, getStyle } from 'element-ui/src/utils/dom'; import { addClass, removeClass, getStyle } from 'element-ui/src/utils/dom';
import { PopupManager } from 'element-ui/src/utils/popup';
import afterLeave from 'element-ui/src/utils/after-leave'; import afterLeave from 'element-ui/src/utils/after-leave';
const Mask = Vue.extend(Loading); const Mask = Vue.extend(Loading);
...@@ -13,6 +14,7 @@ loadingDirective.install = Vue => { ...@@ -13,6 +14,7 @@ loadingDirective.install = Vue => {
if (binding.modifiers.fullscreen) { if (binding.modifiers.fullscreen) {
el.originalPosition = getStyle(document.body, 'position'); el.originalPosition = getStyle(document.body, 'position');
el.originalOverflow = getStyle(document.body, 'overflow'); el.originalOverflow = getStyle(document.body, 'overflow');
el.maskStyle.zIndex = PopupManager.nextZIndex();
addClass(el.mask, 'is-fullscreen'); addClass(el.mask, 'is-fullscreen');
insertDom(document.body, el, binding); insertDom(document.body, el, binding);
...@@ -71,7 +73,7 @@ loadingDirective.install = Vue => { ...@@ -71,7 +73,7 @@ loadingDirective.install = Vue => {
el.instance.$emit('after-leave'); el.instance.$emit('after-leave');
} else { } else {
el.instance.visible = true; el.instance.visible = true;
}; }
}); });
el.domInserted = true; el.domInserted = true;
} }
......
import Vue from 'vue'; import Vue from 'vue';
import loadingVue from './loading.vue'; import loadingVue from './loading.vue';
import { addClass, removeClass, getStyle } from 'element-ui/src/utils/dom'; import { addClass, removeClass, getStyle } from 'element-ui/src/utils/dom';
import { PopupManager } from 'element-ui/src/utils/popup';
import afterLeave from 'element-ui/src/utils/after-leave'; import afterLeave from 'element-ui/src/utils/after-leave';
import merge from 'element-ui/src/utils/merge'; import merge from 'element-ui/src/utils/merge';
...@@ -42,6 +43,7 @@ const addStyle = (options, parent, instance) => { ...@@ -42,6 +43,7 @@ const addStyle = (options, parent, instance) => {
if (options.fullscreen) { if (options.fullscreen) {
instance.originalPosition = getStyle(document.body, 'position'); instance.originalPosition = getStyle(document.body, 'position');
instance.originalOverflow = getStyle(document.body, 'overflow'); instance.originalOverflow = getStyle(document.body, 'overflow');
maskStyle.zIndex = PopupManager.nextZIndex();
} else if (options.body) { } else if (options.body) {
instance.originalPosition = getStyle(document.body, 'position'); instance.originalPosition = getStyle(document.body, 'position');
['top', 'left'].forEach(property => { ['top', 'left'].forEach(property => {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
@include b(loading-mask) { @include b(loading-mask) {
position: absolute; position: absolute;
z-index: 10000; z-index: 2000;
background-color: rgba(255, 255, 255, .9); background-color: rgba(255, 255, 255, .9);
margin: 0; margin: 0;
top: 0; top: 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment