feat: 更新 all-custom 组件,增强提交功能并优化模板结构
All checks were successful
/ test (push) Successful in 28s
/ surge (push) Successful in 45s

This commit is contained in:
严浩
2024-11-25 13:22:39 +08:00
parent 5511685f18
commit d7058af64c

View File

@ -1,8 +1,14 @@
<script setup lang="ts">
import { text } from '@/__fk-inputs__/inputs/_demo_text';
import { FormKitNode } from '@formkit/core';
import Swal from 'sweetalert2';
async function submit() {
async function submit(formData: Record<string, any>, formNode: FormKitNode) {
console.group('submit');
console.log('formData :>> ', formData);
console.log('formNode :>> ', formNode);
console.groupEnd();
await new Promise(r => setTimeout(r, 500))
Swal.fire({
title: 'Submitted! 🎉',
@ -18,6 +24,7 @@ async function submit() {
<template>
<Fieldset
legend="Form 1"
class="min-w-full"
pt:content:class="flex justify-center"
>
<!-- https://formkit.com/inputs/form#props-attributes -->
@ -41,6 +48,7 @@ async function submit() {
type="PInputText"
name="PInputText"
label="输入框"
:value="`default value`.repeat(5)"
placeholder="请输入"
some="prop"
validation="required"
@ -74,8 +82,14 @@ async function submit() {
>
</FormKit>
<pre class="font-mono text-sm p-4 bg-slate-100 mb-4 dark:bg-gray-900 ">{{ value }}</pre>
<pre class="font-mono text-sm p-4 bg-slate-100 mb-4 dark:bg-gray-900 overflow-x-auto rounded-md shadow-inner dark:text-gray-300
">{{ value }}</pre>
<!-- <FormKitSummary /> -->
<button
type="submit"
class="btn btn-primary"
>提交 </button>
</FormKit>
</Fieldset>