diff --git a/playground/src/views/examples/form/basic.vue b/playground/src/views/examples/form/basic.vue index a92ec258..50a3caae 100644 --- a/playground/src/views/examples/form/basic.vue +++ b/playground/src/views/examples/form/basic.vue @@ -223,6 +223,102 @@ const [BaseForm, baseFormApi] = useVbenForm({ wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3', }); +const [CustomLayoutForm] = useVbenForm({ + // 所有表单项共用,可单独在表单内覆盖 + commonConfig: { + // 所有表单项 + componentProps: { + class: 'w-full', + }, + }, + layout: 'horizontal', + schema: [ + { + component: 'Input', + componentProps: { + placeholder: '请输入', + }, + fieldName: 'field1', + label: '字符串', + }, + { + component: 'Input', + componentProps: { + placeholder: '请输入', + }, + fieldName: 'field2', + label: '字符串', + }, + { + component: 'Input', + componentProps: { + placeholder: '请输入', + }, + fieldName: 'field3', + label: '字符串', + }, + { + component: 'Input', + componentProps: { + placeholder: '请输入', + }, + fieldName: 'field4', + label: '字符串', + }, + { + component: 'Input', + componentProps: { + placeholder: '请输入', + }, + fieldName: 'field5', + // 从第三列开始 相当于中间空了一列 + formItemClass: 'col-start-3', + label: '前面空了一列', + }, + { + component: 'Input', + componentProps: { + placeholder: '请输入', + }, + fieldName: 'field6', + // 占满三列空间 + formItemClass: 'col-span-3', + label: '占满三列', + }, + { + component: 'Input', + componentProps: { + placeholder: '请输入', + }, + fieldName: 'field7', + // 占满2列空间 从第二列开始 相当于前面空了一列 + formItemClass: 'col-span-2 col-start-2', + label: '占满2列', + }, + { + component: 'Input', + componentProps: { + placeholder: '请输入', + }, + fieldName: 'field8', + // 左右留空 + formItemClass: 'col-start-2', + label: '左右留空', + }, + { + component: 'Input', + componentProps: { + placeholder: '请输入', + }, + fieldName: 'field9', + formItemClass: 'col-start-1', + label: '占满2列', + }, + ], + // 一共三列 + wrapperClass: 'lg:grid-cols-3', +}); + function onSubmit(values: Record) { message.success({ content: `form values: ${JSON.stringify(values)}`, @@ -256,6 +352,7 @@ function handleSetFormValue() { + + +