Selaa lähdekoodia

Merge pull request #60 from Leopoldthecoder/next

fix a compatibility bug of loading
cinwell.li 9 vuotta sitten
vanhempi
commit
5ce5efde29
1 muutettua tiedostoa jossa 2 lisäystä ja 1 poistoa
  1. 2 1
      packages/loading/src/directive.js

+ 2 - 1
packages/loading/src/directive.js

@@ -69,7 +69,8 @@ exports.install = Vue => {
               el.originalPosition = document.body.style.position;
 
               ['top', 'left'].forEach(property => {
-                el.maskStyle[property] = el.getBoundingClientRect()[property] + document.body[`scroll${ property[0].toUpperCase() + property.slice(1) }`] + 'px';
+                let scroll = property === 'top' ? 'scrollTop' : 'scrollLeft';
+                el.maskStyle[property] = el.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] + 'px';
               });
               ['height', 'width'].forEach(property => {
                 el.maskStyle[property] = el.getBoundingClientRect()[property] + 'px';