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

陕西建设集团韩城公司网站淘宝运营招聘

陕西建设集团韩城公司网站,淘宝运营招聘,wordpress 列表函数,网站子域名怎么做一. 主要思路 1.1通过绑定自定义的指令#xff0c;获取需要拖动的父子元素#xff0c; 1.2.添加鼠标按下事件onmousedown#xff0c;计算出鼠标的相对位置odiv.offsetLeft与odiv.offsetTop#xff0c; 1.3.鼠标移动事件onmousemove当鼠标移动时触发#xff0c;移动的时…一. 主要思路 1.1通过绑定自定义的指令获取需要拖动的父子元素 1.2.添加鼠标按下事件onmousedown计算出鼠标的相对位置odiv.offsetLeft与odiv.offsetTop 1.3.鼠标移动事件onmousemove当鼠标移动时触发移动的时候相对位置加上偏移距离得到对应的坐标点 1.4.odiv.style.left与 odiv.style.top动态给对应的元素添加位置样式 1.5.onmouseup():鼠标抬起事件。当鼠标抬起触发// 移除对鼠标移动事件的监听 document.onmousemove null document.onmouseup null 1.6.切换页面初始化加载坐标位置保持页面垂直居中对齐// 初始化初始坐标 二. 分布实施 2.1 template结构cursor:move-鼠标移动上变成可拖拽的样式绑定唯一ID 获取初始化坐标原点 templatedivdiv classAllTree!-- cursor:move-鼠标移动上变成可拖拽的样式 --!-- 通过绑定唯一ID 获取初始化坐标原点 --vue2-org-treestyle#fafafa;cursor:movev-dragiddragFather:datatreeData//div/div /template 2.2 数据结构 data() {return {// 数据treeData: {id: 0,name: ,children: []},};}, 2.3 activated()切换页面初始化加载坐标位置保持页面垂直居中对齐获取id // 切换页面初始化加载坐标位置保持页面垂直居中对齐activated() {// 初始化初始坐标const dialogHeaderEl document.querySelector(#dragFather)dialogHeaderEl.style.left0 px;dialogHeaderEl.style.top0 px;}, 2.4 自定义拖拽指令 // 开启拖拽的指令directives: {drag: {// 指令的定义bind: function (el) {var odiv el // 获取当前元素let isMouseDownfalse;//鼠标按下标记// onmousedown()鼠标按下事件。当鼠标按下时触发。odiv.onmousedown (e) {if(e.button0!isMouseDown){// 算出鼠标相对元素的位置let offsetLeft odiv.offsetLeftlet offsetTop odiv.offsetTopvar disX e.clientXvar disY e.clientY// onmosemove()鼠标移动事件。当鼠标移动时触发document.onmousemove (e) {// 用鼠标的位置减去鼠标相对元素的位置得到元素的位置// 结构沿X轴发生翻转X轴坐标变成从左到右计算的时候相反计算var left disX - e.clientX var top e.clientY - disY// 移动当前元素odiv.style.left (left offsetLeft) pxodiv.style.top (top offsetTop) px}isMouseDowntrue}// onmouseup():鼠标抬起事件。当鼠标抬起触发// e.button0代表点击左键document.onmouseup (e) {if(e.button0){isMouseDownfalse;// 移除对鼠标移动事件的监听document.onmousemove nulldocument.onmouseup null}}}}}}, 2.5 style样式 style scoped ::-webkit-scrollbar {/*隐藏滚轮*/display: none !important;} /style style langless // 整体的结构设置 .AllTree {font-size: 12px;transform: rotateY(180deg);overflow: auto; // 修改组件内置的样式.org-tree-node-label .org-tree-node-label-inner {cursor: pointer;padding: 0;}// 子节点.org-tree-container {position: relative; /*定位*/display: flex;justify-content: center;align-items: center;min-height: 600px;} }// 节点样式 .ReNode {height: 40px;min-width: 50px;transform: rotateY(180deg);background-color: rgb(238, 244, 246);display: flex;line-height: 40px;padding: 0 10px; }/style 三. 特别注意 由于此图结构是从右到左展示市面上的树形结构一般是由从左到右从上到下要求的结构是从右到左所以在进行编写的时候利用 transform: rotateY(180deg);进行了翻转x轴发生了变化所以此处对于坐标的计算有所不同 四.代码汇总 templatedivdiv classAllTree!-- cursor:move-鼠标移动上变成可拖拽的样式 --!-- 通过绑定唯一ID 获取初始化坐标原点 --vue2-org-treestyle#fafafa;cursor:movev-dragiddragFather:datatreeData//div/div /templatescript export default {data() {return {// 数据treeData: {id: 0,name: ,children: []},};},// 切换页面初始化加载坐标位置保持页面垂直居中对齐activated() {// 初始化初始坐标const dialogHeaderEl document.querySelector(#dragFather)dialogHeaderEl.style.left0 px;dialogHeaderEl.style.top0 px;},// 开启拖拽的指令directives: {drag: {// 指令的定义bind: function (el) {var odiv el // 获取当前元素let isMouseDownfalse;//鼠标按下标记// onmousedown()鼠标按下事件。当鼠标按下时触发。odiv.onmousedown (e) {if(e.button0!isMouseDown){// 算出鼠标相对元素的位置let offsetLeft odiv.offsetLeftlet offsetTop odiv.offsetTopvar disX e.clientXvar disY e.clientY// onmosemove()鼠标移动事件。当鼠标移动时触发document.onmousemove (e) {// 用鼠标的位置减去鼠标相对元素的位置得到元素的位置// 结构沿X轴发生翻转X轴坐标变成从左到右计算的时候相反计算var left disX - e.clientX var top e.clientY - disY// 移动当前元素odiv.style.left (left offsetLeft) pxodiv.style.top (top offsetTop) px}isMouseDowntrue}// onmouseup():鼠标抬起事件。当鼠标抬起触发// e.button0代表点击左键document.onmouseup (e) {if(e.button0){isMouseDownfalse;// 移除对鼠标移动事件的监听document.onmousemove nulldocument.onmouseup null}}}}}}, }; /scriptstyle scoped ::-webkit-scrollbar {/*隐藏滚轮*/display: none !important;} /style style langless // 整体的结构设置 .AllTree {font-size: 12px;transform: rotateY(180deg);overflow: auto; // 修改组件内置的样式.org-tree-node-label .org-tree-node-label-inner {cursor: pointer;padding: 0;}// 子节点.org-tree-container {position: relative; /*定位*/display: flex;justify-content: center;align-items: center;min-height: 600px;} }// 节点样式 .ReNode {height: 40px;min-width: 50px;transform: rotateY(180deg);background-color: rgb(238, 244, 246);display: flex;line-height: 40px;padding: 0 10px; }/style
http://www.zqtcl.cn/news/481019/

