我试图有条件地把一个日期拖车放在一个装机箱中。 对我来说,我不清楚我为什么要让孩子们 no。
See playground
<script setup>
import { FormKitSchema } from "@formkit/vue";
import { ref, computed } from "vue";
const schema = [
{
$formkit: repeater ,
name: users ,
children: [
{
$formkit: text ,
name: email ,
// $index is available to children.
label: Email ,
},
{
$formkit: "checkbox",
name: "hasDate",
label: "Has date?",
},
{
$formkit: datepicker ,
name: date ,
if: $users[$index].$hadDate
}
],
}
];
const data = ref();
const handleSubmit = () => alert("Valid submit!");
</script>
<template>
<FormKit type="form" v-model="data" @submit="handleSubmit">
<FormKitSchema :schema="schema" :data="data" />
</FormKit>
<pre>
{{ data }}
</pre>
</template>