¶Ô±ÈÐÂÎļþ |
| | |
| | | /**
|
| | | * 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;
|
| | | };
|
| | | },
|
| | | );
|
| | | dragDom.appendChild(lineEl);
|
| | | }
|
| | | } |