Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/components/Sortable.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, PropType, watch, onUnmounted, computed, useAttrs } from "vue";
import { ref, PropType, watch, onUnmounted, computed, useAttrs, Ref } from "vue";
import Sortable, { SortableOptions } from "sortablejs";
import type { AutoScrollOptions } from "sortablejs/plugins";

Expand Down Expand Up @@ -63,7 +63,7 @@ const emit = defineEmits<{
(eventName: "change", evt: Sortable.SortableEvent): void;
}>();

const attrs = useAttrs()
const attrs = useAttrs();

const containerRef = ref<HTMLElement | null>(null);
const sortable = ref<Sortable | null>(null);
Expand All @@ -73,6 +73,8 @@ const getKey = computed(() => {
return props.itemKey;
});

defineExpose({ containerRef, sortable: <Ref<Sortable | null>>sortable });

watch(containerRef, (newDraggable) => {
if (newDraggable) {
sortable.value = new Sortable(newDraggable, {
Expand Down