Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b3b4e2b

Browse files
author
Lionel Bijaoui
committed
Custom errors
- Possibility to use scoped-slot to customise fully how errors are build - Expose `errors` object, `field` object and `getValueFromOption` function
1 parent 252eadb commit b3b4e2b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎projects/full/app.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,34 @@
2323
</div>
2424
</div>
2525
<vue-form-generator :schema="schema" :model="model" :options="formOptions" :multiple="selected.length > 1" ref="form" :is-new-model="isNewModel" @model-updated="modelUpdated" @validated="onValidated">
26+
2627
<template slot="label" slot-scope="{ field }">
2728
<h1>Custom label : {{ field.label }}</h1>
2829
</template>
30+
2931
<template slot="help" slot-scope="{ field }">
3032
<span v-if='field.help' class="help">
3133
<span @click.prevent="testClick(field.help, $event)">Custom help</span>
3234
<i class="icon"></i>
3335
<!-- <div class="helpText-" v-html='field.help'></div> -->
3436
</span>
3537
</template>
38+
3639
<template slot="hint" slot-scope="{ field, getValueFromOption }">
3740
<span>Custom hint</span>
3841
<div class="hint" v-html="getValueFromOption(field, 'hint', undefined)"></div>
3942
</template>
43+
44+
<template slot="errors" slot-scope="{ errors, field, getValueFromOption }">
45+
<table class="errors help-block">
46+
<tbody>
47+
<tr>
48+
<td v-for="(error, index) in errors" :key="index" v-html="error"></td>
49+
</tr>
50+
</tbody>
51+
</table>
52+
</template>
53+
4054
</vue-form-generator>
4155
</div>
4256
<div class="col-md-6">

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /