Skip to content

Instantly share code, notes, and snippets.

This file is used to be tracked and identified by https://lrc-maker.github.io
@xhemj
xhemj / v-drag.js
Created January 4, 2023 00:37 — forked from sunzsh/v-drag.js
v-drag指令
Vue.directive('drag', (el) => {
const oDiv = el // 当前元素
const minTop = oDiv.getAttribute('drag-min-top')
const ifMoveSizeArea = 20
oDiv.onmousedown = e => {
let target = oDiv
while (window.getComputedStyle(target).position !== 'absolute' && target !== document.body) {
target = target.parentElement
}
🏆 192 Contributions in year 2023
📦 Used 225 MB in GitHub's Storage
📜 2 Public Gists
🔑 1 Public Keys
🚫 Not opted to Hire