fix a compatibility bug of loading

This commit is contained in:
Leopoldthecoder 2016-08-12 18:02:35 +08:00
parent e28f33905d
commit 7de121ade5

View File

@ -69,7 +69,8 @@ exports.install = Vue => {
el.originalPosition = document.body.style.position; el.originalPosition = document.body.style.position;
['top', 'left'].forEach(property => { ['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 => { ['height', 'width'].forEach(property => {
el.maskStyle[property] = el.getBoundingClientRect()[property] + 'px'; el.maskStyle[property] = el.getBoundingClientRect()[property] + 'px';