Skip to content

Commit f9d510e

Browse files
committed
perf[el-dragDialog]: use curring
1 parent 9fbb028 commit f9d510e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/directive/el-dragDialog/drag.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ export default{
66
dragDom.style.cssText += ';top:0px;'
77

88
// 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
9-
function getStyle(dom, attr) {
10-
if (dom.currentStyle) {
11-
return dom.currentStyle[attr]
9+
const getStyle = (function() {
10+
if (window.document.currentStyle) {
11+
return (dom, attr) => dom.currentStyle[attr]
1212
} else {
13-
return getComputedStyle(dom, false)[attr]
13+
return (dom, attr) => getComputedStyle(dom, false)[attr]
1414
}
15-
}
15+
})()
1616

1717
dialogHeaderEl.onmousedown = (e) => {
1818
// 鼠标按下,计算当前元素距离可视区的距离

0 commit comments

Comments
 (0)