mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-11 19:08:20 +00:00
Nice Form Validation Schema Support
This commit is contained in:
parent
66c60d8135
commit
edb7c09de3
1 changed files with 3 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
const props = defineModel<{
|
const props = defineModel<{
|
||||||
title: string
|
title: string
|
||||||
|
validationSchema: Record<string, string | Function>,
|
||||||
sections: {
|
sections: {
|
||||||
title: string
|
title: string
|
||||||
fields: {
|
fields: {
|
||||||
|
@ -19,12 +20,12 @@ const props = defineModel<{
|
||||||
discard: () => void,
|
discard: () => void,
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
let { sections, submit, discard } = $(props);
|
let { sections, submit, discard, validationSchema } = $(props);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<ValidationForm as="div" v-slot="{ values, handleSubmit }" @submit="submit">
|
<ValidationForm as="div" v-slot="{ values, handleSubmit }" @submit="submit" :validationSchema="validationSchema">
|
||||||
<template v-for="(section, index) in sections" :key="index">
|
<template v-for="(section, index) in sections" :key="index">
|
||||||
<h4 v-if="section.title">{{ section.title }}</h4>
|
<h4 v-if="section.title">{{ section.title }}</h4>
|
||||||
<div class="section">
|
<div class="section">
|
||||||
|
|
Loading…
Add table
Reference in a new issue