From f9d510ea78bbb919ed4dbaf0b1ad1577c7b2aa46 Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 4 May 2018 10:26:29 +0800 Subject: [PATCH] perf[el-dragDialog]: use curring --- src/directive/el-dragDialog/drag.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/directive/el-dragDialog/drag.js b/src/directive/el-dragDialog/drag.js index aa361c7d..3e3fb62a 100644 --- a/src/directive/el-dragDialog/drag.js +++ b/src/directive/el-dragDialog/drag.js @@ -6,13 +6,13 @@ export default{ dragDom.style.cssText += ';top:0px;' // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null); - function getStyle(dom, attr) { - if (dom.currentStyle) { - return dom.currentStyle[attr] + const getStyle = (function() { + if (window.document.currentStyle) { + return (dom, attr) => dom.currentStyle[attr] } else { - return getComputedStyle(dom, false)[attr] + return (dom, attr) => getComputedStyle(dom, false)[attr] } - } + })() dialogHeaderEl.onmousedown = (e) => { // 鼠标按下,计算当前元素距离可视区的距离