<template>
  <div>
    <el-button size="mini" type="primary" :icon="isIcon ? 'el-icon-download' : ''" @click="handleExport">{{
      exText
    }}</el-button>
  </div>
</template>

<script>
import { downloadFiles } from '@/utils/util'

export default {
  name: 'ExportButton',
  props: {
    exText: {
      type: String,
      default: '导出数据'
    },
    isIcon: {
      type: Boolean,
      default: true
    },
    exUrl: {
      type: String,
      default: ''
    },
    exParams: {
      type: Object,
      default: null
    }
  },
  methods: {
    handleExport() {
      downloadFiles(this.exUrl, this.exParams)
    }
  }
}
</script>

<style></style>
