Skip to content

Commit

Permalink
test: 测试案例
Browse files Browse the repository at this point in the history
  • Loading branch information
aringlai committed Nov 23, 2023
1 parent b0cb740 commit 2d769f4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions cypress/component/useForm.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentType, EnumOption, FormSceneContext, doInitFields, doValidate, useForm, useSceneContext } from '@koala-form/core';
import { ComponentType, EnumOption, FormSceneContext, composeRender, doInitFields, doValidate, useForm, useSceneContext } from '@koala-form/core';
import { defineComponent, reactive, ref } from 'vue';

const Test = defineComponent({
Expand All @@ -13,10 +13,12 @@ const Test = defineComponent({
const vIf = ref(true);
const vShow = ref(true);

const name = { name: 'name', label: '姓名', props: { id: 'name' }, components: { name: ComponentType.Input } };

const form = useForm({
ctx: ctx as FormSceneContext,
fields: [
{ name: 'name', label: '姓名', props: { id: 'name' }, required: true, components: { name: ComponentType.Input } },
{ ...name, required: true },
{ name: 'sex', label: '性别', vIf, vShow, props: { id: 'sex' }, options: sexOptions, components: { name: ComponentType.Select } },
{
label: ' ',
Expand Down Expand Up @@ -68,7 +70,12 @@ const Test = defineComponent({
},
],
});
return form.render;

const form2 = useForm({
fields: [{ ...name, label: '姓名2' }],
});

return composeRender([form.render, form2.render]);
},
});

Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@koala-form/core",
"version": "2.0.3",
"version": "2.0.4",
"description": "基于Vue3的中后台表单解决方案",
"main": "dist/index.js",
"module": "dist/index.js",
Expand Down

0 comments on commit 2d769f4

Please sign in to comment.