Skip to content

Commit 13fa07f

Browse files
author
Lionel Bijaoui
committed
Add Help in form-group
- Use custom slot - Expose `group` in slot prop - Update example
1 parent 574ca9a commit 13fa07f

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

dev

Submodule dev updated from 8080b9f to 4dfea5d

src/formGenerator.vue

+17
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@
99
:options="options"
1010
:errors="errors"
1111
:event-bus="eventBus">
12+
<template
13+
slot="group-help"
14+
slot-scope="{ group }">
15+
<slot
16+
name="group-help"
17+
:group="group">
18+
<span
19+
v-if='group.help'
20+
class="help">
21+
<i class="icon"></i>
22+
<div
23+
class="helpText"
24+
v-html='group.help'></div>
25+
</span>
26+
</slot>
27+
</template>
28+
1229
<template
1330
slot="element"
1431
slot-scope="slotProps">

src/formGroup.vue

+11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
ref="group">
66

77
<legend v-if="groupLegend">{{ groupLegend }}</legend>
8+
<slot
9+
name="group-help"
10+
:group="group"></slot>
811
<template v-for="(field, index) in fields">
912
<template v-if="fieldVisible(field)">
1013
<template v-if="field.type === 'group'">
@@ -16,6 +19,14 @@
1619
:errors="errors"
1720
:event-bus="eventBus"
1821
:key="index">
22+
<template
23+
slot="group-help"
24+
slot-scope="slotProps">
25+
<slot
26+
name="group-help"
27+
:group="slotProps.group"></slot>
28+
</template>
29+
1930
<template slot="element"
2031
slot-scope="slotProps">
2132
<slot name="element"

0 commit comments

Comments
 (0)