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

feat(form->prefix & suffix):Adapt functions #3849

Closed

Conversation

electroluxcode
Copy link
Contributor

@electroluxcode electroluxcode commented May 16, 2024

,ra### 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

考虑到可能有如下需求:
prefix 和 suffix 根据 formModel等值进行事件和状态的处理

因此在保留原来行为的前提中添加可以通过传入function中定义prefix 和 suffix

最小实例如下:

<template>
  <Alert message="bug" />
  <BasicForm @register="registerCustom" class="my-5" />
</template>

<script setup lang="ts">
  import { Alert } from 'ant-design-vue';
  import { BasicForm, useForm } from '@/components/Form';
  import { h } from 'vue';
  import { Button } from 'ant-design-vue';
  const [registerCustom] = useForm({
    baseColProps: { span: 24 },
    labelWidth: 124,
    schemas: [
      {
        field: 'field3',
        label: 'label',
        component: 'Input',
        prefix:({formModel})=>{
          return h(Button,{
            onClick:()=>{
              console.log("formModel:",formModel["field3"])
            }
          },"开始测试")
        }
      },
    ],
  });

 
</script>

@electroluxcode electroluxcode marked this pull request as draft May 16, 2024 09:16
@electroluxcode electroluxcode changed the title feat(form):add prefix & suffix to componentsprop feat(form->prefix & suffix):Adapt functions May 16, 2024
@electroluxcode electroluxcode marked this pull request as ready for review May 16, 2024 10:08
@electroluxcode electroluxcode marked this pull request as draft May 16, 2024 10:16
@electroluxcode
Copy link
Contributor Author

发现prefix和suffix已经适配方法了..

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.

None yet

1 participant