feat: 更新 all-custom 组件,增强提交功能并优化模板结构
This commit is contained in:
@ -1,8 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { text } from '@/__fk-inputs__/inputs/_demo_text';
|
import { text } from '@/__fk-inputs__/inputs/_demo_text';
|
||||||
|
import { FormKitNode } from '@formkit/core';
|
||||||
import Swal from 'sweetalert2';
|
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))
|
await new Promise(r => setTimeout(r, 500))
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Submitted! 🎉',
|
title: 'Submitted! 🎉',
|
||||||
@ -18,6 +24,7 @@ async function submit() {
|
|||||||
<template>
|
<template>
|
||||||
<Fieldset
|
<Fieldset
|
||||||
legend="Form 1"
|
legend="Form 1"
|
||||||
|
class="min-w-full"
|
||||||
pt:content:class="flex justify-center"
|
pt:content:class="flex justify-center"
|
||||||
>
|
>
|
||||||
<!-- https://formkit.com/inputs/form#props-attributes -->
|
<!-- https://formkit.com/inputs/form#props-attributes -->
|
||||||
@ -41,6 +48,7 @@ async function submit() {
|
|||||||
type="PInputText"
|
type="PInputText"
|
||||||
name="PInputText"
|
name="PInputText"
|
||||||
label="输入框"
|
label="输入框"
|
||||||
|
:value="`default value`.repeat(5)"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
some="prop"
|
some="prop"
|
||||||
validation="required"
|
validation="required"
|
||||||
@ -74,8 +82,14 @@ async function submit() {
|
|||||||
>
|
>
|
||||||
</FormKit>
|
</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 /> -->
|
<!-- <FormKitSummary /> -->
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="btn btn-primary"
|
||||||
|
>提交 ✨ </button>
|
||||||
</FormKit>
|
</FormKit>
|
||||||
</Fieldset>
|
</Fieldset>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user