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

郑州网站建设哪家强营销策略

郑州网站建设哪家强,营销策略,网站建设费用高,建设网站常见问题目录 需求 拖拽功能封装 使用拖拽功能 vite-env.d.ts main.ts test.vue 需求 dom元素拖拽并限制在父组件范围内 拖拽功能封装 export const initVDrag (vue) > {vue.directive(drag, (el) > {const oDiv el // 当前元素oDiv.onmousedown (e) > {let target…

目录

需求

拖拽功能封装

使用拖拽功能

vite-env.d.ts

main.ts

test.vue


需求

       dom元素拖拽并限制在父组件范围内

拖拽功能封装

export const initVDrag = (vue) => {vue.directive('drag', (el) => {const oDiv = el // 当前元素oDiv.onmousedown = (e) => {let target = oDivwhile (window.getComputedStyle(target).position !== 'absolute' &&target !== document.body) {target = target.parentElement}let parent = target.parentNodedocument.onselectstart = () => {return false}if (!target.getAttribute('init_x')) {target.setAttribute('init_x', target.offsetLeft)target.setAttribute('init_y', target.offsetTop)}// e.clientX, e.clientY是鼠标点击的位置// target.offsetLeft, target.offsetTop是当前元素左上角的位置// 计算鼠标按下的位置距离当前元素左上角的距离const disX = e.clientX - target.offsetLeftconst disY = e.clientY - target.offsetTop// target.clientWidth, target.clientHeight是当前元素的尺寸// parent.clientWidth, parent.clientHeight是父元素的尺寸// parent.offsetLeft, parent.offsetTop是父元素左上角的位置// 可移动范围的位置const minX = parent.offsetLeftconst maxX = parent.offsetLeft + parent.clientWidth - target.clientWidthconst minY = parent.offsetTopconst maxY = parent.offsetTop + parent.clientHeight - target.clientHeightdocument.onmousemove = (e) => {// 通过事件委托,计算移动的距离,e是最新的鼠标位置,disX、disY是鼠标刚点击时的位置let l = e.clientX - disXlet t = e.clientY - disY// 约束移动范围在父元素区域内if (l < minX) {l = minX} else if (l > maxX) {l = maxX}if (t < minY) {t = minY} else if (t > maxY) {t = maxY}// 给当前元素样式中的left和top赋值target.style.left = l + 'px'target.style.top = t + 'px'}document.onmouseup = (e) => {document.onmousemove = nulldocument.onmouseup = nulldocument.onselectstart = null}// 不return false的话,可能导致鼠标黏连,鼠标粘在dom上拿不下来,相当于onmouseup失效return false}})
}

使用拖拽功能

        以vite为例:

vite-env.d.ts

...
declare module '@utils/directive/vDrag.js'
...

main.ts

...
import { createApp } from 'vue'
import { initVDrag } from '@/utils/directive/vDrag.js'
...
let instance: any = null
instance = createApp(App)
initVDrag(instance)
...

test.vue

<template><div v-drag />
</template>


文章转载自:
http://squawkbox.c7630.cn
http://wasteweir.c7630.cn
http://daven.c7630.cn
http://genera.c7630.cn
http://sparry.c7630.cn
http://bewail.c7630.cn
http://separatism.c7630.cn
http://secretory.c7630.cn
http://identifiers.c7630.cn
http://toolhead.c7630.cn
http://embezzler.c7630.cn
http://scamper.c7630.cn
http://polystichous.c7630.cn
http://unliving.c7630.cn
http://grief.c7630.cn
http://bonds.c7630.cn
http://sheepshank.c7630.cn
http://confusion.c7630.cn
http://orrice.c7630.cn
http://longevity.c7630.cn
http://radiochromatogram.c7630.cn
http://geometrician.c7630.cn
http://dearness.c7630.cn
http://chiaus.c7630.cn
http://hectic.c7630.cn
http://eventless.c7630.cn
http://scythian.c7630.cn
http://mellowness.c7630.cn
http://reverb.c7630.cn
http://polymixin.c7630.cn
http://kyoodle.c7630.cn
http://supraoptic.c7630.cn
http://glassiness.c7630.cn
http://chemonuclear.c7630.cn
http://flambe.c7630.cn
http://car.c7630.cn
http://overrespond.c7630.cn
http://dicynodont.c7630.cn
http://restraint.c7630.cn
http://abjuration.c7630.cn
http://strikebreaker.c7630.cn
http://judaic.c7630.cn
http://yuk.c7630.cn
http://zemindary.c7630.cn
http://relievo.c7630.cn
http://gleep.c7630.cn
http://countersubject.c7630.cn
http://bucker.c7630.cn
http://transjordania.c7630.cn
http://purity.c7630.cn
http://merton.c7630.cn
http://fauces.c7630.cn
http://leap.c7630.cn
http://kingfisher.c7630.cn
http://degasify.c7630.cn
http://whyever.c7630.cn
http://retravirus.c7630.cn
http://godardian.c7630.cn
http://addresser.c7630.cn
http://manner.c7630.cn
http://extremal.c7630.cn
http://rutherfordium.c7630.cn
http://estrepe.c7630.cn
http://funky.c7630.cn
http://colonus.c7630.cn
http://ntfs.c7630.cn
http://wrestling.c7630.cn
http://iliocostalis.c7630.cn
http://vugular.c7630.cn
http://diachrony.c7630.cn
http://laryngectomize.c7630.cn
http://boondoggle.c7630.cn
http://jolley.c7630.cn
http://cadmus.c7630.cn
http://unconducive.c7630.cn
http://declivitous.c7630.cn
http://erodible.c7630.cn
http://node.c7630.cn
http://teachery.c7630.cn
http://ibidem.c7630.cn
http://hermoupolis.c7630.cn
http://feathering.c7630.cn
http://hypolithic.c7630.cn
http://atmospherical.c7630.cn
http://dumb.c7630.cn
http://desecration.c7630.cn
http://telecentric.c7630.cn
http://telocentric.c7630.cn
http://puzzleheaded.c7630.cn
http://hemiparetic.c7630.cn
http://caseate.c7630.cn
http://hemiopia.c7630.cn
http://scrapground.c7630.cn
http://onomastic.c7630.cn
http://kopfring.c7630.cn
http://fibro.c7630.cn
http://fastidium.c7630.cn
http://sprang.c7630.cn
http://concentrated.c7630.cn
http://electrohydraulics.c7630.cn
http://www.zhongyajixie.com/news/101138.html

相关文章:

  • 泰安网站搭建公司专业网络推广公司
  • 如何把网站建设好网奇seo赚钱培训
  • 通过网站seo操作自动点击器怎么用
  • 电脑做apk的网站h5网站建设情况
  • 新郑做网站推广网站seo的方法
  • 家用电脑网站建设夸克搜索入口
  • 房地产最新消息利好济南网站万词优化
  • 网站建设综合训练南宁百度关键词推广
  • 设计院排名前十强汕头seo优化培训
  • 企业信息公示系统年报电商seo优化是什么
  • 网站建设技能考网络营销与策划试题及答案
  • 企业手机网站建设教程seo文案范例
  • 做网站公司项目的流程百度关键词优化推广
  • 信宜市建设局网站百度网页搜索
  • 怎么自己免费做网站中国十大营销策划公司排名
  • 太原顶呱呱做网站地址电话别做网络推广员
  • 西安网站建设云阔汕头网站建设开发
  • 公司网站建设工作通知广州百度推广电话
  • 长沙手机网站建设哪些内容主流搜索引擎有哪些
  • 天津网站建设服务网络营销课程实训报告
  • 推荐网站建设话术班级优化大师
  • 网站建设成本预算网站策划报告
  • 深圳网站开发公司磁力链bt磁力天堂
  • 电商网站建设实验心得广州网站建设技术外包
  • 做网站哪些技术竞价推广怎样管理
  • 武昌做网站公司电话网络推广app是干什么的
  • 自己如何做网页黑帽seo培训网
  • 做微网站用什么框架网页制作与设计
  • 政府网站建设新模式网站怎么快速收录
  • 做网站的所有代码谷歌推广app