Skip to content

Commit b2dcffc

Browse files
committed
Add tag prop
1 parent 960497d commit b2dcffc

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/components/Sortable.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ const props = defineProps({
3434
default: "",
3535
required: true,
3636
},
37+
tag: {
38+
type: String as PropType<string>,
39+
default: "div",
40+
required: false,
41+
}
3742
});
3843
3944
const emit = defineEmits<{
@@ -84,13 +89,17 @@ onUnmounted(() => {
8489
</script>
8590

8691
<template>
87-
<div ref="containerRef" :class="$props.class">
92+
<component
93+
ref="containerRef"
94+
:is="$props.tag"
95+
:class="$props.class"
96+
>
8897
<slot
8998
v-for="(item, index) of list"
9099
:key="item[$props.itemKey!]"
91100
:element="item"
92101
:index="index"
93102
name="item"
94103
></slot>
95-
</div>
104+
</component>
96105
</template>

0 commit comments

Comments
 (0)