初始化

This commit is contained in:
2026-02-22 18:56:10 +08:00
commit 26677972a6
3112 changed files with 255972 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
<script setup lang="ts">
import type { Recordable } from '@easyflow/types';
import type { EasyFlowFormSchema } from '@easyflow-core/form-ui';
import { computed, reactive } from 'vue';
import { useEasyFlowForm } from '@easyflow-core/form-ui';
import { EasyFlowButton } from '@easyflow-core/shadcn-ui';
interface Props {
formSchema?: EasyFlowFormSchema[];
buttonText?: string;
buttonLoading?: boolean;
}
const props = withDefaults(defineProps<Props>(), {
formSchema: () => [],
buttonText: '更新密码',
buttonLoading: false,
});
const emit = defineEmits<{
submit: [Recordable<any>];
}>();
const [Form, formApi] = useEasyFlowForm(
reactive({
commonConfig: {
// 所有表单项
componentProps: {
class: 'w-full',
},
},
layout: 'vertical',
schema: computed(() => props.formSchema),
showDefaultActions: false,
}),
);
async function handleSubmit() {
const { valid } = await formApi.validate();
const values = await formApi.getValues();
if (valid) {
emit('submit', values);
}
}
defineExpose({
getFormApi: () => formApi,
});
</script>
<template>
<div class="mx-auto max-w-[360px] pt-12">
<Form />
<EasyFlowButton
:loading="buttonLoading"
type="submit"
class="mx-auto mt-4 block h-8 w-[106px] p-0"
@click="handleSubmit"
>
{{ buttonText }}
</EasyFlowButton>
</div>
</template>