Skip to content

Commit 6f3c31a

Browse files
remove the old slot
1 parent a874342 commit 6f3c31a

File tree

7 files changed

+26
-17
lines changed

7 files changed

+26
-17
lines changed

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
</template>
66

77
<script setup lang="ts">
8-
import CP1 from "./views/FormFieldsTest.vue";
8+
import CP1 from "./views/ModalFormTest.vue";
99
</script>

src/components/FormCheckbox.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</div>
2121
<div class="ml-3 text-sm">
2222
<label
23-
:for="option.name"
23+
:for="`${id}-${index}`"
2424
class="font-medium text-gray-700 cursor-pointer"
2525
>
2626
{{ option.name }}

src/components/FormGenerator.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,17 @@
2020
<slot :name="name" v-bind="slotData" />
2121
</template>
2222
</FormFields>
23-
<slot name="bottom" />
2423
<div class="flex items-center justify-end pt-2 print:hidden">
25-
<ButtonBlue v-if="submit" type="submit" :loading="loading">
24+
<ButtonNormal v-if="submit" type="submit" :loading="loading">
2625
{{ submit }}
27-
</ButtonBlue>
26+
</ButtonNormal>
2827
</div>
2928
</div>
3029
</form>
3130
</template>
3231

3332
<script lang="ts" setup>
34-
import ButtonBlue from "./ButtonNormal.vue";
33+
import ButtonNormal from "./ButtonNormal.vue";
3534
import { ref, toRefs } from "vue";
3635
import { RequestFunction } from "../types/shared";
3736
import { FormField } from "../types/form";

src/components/ModalCreate.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
@cancel="$emit('update:modelValue', false)"
1717
@change="$emit('change', $event)"
1818
>
19-
<template #bottom>
20-
<slot name="bottom" />
19+
<template v-for="(_, name) in $slots" #[name]="slotData">
20+
<slot :name="name" v-bind="slotData" />
2121
</template>
2222
</FormGenerator>
2323
</ModalFree>

src/components/ModalForm.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
:title="title"
55
@update:model-value="$emit('update:modelValue', $event)"
66
>
7-
<p v-if="$slots.default" class="mb-5 text-sm text-gray-500 break-words">
8-
<slot />
9-
</p>
107
<FormGenerator
118
:fields="fields"
129
:data="data"
@@ -17,7 +14,11 @@
1714
@success="$emit('success', $event)"
1815
@cancel="$emit('update:modelValue', false)"
1916
@change="$emit('change', $event)"
20-
/>
17+
>
18+
<template v-for="(_, name) in $slots" #[name]="slotData">
19+
<slot :name="name" v-bind="slotData" />
20+
</template>
21+
</FormGenerator>
2122
</ModalFree>
2223
</template>
2324

src/components/ModalUpdate.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
@cancel="emit('update:modelValue', false)"
1717
@change="emit('change', $event)"
1818
>
19-
<template #bottom>
20-
<slot name="bottom" />
19+
<template v-for="(_, name) in $slots" #[name]="slotData">
20+
<slot :name="name" v-bind="slotData" />
2121
</template>
2222
</FormGenerator>
2323
</ModalFree>

src/views/ModalFormTest.vue

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,20 @@ const open = ref(true);
2020
2121
const fields: FormField[] = [
2222
{
23-
label: "Force Delete",
23+
label: "Options",
2424
name: "force_delete",
2525
type: "checkbox",
26-
helptext:
27-
"If this checkbox is set the content inside the data sheets will be deleted as well.",
26+
helptext: "These options add conditions on how to delete the object.",
27+
options: [
28+
{
29+
name: "Force Delete",
30+
value: "force_delete",
31+
},
32+
{
33+
name: "Delete Instantly",
34+
value: "delete_instantly",
35+
},
36+
],
2837
},
2938
];
3039
</script>

0 commit comments

Comments
 (0)