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/dragWidth.js | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) diff --git a/src/directive/dialog/dragWidth.js b/src/directive/dialog/dragWidth.js new file mode 100644 index 0000000..93ab05f --- /dev/null +++ b/src/directive/dialog/dragWidth.js @@ -0,0 +1,30 @@ +/** + * v-dialogDragWidth 鍙嫋鍔ㄥ脊绐楀搴︼紙鍙充晶杈癸級 + * Copyright (c) 2019 ruoyi + */ + +export default { + bind(el) { + const dragDom = el.querySelector('.el-dialog') + const lineEl = document.createElement('div') + lineEl.style = 'width: 5px; background: inherit; height: 80%; position: absolute; right: 0; top: 0; bottom: 0; margin: auto; z-index: 1; cursor: w-resize;' + lineEl.addEventListener('mousedown', + function (e) { + // 榧犳爣鎸変笅锛岃绠楀綋鍓嶅厓绱犺窛绂诲彲瑙嗗尯鐨勮窛绂� + const disX = e.clientX - el.offsetLeft + // 褰撳墠瀹藉害 + const curWidth = dragDom.offsetWidth + document.onmousemove = function (e) { + e.preventDefault() // 绉诲姩鏃剁鐢ㄩ粯璁や簨浠� + // 閫氳繃浜嬩欢濮旀墭锛岃绠楃Щ鍔ㄧ殑璺濈 + const l = e.clientX - disX + dragDom.style.width = `${curWidth + l}px` + } + document.onmouseup = function (e) { + document.onmousemove = null + document.onmouseup = null + } + }, false) + dragDom.appendChild(lineEl) + } +} -- Gitblit v1.9.1