From 7de121ade583f8d84fb145affee830ada2b3fef0 Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Fri, 12 Aug 2016 18:02:35 +0800 Subject: [PATCH] fix a compatibility bug of loading --- packages/loading/src/directive.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/loading/src/directive.js b/packages/loading/src/directive.js index b1c587d4..fbc3d908 100644 --- a/packages/loading/src/directive.js +++ b/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';