Skip to content

Commit e3b9fa8

Browse files
author
Dominik Grenz
committed
🐛 Fix draggable ghost and other options
1 parent 5976342 commit e3b9fa8

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

personalization-webcomponents/src/components/ChecklistList.vue

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44
:list="modelValue"
55
tag="ul"
66
class="list"
7-
:animation="200"
8-
:handle="isDraggable ? '.drag-handle' : undefined"
9-
:disabled="!isDraggable"
7+
:options="sortableOptions"
108
@start="drag = true"
119
@end="drag = false"
12-
:ghost-class="'drag-ghost'"
1310
item-key="serviceID"
1411
>
1512
<template #item="{ element }">
@@ -66,9 +63,9 @@ import type DummyChecklistItem from "@/api/dummyservice/DummyChecklistItem.ts";
6663
6764
import { MucIcon } from "@muenchen/muc-patternlab-vue";
6865
import { Sortable } from "sortablejs-vue3";
69-
import { defineEmits, ref } from "vue";
66+
import {computed, defineEmits, ref} from "vue";
7067
71-
withDefaults(
68+
const props = withDefaults(
7269
defineProps<{
7370
modelValue: DummyChecklistItem[];
7471
isDraggable?: boolean;
@@ -82,6 +79,13 @@ withDefaults(
8279
const emit = defineEmits(["checked", "label-click"]);
8380
const drag = ref(false);
8481
82+
const sortableOptions = computed(() => ({
83+
animation: 200,
84+
handle: props.isDraggable ? ".drag-handle" : undefined,
85+
ghostClass: "drag-ghost",
86+
disabled: !props.isDraggable
87+
}));
88+
8589
const dialogVisible = ref(false);
8690
const dialogItem = ref<DummyChecklistItem | null>(null);
8791

0 commit comments

Comments
 (0)