|
@@ -1,6 +1,6 @@
|
|
|
import Vue from 'vue';
|
|
|
import loadingVue from './loading.vue';
|
|
|
-import { getStyle } from 'element-ui/src/utils/dom';
|
|
|
+import { addClass, removeClass, getStyle } from 'element-ui/src/utils/dom';
|
|
|
import merge from 'element-ui/src/utils/merge';
|
|
|
|
|
|
const LoadingConstructor = Vue.extend(loadingVue);
|
|
@@ -23,14 +23,11 @@ LoadingConstructor.prototype.close = function() {
|
|
|
fullscreenLoading = undefined;
|
|
|
}
|
|
|
this.$on('after-leave', _ => {
|
|
|
- if (this.fullscreen && this.originalOverflow !== 'hidden') {
|
|
|
- document.body.style.overflow = this.originalOverflow;
|
|
|
- }
|
|
|
- if (this.fullscreen || this.body) {
|
|
|
- document.body.style.position = this.originalPosition;
|
|
|
- } else {
|
|
|
- this.target.style.position = this.originalPosition;
|
|
|
- }
|
|
|
+ const target = this.fullscreen || this.body
|
|
|
+ ? document.body
|
|
|
+ : this.target;
|
|
|
+ removeClass(target, 'el-loading-parent--relative');
|
|
|
+ removeClass(target, 'el-loading-parent--hidden');
|
|
|
if (this.$el && this.$el.parentNode) {
|
|
|
this.$el.parentNode.removeChild(this.$el);
|
|
|
}
|
|
@@ -88,10 +85,10 @@ const Loading = (options = {}) => {
|
|
|
|
|
|
addStyle(options, parent, instance);
|
|
|
if (instance.originalPosition !== 'absolute' && instance.originalPosition !== 'fixed') {
|
|
|
- parent.style.position = 'relative';
|
|
|
+ addClass(parent, 'el-loading-parent--relative');
|
|
|
}
|
|
|
if (options.fullscreen && options.lock) {
|
|
|
- parent.style.overflow = 'hidden';
|
|
|
+ addClass(parent, 'el-loading-parent--hidden');
|
|
|
}
|
|
|
parent.appendChild(instance.$el);
|
|
|
Vue.nextTick(() => {
|