Skip to content

Commit 133a8c4

Browse files
Added defineExpose() (#58)
* Added defineExpose() * Fixed TS4082 error * Replaced unknown type
1 parent 85ba27d commit 133a8c4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/Sortable.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { ref, PropType, watch, onUnmounted, computed, useAttrs } from "vue";
2+
import { ref, PropType, watch, onUnmounted, computed, useAttrs, Ref } from "vue";
33
import Sortable, { SortableOptions } from "sortablejs";
44
import type { AutoScrollOptions } from "sortablejs/plugins";
55
@@ -63,7 +63,7 @@ const emit = defineEmits<{
6363
(eventName: "change", evt: Sortable.SortableEvent): void;
6464
}>();
6565
66-
const attrs = useAttrs()
66+
const attrs = useAttrs();
6767
6868
const containerRef = ref<HTMLElement | null>(null);
6969
const sortable = ref<Sortable | null>(null);
@@ -73,6 +73,8 @@ const getKey = computed(() => {
7373
return props.itemKey;
7474
});
7575
76+
defineExpose({ containerRef, sortable: <Ref<Sortable | null>>sortable });
77+
7678
watch(containerRef, (newDraggable) => {
7779
if (newDraggable) {
7880
sortable.value = new Sortable(newDraggable, {

0 commit comments

Comments
 (0)