export-button.vue 655 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <template>
  2. <div>
  3. <el-button size="mini" type="primary" :icon="isIcon ? 'el-icon-download':''" @click="handleExport">{{exText}}</el-button>
  4. </div>
  5. </template>
  6. <script>
  7. import { downloadFiles } from '@/utils/util'
  8. export default {
  9. name: 'ExportButton',
  10. props: {
  11. exText: {
  12. type: String,
  13. default: '导出数据'
  14. },
  15. isIcon: {
  16. type: Boolean,
  17. default: true
  18. },
  19. exUrl: {
  20. type: String,
  21. default: '',
  22. },
  23. exParams: {
  24. type: Object,
  25. default: null
  26. }
  27. },
  28. methods: {
  29. handleExport() {
  30. downloadFiles(this.exUrl, this.exParams);
  31. }
  32. }
  33. }
  34. </script>
  35. <style>
  36. </style>