Merge pull request #60 from Leopoldthecoder/next

fix a compatibility bug of loading
pull/2/head
cinwell.li 2016-08-12 18:20:48 +08:00 committed by GitHub
commit 5ce5efde29
1 changed files with 2 additions and 1 deletions

View File

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