From 93e5f27c609e52b64b689056413528137006774a Mon Sep 17 00:00:00 2001 From: 584911253@qq.com <584911253@qq.com> Date: 星期五, 17 三月 2023 15:57:01 +0800 Subject: [PATCH] 弹窗拖拽 --- src/views/Tools/queryinfo.vue | 36 +++++++++++++++++++++++++++++++++++- 1 files changed, 35 insertions(+), 1 deletions(-) diff --git a/src/views/Tools/queryinfo.vue b/src/views/Tools/queryinfo.vue index 649848c..456ce32 100644 --- a/src/views/Tools/queryinfo.vue +++ b/src/views/Tools/queryinfo.vue @@ -11,7 +11,7 @@ top="calc(100% - 470px) " > <div> - <div style="width:940px;height:400px;"> + <div style="width:940px;height:400px;" v-drag> <map-menu-pop v-if="$store.state.mapPopBoxFlag == '1'" /> <map-space-pop v-if="$store.state.mapPopBoxFlag == '2'" /> <pipe-line-analy v-if="$store.state.mapPopBoxFlag == '3'" /> @@ -51,6 +51,36 @@ + }, + directives: { + drag: { + inserted: function (el) { + const dragDom = el; + dragDom.style.cursor = "e-resize"; + dragDom.onmousedown = (e) => { + // 榧犳爣鎸変笅锛岃绠楀綋鍓嶅厓绱犺窛绂诲彲瑙嗗尯鐨勮窛绂� + const disX = e.clientX; + const w = dragDom.clientWidth; + const minW = 500; + const maxW = 940; + var nw; + document.onmousemove = function (e) { + // 閫氳繃浜嬩欢濮旀墭锛岃绠楃Щ鍔ㄧ殑璺濈 + const l = e.clientX - disX; + // 鏀瑰彉褰撳墠鍏冪礌瀹藉害锛屼笉鍙秴杩囨渶灏忔渶澶у�� + nw = w + l; + nw = nw < minW ? minW : nw; + nw = nw > maxW ? maxW : nw; + dragDom.style.width = `${nw}px`; + }; + + document.onmouseup = function (e) { + document.onmousemove = null; + document.onmouseup = null; + }; + }; + }, + }, }, methods: { // 鍏抽棴鎵�鏈� @@ -115,6 +145,10 @@ Math.random().toString().substr(2, 5) ); }, + mouseDown(event) { + // document.addEventListener("mousemove", this.mouseMove); + // this.lastX = event.screenX; + }, }, }; </script> -- Gitblit v1.9.3