Rap 原分销系统代码Web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45f40f4e1fa4a57a3a098467baa83c27f04ae2b6.svn-base 995B

5 kuukautta sitten
1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template>
  2. <div class="app-container">
  3. <upload-excel-component :on-success="handleSuccess" :before-upload="beforeUpload" />
  4. <el-table :data="tableData" border highlight-current-row style="width: 100%;margin-top:20px;">
  5. <el-table-column v-for="item of tableHeader" :key="item" :prop="item" :label="item" />
  6. </el-table>
  7. </div>
  8. </template>
  9. <script>
  10. import UploadExcelComponent from '@/components/UploadExcel/index.vue'
  11. export default {
  12. name: 'UploadExcel',
  13. components: { UploadExcelComponent },
  14. data() {
  15. return {
  16. tableData: [],
  17. tableHeader: []
  18. }
  19. },
  20. methods: {
  21. beforeUpload(file) {
  22. const isLt1M = file.size / 1024 / 1024 < 1
  23. if (isLt1M) {
  24. return true
  25. }
  26. this.$message({
  27. message: '请不要上传大于1m的文件.',
  28. type: 'warning'
  29. })
  30. return false
  31. },
  32. handleSuccess({ results, header }) {
  33. this.tableData = results
  34. this.tableHeader = header
  35. }
  36. }
  37. }
  38. </script>