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]当upload的值在两个以上,使用默认的删除会将列表清空 #3867

Closed
3 tasks done
electroluxcode opened this issue May 24, 2024 · 0 comments · Fixed by #3872
Closed
3 tasks done

Comments

@electroluxcode
Copy link

electroluxcode commented May 24, 2024

⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.

  • Read the docs.
  • Make sure the code is up to date. (Some bugs have been fixed in the latest code)
  • This is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.

Describe the bug

当upload的值在两个以上。预期是该行的删除就删除该行的数据,但是目前使用previewModal会将列表清空。

定位问题是在没有显式绑定 handleFn 的 key值。显式绑定即可,等一下会提交pr

Reproduction

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

<script setup lang="ts">
  import { Alert } from 'ant-design-vue';
  import { BasicForm, FormSchema, useForm } from '@/components/Form';
  import { useMessage } from '@/hooks/web/useMessage';
  import { uploadApi } from '@/api/sys/upload';

  const { createMessage } = useMessage();

  const schemasValiate: FormSchema[] = [
    {
      field: 'field1',
      component: 'Upload',
      label: '字段1',
      defaultValue:["https://avatars.githubusercontent.com/u/59329360?v=4","http://localhost:5173/src/assets/images/logo.png"],
      componentProps: {
        api: uploadApi,
        maxNumber:3
      
      },
    
    },
  ];
  const [registerValiate, { getFieldsValue: getFieldsValueValiate, validate }] = useForm({
    labelWidth: 160,
    schemas: schemasValiate,
    actionColOptions: {
      span: 18,
    },
    submitFunc: () => {
      return new Promise((resolve) => {
        validate()
          .then(() => {
            resolve();
            console.log(getFieldsValueValiate());
            createMessage.success(`请到控制台查看结果`);
          })
          .catch(() => {
            createMessage.error(`请输入必填项`);
          });
      });
    },
  });
</script>

@electroluxcode electroluxcode changed the title 当upload的值在两个以上,使用默认的删除会将列表清空 [BUG]当upload的值在两个以上,使用默认的删除会将列表清空 May 24, 2024
@vbenjs vbenjs locked and limited conversation to collaborators Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant