<template>
  <BasicUpload
    @register="registerModal"
    :maxSize="10"
    :maxNumber="5"
    @change="handleChange"
    :api="uploadApi"
    :uploadParams="uploadParams"
  />
</template>
<script lang="ts" setup>
  import { BasicUpload } from '/@/components/Upload';
  import { uploadApi } from '/@/api/common/index';
  import { useMessage } from '/@/hooks/web/useMessage';
  import { useModalInner } from '/@/components/Modal';
  import { ref } from 'vue';
  const { createMessage } = useMessage();
  const uploadParams = ref({});
  const [registerModal] = useModalInner(async data => {
    uploadParams.value = { configId: data.record.id };
  });

  function handleChange(list: string[]) {
    createMessage.info(`已上传文件${JSON.stringify(list)}`);
  }
</script>
