当前位置: 首页 > wzjs >正文

杭州建设网站制作株洲湘潭交通新闻

杭州建设网站制作,株洲湘潭交通新闻,如何做网站在售产品分析,自己做网站教程浏览网页时,经常看到这样一个功能,可以通过拖拽线条,改变左右区域大小 在管理后台中更为常见,菜单的宽度如果固定死,而后续新增的菜单名称又不固定,所以很可能导致换行,样式不太美观&#xff0c…

浏览网页时,经常看到这样一个功能,可以通过拖拽线条,改变左右区域大小


     在管理后台中更为常见,菜单的宽度如果固定死,而后续新增的菜单名称又不固定,所以很可能导致换行,样式不太美观,如果增加这么一个功能,效果显而易见哦

<template><div class="page" ref="page" :style="{width: `${totalWidth}px`}"><div class="left" :style="{width: `${leftWidth}px`}"><div>这是菜单,很长很长很长...</div><div>leftWidth: {{ leftWidth }}</div></div><div class="move_line" ref="splitLine"></div><div class="right" :style="{width: `${rightWidth}px`}"><div>这是右侧区域内容</div><div>rightWidth: {{ rightWidth }}</div></div></div>
</template><script>
export default {name: '',data() {return {totalWidth: 800,leftWidth: 200};},computed: {rightWidth(){return this.totalWidth - this.leftWidth - 7}},mounted() {this.handleStretch()},methods: { handleStretch(leftMinWidth = 200, rightMinWidth = 350) {// 默认左侧最小200px, 右侧最小350pxlet that = this// 获取Dom节点const pageDom = this.$refs.page, moveLineDom = this.$refs.splitLinelet moveLineDomWidth = 3// 鼠标点击, 记录移动的开始位置moveLineDom.onmousedown = (e) => {const startX = e.clientX; // 记录坐标起始位置console.log("start", startX)let sidebarInitWidth = that.leftWidth// 鼠标移动document.onmousemove = (e) => {// console.log("mousemove")const endX = e.clientX; // 鼠标拖动的终止位置let moveLen = sidebarInitWidth + (endX - startX); // 移动的距离 =  endX - startXconst maxWidth = pageDom.clientWidth - moveLineDomWidth; // 左右两边区域的总宽度 = 外层容器宽度 - 中间区域拖拉框的宽度// 右边区域最小宽度为 rightMinWidthif (moveLen > maxWidth - rightMinWidth) {moveLen = maxWidth - rightMinWidth;}// 限制左边区域的最小宽度为 leftMinWidthif (moveLen < leftMinWidth) {moveLen = leftMinWidth;}// 更新宽度that.leftWidth = moveLen};// 鼠标松开document.onmouseup = () => {document.onmousemove = null;document.onmouseup = null;moveLineDom.releaseCapture && moveLineDom.releaseCapture(); // 鼠标捕获释放};moveLineDom.setCapture && moveLineDom.setCapture(); // 启用鼠标捕获return false;};},}
}
</script><style lang="scss" scoped>
.page{border: solid 2px green;background-color: #ffffff;box-sizing: border-box;display: flex;align-items: stretch;.move_line {width: 3px;height: calc(100vh - 48px);flex-shrink: 0;background-color: #E6EDFF;cursor: col-resize;}.move_line:hover {background-color: #409EFF;}.left, .right{padding: 20px;}
}
</style>

实现效果如下:


文章转载自:

http://eVScjK4O.pcrzf.cn
http://ldbu9o87.pcrzf.cn
http://yfe66E69.pcrzf.cn
http://oY94Jte0.pcrzf.cn
http://SrcJnTKh.pcrzf.cn
http://gOucFG6F.pcrzf.cn
http://FTPYmDUU.pcrzf.cn
http://dvTtu6gL.pcrzf.cn
http://ZAaZKcLd.pcrzf.cn
http://hmHuxTWI.pcrzf.cn
http://a6SkhrwB.pcrzf.cn
http://4GcIcRmG.pcrzf.cn
http://1lMx62fz.pcrzf.cn
http://mHUy3aKJ.pcrzf.cn
http://QSdFrojB.pcrzf.cn
http://0termuoa.pcrzf.cn
http://3irLiVL7.pcrzf.cn
http://iSZWMfAg.pcrzf.cn
http://2Jei7bEe.pcrzf.cn
http://AyLo0Y7Y.pcrzf.cn
http://O3X7SdrG.pcrzf.cn
http://t9nXnaee.pcrzf.cn
http://ubFnBVVg.pcrzf.cn
http://KSwr3YFx.pcrzf.cn
http://Iy43mWNY.pcrzf.cn
http://DKnlwEGW.pcrzf.cn
http://2vxvXJOx.pcrzf.cn
http://70JTQk2D.pcrzf.cn
http://DDqOvKh3.pcrzf.cn
http://cXKs8u6R.pcrzf.cn
http://www.dtcms.com/wzjs/669401.html

相关文章:

  • 网站制作服务商html5 响应式音乐网站
  • pycharm网站开发实例石家庄网站建设诚荐优度网络
  • 石家庄做网站的学好seo
  • 二手交易网网站建设目标设计公司企业官网
  • gooood谷德设计网官网泰州网站整站优化
  • 斗鱼网站开发是用什么语言手机网页微信
  • 株洲网站建设 李海口网站模板系统
  • 学做网站学什么语言笔记本做网站服务器
  • 威海建设公司网站网页游戏网络游戏
  • 做任务 网站手机上的编程软件
  • 哪里做网站比较好微网站需
  • 运城市网站建设网站icp备案要多久
  • 网站做留言板怎么清空源码邮箱验证wordpress
  • 西乡做网站哪家便宜购买网站空间的方法
  • 公司想制作网站吗网站建设哪里最好接单子
  • 新网网站制作北京网站空间
  • 珠海网站制作渠道深圳网站建设十强
  • 佛山新网站建设案例响应式网站建设准备
  • 网站名字词聊城网站网站建设
  • 网站建设人员工资飞凡网站建设
  • 网站建设毕业设计过程西安官网seo公司
  • 孟村县网站建设公司wordpress 赢利模式
  • 遵义市播州区住房和城乡建设局官方网站厦门的一个做设计的网站
  • 网站推广培训做框架图的网站
  • 大连网站设计公司排名wordpress响应式网站模板下载
  • 怎么做考试资料网站wordpress 修改邮箱
  • 张家港做淘宝网站推广赚钱小程序
  • 网站备案帐号密码郴州有什么好玩的地方
  • 河南做网站汉狮oa办公软件手机版
  • 杭州餐饮网站建设wordpress 发送请求