提交 514c2398 编写于 作者: tony001's avatar tony001

Revert "WHN——优化首页拖动代码"

This reverts commit 69b3b03c.
上级 3f076373
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
this.viewState.next({ tag: 'appmenu', action: 'load', data: {} }); this.viewState.next({ tag: 'appmenu', action: 'load', data: {} });
this.$viewTool.setIndexParameters([{ pathName: '${view.getCodeName()?lower_case}', parameterName: '${view.getCodeName()?lower_case}' }]); this.$viewTool.setIndexParameters([{ pathName: '${view.getCodeName()?lower_case}', parameterName: '${view.getCodeName()?lower_case}' }]);
this.$viewTool.setIndexViewParam(this.context); this.$viewTool.setIndexViewParam(this.context);
this.draggable(); this.mouse_move();
<#-- let loader:any = document.getElementById('app-loader'); <#-- let loader:any = document.getElementById('app-loader');
loader.parentNode.removeChild(loader); --> loader.parentNode.removeChild(loader); -->
</#assign> </#assign>
...@@ -215,75 +215,51 @@ ...@@ -215,75 +215,51 @@
} }
/** /**
* 鼠标拖动点击事件 * 鼠标拖动事件
* *
* @param {*} val * @param {*} val
* @returns {*} * @returns {*}
* @memberof ${srfclassname('${view.name}')}Base * @memberof ${srfclassname('${view.name}')}Base
*/ */
public draggable(){ public mouse_move(){
let resizeLine:any = document.getElementById("move_axis"); let move_axis:any = document.getElementById("move_axis");
let sideBar :any= resizeLine.previousElementSibling; let left_move :any= document.getElementById("left_move");
let content :any= resizeLine.nextElementSibling; let right_move :any= document.getElementById("right_move");
let container :any= resizeLine.parentElement; let movebox :any= document.getElementById("movebox");
let leftWidth :number = parseInt(sideBar.style.width); let leftWidth :number = parseInt(left_move.style.width);
resizeLine.onmousedown = (e:any) =>{ move_axis.onmousedown = (e:any) =>{
let startX = e.clientX; let startX = e.clientX;
resizeLine.left = resizeLine.offsetLeft; move_axis.left = move_axis.offsetLeft;
this.dragging(resizeLine,startX,container,sideBar,content,leftWidth); document.onmousemove = (e:any) =>{
this.dragEnd(resizeLine); let endX = e.clientX;
resizeLine.setCapture && resizeLine.setCapture(); let moveLen = move_axis.left + (endX - startX);
return false; let maxT = movebox.clientWidth - move_axis.offsetWidth;
} if (moveLen < 150) moveLen = 150;
} if (moveLen > maxT - 150) moveLen = maxT - 150;
move_axis.style.left = moveLen;
left_move.style.width = moveLen + "px";
right_move.style.width = (movebox.clientWidth - moveLen - 5) + "px";
if (moveLen>500) {
left_move.style.width = 500 + 'px';
}
/** let left_width : number = parseInt(left_move.style.width);
* 鼠标拖动事件 move_axis.style.left = left_width - 5 + 'px';
* if (left_width < leftWidth){
* @param {*} resizeLine 拖动滑块 move_axis.style.left = leftWidth - 5 + 'px';
* @param {*} startX 拖动起始位置 }
* @param {*} container 父节点
* @param {*} sideBar 侧边栏
* @param {*} content 右侧内容区域
* @param {*} leftWidth 侧边栏宽度
* @memberof ${srfclassname('${view.name}')}Base
*/
public dragging(resizeLine:any,startX:any,container:any,sideBar:any,content:any,leftWidth:any) {
document.onmousemove = (e:any) =>{
let endX = e.clientX;
let moveDistance = resizeLine.left + (endX - startX);
let maxT = container.clientWidth - resizeLine.offsetWidth;
if(moveDistance < 150) moveDistance = 150;
if(moveDistance > maxT - 150) moveDistance = maxT - 150;
resizeLine.style.left = moveDistance;
sideBar.style.width = moveDistance + 'px';
content.style.width = (container.clientWidth - moveDistance - 5) + 'px';
if(moveDistance > 500) {
sideBar.style.width = 500 + 'px'
} }
let left_Width :number = parseInt(sideBar.style.width); document.onmouseup = (evt) =>{
resizeLine.style.left = left_Width - 5 + 'px'; document.onmousemove = null;
if(left_Width < left_Width) { document.onmouseup = null;
sideBar.style.left = leftWidth - 5 + 'px' move_axis.releaseCapture && move_axis.releaseCapture();
} }
move_axis.setCapture && move_axis.setCapture();
return false;
} }
} }
/**
* 鼠标拖动结束事件
*
* @param {*} resizeLine
* @memberof ${srfclassname('${view.name}')}Base
*/
public dragEnd(resizeLine:any) {
document.onmouseup = (evt) =>{
document.onmousemove = null;
document.onmouseup = null;
resizeLine.releaseCapture && resizeLine.releaseCapture();
}
}
}
<#ibizinclude> <#ibizinclude>
../@MACRO/VIEW_BOTTOM-BASE.vue.ftl ../@MACRO/VIEW_BOTTOM-BASE.vue.ftl
</#ibizinclude> </#ibizinclude>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册