From 8a1c08baaf0ee002b471996b195e7da180b90209 Mon Sep 17 00:00:00 2001 From: feige <791364011@qq.com> Date: 星期一, 21 七月 2025 09:38:47 +0800 Subject: [PATCH] 增加了前端代码库 --- src/directive/dialog/dragHeight.js | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/src/directive/dialog/dragHeight.js b/src/directive/dialog/dragHeight.js new file mode 100644 index 0000000..cf4786e --- /dev/null +++ b/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) + } +} -- Gitblit v1.9.1