相关文章:

  • 珠海网站建设平台中国软文网官网
  • 绵阳学校网站建设wordpress 采集站
  • 免费设计软件下载网站大全贵州seo技术培训
  • wordpress网站+搬家自做购物网站多少钱
  • 用自己网站做淘宝客深圳上市公司一览表
  • 如何用图片文字做网站建设部网站安全事故
  • 订制网站网易企业邮箱怎么修改密码
  • 一小时做网站网上免费设计效果图
  • 网站如何注册域名公司主页填什么
  • 南宁国贸网站建设网站跟网页有什么区别
  • 兰州企业 网站建设短链接在线转换
  • 长沙网上商城网站建设方案导航网站系统
  • 网站更换目录名如何做301跳转网站活泼
  • 化妆品网站网页设计怎样在淘宝网做网站
  • 邢台建站湛江海田网站建设招聘
  • 免费个人网站建站能上传视频吗中国舆情在线网
  • 网站开发项目的心得体会惠州建设厅网站
  • 网站小程序怎么做北京单位网站建设培训
  • 北京市专业网站建设广州安全教育平台登录账号登录入口
  • 广州做网站的价格三个关键词介绍自己
  • 基于工作过程的商务网站建设:网页制作扬州网站建设公元国际
  • wordpress著名网站微信公众号怎么做网站链接
  • 长沙网站建设大概多少钱深圳做网站网络营销公司
  • 融资平台排行榜企业网站seo运营
  • 英文手表网站南昌装修网站建设
  • 网站建设要懂哪些技术甘肃园区网络搭建
  • go做的网站微信跳转链接生成器免费
  • 网站开发中怎么设置快捷键怎样打开用sql做的网站
  • 做餐饮企业网站的费用短视频素材免费下载网站
  • 美食优秀设计网站制作网页网站