vue 自定义拖拽指令

export function addDirective(app) {     /**    * 拖拽指令使用方式:v-drag="[dragDom, dragHeader]",如 `<div v-drag="['.drag-container .el-dialog', '.drag-container .el-dialog__header']"></div>`    */    app.directive('drag', {     mounted(el, binding) {       if (!binding.value) return false;        binding.instance.$nextTick(() => {         const dragDom = document.querySelector(binding.value[0])         const dragHeader = document.querySelector(binding.value[1])          dragHeader.onmouseover = () => (dragHeader.style.cursor = `move`);          function down(e, type) {           // 鼠标按下,计算当前元素距离可视区的距离           const disX = type === 'pc' ? e.clientX - dragHeader.offsetLeft : e.touches[0].clientX - dragHeader.offsetLeft;           const disY = type === 'pc' ? e.clientY - dragHeader.of