ruoyi-ui/src/directive/dialog/dragHeight.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ruoyi-ui/src/directive/dialog/dragWidth.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ruoyi-ui/src/directive/index.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
ruoyi-ui/src/directive/dialog/dragHeight.js
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,34 @@ /** * v-dialogDragWidth 坿å¨å¼¹çªé«åº¦ï¼å³ä¸è§ï¼ * Copyright (c) 2019 ruoyi */ export default { bind(el) { const dragDom = el.querySelector('.el-dialog'); const lineEl = document.createElement('div'); lineEl.style = 'width: 6px; background: inherit; height: 10px; position: absolute; right: 0; bottom: 0; margin: auto; z-index: 1; cursor: nwse-resize;'; lineEl.addEventListener('mousedown', function(e) { // é¼ æ æä¸ï¼è®¡ç®å½åå ç´ è·ç¦»å¯è§åºçè·ç¦» const disX = e.clientX - el.offsetLeft; const disY = e.clientY - el.offsetTop; // å½å宽度 é«åº¦ const curWidth = dragDom.offsetWidth; const curHeight = dragDom.offsetHeight; document.onmousemove = function(e) { e.preventDefault(); // ç§»å¨æ¶ç¦ç¨é»è®¤äºä»¶ // éè¿äºä»¶å§æï¼è®¡ç®ç§»å¨çè·ç¦» const xl = e.clientX - disX; const yl = e.clientY - disY dragDom.style.width = `${curWidth + xl}px`; dragDom.style.height = `${curHeight + yl}px`; }; document.onmouseup = function(e) { document.onmousemove = null; document.onmouseup = null; }; }, false); dragDom.appendChild(lineEl); } } ruoyi-ui/src/directive/dialog/dragWidth.js
@@ -1,5 +1,5 @@ /** * v-dialogDragWidth 坿å¨å¼¹çªå®½åº¦ * v-dialogDragWidth 坿å¨å¼¹çªå®½åº¦ï¼å³ä¾§è¾¹ï¼ * Copyright (c) 2019 ruoyi */ @@ -24,8 +24,7 @@ document.onmousemove = null; document.onmouseup = null; }; }, ); }, false); dragDom.appendChild(lineEl); } } ruoyi-ui/src/directive/index.js
@@ -2,12 +2,14 @@ import hasPermi from './permission/hasPermi' import dialogDrag from './dialog/drag' import dialogDragWidth from './dialog/dragWidth' import dialogDragHeight from './dialog/dragHeight' const install = function(Vue) { Vue.directive('hasRole', hasRole) Vue.directive('hasPermi', hasPermi) Vue.directive('dialogDrag', dialogDrag) Vue.directive('dialogDragWidth', dialogDragWidth) Vue.directive('dialogDragHeight', dialogDragHeight) } if (window.Vue) {