Commit a69d9757 authored by Hex's avatar Hex Committed by 杨奕

Loading: update code style (#7152)

parent dba79741
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 => { ...@@ -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 => { ...@@ -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 => { ...@@ -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'),
......
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