Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Form的layout值为vertical时,labelClass参数失效 #4675

Closed
5 tasks done
Pro-linx opened this issue Oct 18, 2024 · 0 comments · Fixed by #4680
Closed
5 tasks done

Bug: Form的layout值为vertical时,labelClass参数失效 #4675

Pro-linx opened this issue Oct 18, 2024 · 0 comments · Fixed by #4680

Comments

@Pro-linx
Copy link

Version

Vben Admin V5

Describe the bug?

Form的layout值为vertical时,labelClass参数失效

Reproduction

<script lang="ts" setup>
import { Page } from '@vben/common-ui';

import { Button, Card, message } from 'ant-design-vue';

import { useVbenForm, z } from '#/adapter/form';

const [Form, formApi] = useVbenForm({
  commonConfig: {
    componentProps: {
      class: 'w-full',
    },
  },
  handleSubmit: onSubmit,
  layout: 'vertical',
  schema: [
    {
      component: 'Input',
      componentProps: {
        placeholder: '请输入',
      },
      fieldName: 'field1',
      label: '字段1',
      labelClass: 'mb-2',
      rules: 'required',
    },
  ],
  wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3',
});

function onSubmit(values: Record<string, any>) {
  message.success({
    content: `form values: ${JSON.stringify(values)}`,
  });
}
</script>

<template>
  <Page description="表单校验示例" title="表单组件">
    <Card title="基础组件校验示例">
      <template #extra>
        <Button @click="() => formApi.validate()">校验表单</Button>
        <Button class="mx-2" @click="() => formApi.resetValidate()">
          清空校验信息
        </Button>
      </template>
      <Form />
    </Card>
  </Page>
</template>

System Info

/

Relevant log output

No response

Validations

@github-actions github-actions bot locked and limited conversation to collaborators Nov 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant