소스 검색

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';