|
@ -45,6 +45,7 @@ function onDragleave2() { |
|
|
isDrag.value = false |
|
|
isDrag.value = false |
|
|
} |
|
|
} |
|
|
async function onDrop2(ev) { |
|
|
async function onDrop2(ev) { |
|
|
|
|
|
emit("itemDrop") |
|
|
if (!props.sort) return |
|
|
if (!props.sort) return |
|
|
if (!dataSourceKey.value) return |
|
|
if (!dataSourceKey.value) return |
|
|
if (!isDrag.value) return |
|
|
if (!isDrag.value) return |
|
@ -129,6 +130,7 @@ const emit = defineEmits<{ |
|
|
(e: 'expand', data: INiuTreeData): void |
|
|
(e: 'expand', data: INiuTreeData): void |
|
|
(e: 'itemDragstart'): void |
|
|
(e: 'itemDragstart'): void |
|
|
(e: 'itemDragend'): void |
|
|
(e: 'itemDragend'): void |
|
|
|
|
|
(e: 'itemDrop'): void |
|
|
}>() |
|
|
}>() |
|
|
|
|
|
|
|
|
const dataSourceKey = ref() |
|
|
const dataSourceKey = ref() |
|
@ -155,6 +157,7 @@ function onDragEnd(key: INiuTreeKey) { |
|
|
emit("itemDragend") |
|
|
emit("itemDragend") |
|
|
} |
|
|
} |
|
|
async function onDrop(key: INiuTreeKey, status?: ENiuTreeStatus) { |
|
|
async function onDrop(key: INiuTreeKey, status?: ENiuTreeStatus) { |
|
|
|
|
|
emit("itemDrop") |
|
|
if (!dataSourceKey.value) return |
|
|
if (!dataSourceKey.value) return |
|
|
if (!key) return |
|
|
if (!key) return |
|
|
let data = findByKey(dataSourceKey.value, props.list) |
|
|
let data = findByKey(dataSourceKey.value, props.list) |
|
|