浏览代码

Merge pull request #60 from Leopoldthecoder/next

fix a compatibility bug of loading
cinwell.li 9 年之前
父节点
当前提交
5ce5efde29
共有 1 个文件被更改,包括 2 次插入1 次删除
  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';