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

fix(BasicForm): setFieldsValue not work in form when use date comp #3819

Merged
merged 2 commits into from
May 9, 2024

Conversation

electroluxcode
Copy link
Contributor

@electroluxcode electroluxcode commented May 8, 2024

General

✏️ Mark the necessary items without changing the structure of the PR template.

  • Pull request template structure not broken

Type

ℹ️ What types of changes does your code introduce?

👉 Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

fix #3818

@electroluxcode electroluxcode marked this pull request as draft May 8, 2024 09:58
@electroluxcode electroluxcode marked this pull request as ready for review May 8, 2024 10:16
@electroluxcode
Copy link
Contributor Author

补一个用于测试的例子

<template>
  <Alert message="bug" />
  <BasicForm @register="registerCustom" class="my-5" />
  <Button @click="set">点我设置值</Button>
</template>

<script setup lang="ts">
  import { Alert, Button } from 'ant-design-vue';
  import { BasicForm, useForm } from '@/components/Form';
  import dayjs from 'dayjs';
  const [registerCustom, { getFieldsValue, setFieldsValue }] = useForm({
    baseColProps: { span: 24 },
    labelWidth: 124,
    schemas: [
      {
        field: '[startTime1, endTime1]',
        label: 'field1',
        component: 'RangePicker',
        componentProps: {
          placeholder: ['开始时间', '结束时间'],
          defaultValue: [dayjs('2024-12-01 11:11:11'), dayjs('2024-12-01 12:12:12')],
        },
      },{
        field: '[startTime2, endTime2]',
        label: '上架时间',
        
        component: 'TimeRangePicker',
        componentProps: {
          format: 'HH:mm:ss',
          placeholder: ['开始时间', '结束时间'],
          defaultValue: [dayjs('11:11:11',"HH:mm:ss"), dayjs('12:12:12',"HH:mm:ss")],
        },
      },
    ],
    showActionButtonGroup: true,
  });
  const set = () => {
    setFieldsValue({
      endTime1: '2028-12-01 12:12:12',
    });
    setFieldsValue({
      startTime2: dayjs('18:18:01',"HH:mm:ss"),
      endTime2: dayjs('19:19:01',"HH:mm:ss"),
    });
    console.log('getFieldsValue:', getFieldsValue());
  };
</script>

@wangjue666 wangjue666 merged commit 7538c57 into vbenjs:main May 9, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RangePicker field为数组时 , setFieldsValue不成功
2 participants