ImportModal 导入弹窗

包含模板下载的通用导入弹窗组件。

使用

<template>
<dg-import-modal :api="uploadFile" :template-file-url="templateFileUrl" title="导入excel" @success="handleSuccess">
  导入excel
</dg-import-modal>
</template>

<script setup lang="ts">
// 导入接口
const uploadFile = () => {}
// 模板下载地址
const templateFileUrl = ''

// 导入成功回调
const handleSuccess = (files, uid) => {
  console.log(files, uid)
}
</script>

trigger

<dg-import-modal :api="uploadFile" :template-file-url="templateFileUrl" title="导入excel" @success="handleSuccess">
  <template #trigger>
    <el-button type="danger">导入excel</el-button>
  </template>
</dg-import-modal>

Attributes

参数类型说明可选值默认值
apiFunction导入接口--
filenamestring调用api的传参属性-'file'
templateFileUrlstring导入模板下载地址--
isXhrDownloadboolean导入模板是否使用xhr下载, 传true要传入downloadTemplateApitrue、falsefalse
downloadTemplateApiFunction导入模板下载接口--
titlestring弹窗标题--

Slot

name说明参数
trigger触发打开弹窗的内容-

Events

事件名说明参数
success调用api接口导入成功后的回调事件files、uid
Last Updated:
Contributors: chwech