Skip to content

Commit 56ea63e

Browse files
committed
add drag handle
1 parent 26a6099 commit 56ea63e

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

components/DragButton.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<template>
2+
<button
3+
class="flex-shrink-0 px-3 text-slate-400 hover:text-indigo-600 dark:text-slate-500 dark:hover:text-teal-500 cursor-move drag-handle"
4+
>
5+
<mdicon name="drag" size="20" />
6+
</button>
7+
</template>

components/ListView.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ function handleChange(event: DraggableChangeEvent) {
114114
@update:model-value="handleMove"
115115
@change="handleChange"
116116
item-key="id"
117+
handle=".drag-handle"
117118
>
118119
<template #item="{ element: todo }">
119120
<li class="mt-2 first-of-type:mt-0">
@@ -134,6 +135,7 @@ function handleChange(event: DraggableChangeEvent) {
134135
@update:model-value="handleMove"
135136
@change="handleChange"
136137
item-key="id"
138+
handle=".drag-handle"
137139
>
138140
<template #item="{ element: todo }">
139141
<li class="mt-2 first-of-type:mt-0">

components/TodoItem.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ function formatDate(dateISO: string) {
7070
</div>
7171
<template #post>
7272
<DeleteButton @click="$emit('delete')" />
73+
<DragButton />
7374
</template>
7475
</BaseItem>
7576
</template>

0 commit comments

Comments
 (0)