exportButton.vue 746 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <el-button
  3. type="primary"
  4. size="small"
  5. icon="el-icon-download"
  6. @click="exportFn"
  7. >{{btnName}}</el-button
  8. >
  9. </template>
  10. <script>
  11. import { exportTable } from '@/api/system/file/index.js';
  12. export default {
  13. props: {
  14. btnName: {
  15. type: String,
  16. default: '导出'
  17. },
  18. apiUrl: '',
  19. fileName: '',
  20. params: {
  21. default: () => {
  22. return {};
  23. }
  24. }
  25. },
  26. //注册组件
  27. data() {
  28. return {};
  29. },
  30. created() {},
  31. methods: {
  32. exportFn() {
  33. exportTable({
  34. api: this.apiUrl,
  35. fileName: this.fileName,
  36. data:this.params
  37. });
  38. }
  39. }
  40. };
  41. </script>
  42. <style lang="scss"></style>