mirror of https://github.com/ElemeFE/element
Loading: update code style (#7152)
parent
dba797416e
commit
a69d975730
|
@ -1,10 +1,10 @@
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import { addClass, removeClass, getStyle } from 'element-ui/src/utils/dom';
|
import { addClass, removeClass, getStyle } from 'element-ui/src/utils/dom';
|
||||||
let Mask = Vue.extend(require('./loading.vue'));
|
const Mask = Vue.extend(require('./loading.vue'));
|
||||||
|
|
||||||
exports.install = Vue => {
|
exports.install = Vue => {
|
||||||
if (Vue.prototype.$isServer) return;
|
if (Vue.prototype.$isServer) return;
|
||||||
let toggleLoading = (el, binding) => {
|
const toggleLoading = (el, binding) => {
|
||||||
if (binding.value) {
|
if (binding.value) {
|
||||||
Vue.nextTick(() => {
|
Vue.nextTick(() => {
|
||||||
if (binding.modifiers.fullscreen) {
|
if (binding.modifiers.fullscreen) {
|
||||||
|
@ -20,7 +20,7 @@ exports.install = Vue => {
|
||||||
el.originalPosition = getStyle(document.body, 'position');
|
el.originalPosition = getStyle(document.body, 'position');
|
||||||
|
|
||||||
['top', 'left'].forEach(property => {
|
['top', 'left'].forEach(property => {
|
||||||
let scroll = property === 'top' ? 'scrollTop' : 'scrollLeft';
|
const scroll = property === 'top' ? 'scrollTop' : 'scrollLeft';
|
||||||
el.maskStyle[property] = el.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] + 'px';
|
el.maskStyle[property] = el.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] + 'px';
|
||||||
});
|
});
|
||||||
['height', 'width'].forEach(property => {
|
['height', 'width'].forEach(property => {
|
||||||
|
@ -51,7 +51,7 @@ exports.install = Vue => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let insertDom = (parent, el, binding) => {
|
const insertDom = (parent, el, binding) => {
|
||||||
if (!el.domVisible && getStyle(el, 'display') !== 'none' && getStyle(el, 'visibility') !== 'hidden') {
|
if (!el.domVisible && getStyle(el, 'display') !== 'none' && getStyle(el, 'visibility') !== 'hidden') {
|
||||||
Object.keys(el.maskStyle).forEach(property => {
|
Object.keys(el.maskStyle).forEach(property => {
|
||||||
el.mask.style[property] = el.maskStyle[property];
|
el.mask.style[property] = el.maskStyle[property];
|
||||||
|
@ -75,7 +75,7 @@ exports.install = Vue => {
|
||||||
|
|
||||||
Vue.directive('loading', {
|
Vue.directive('loading', {
|
||||||
bind: function(el, binding) {
|
bind: function(el, binding) {
|
||||||
let mask = new Mask({
|
const mask = new Mask({
|
||||||
el: document.createElement('div'),
|
el: document.createElement('div'),
|
||||||
data: {
|
data: {
|
||||||
text: el.getAttribute('element-loading-text'),
|
text: el.getAttribute('element-loading-text'),
|
||||||
|
|
Loading…
Reference in New Issue