diff --git a/src/views/example/table/complexTable.vue b/src/views/example/table/complexTable.vue
index 04b808d2..4c126aa6 100644
--- a/src/views/example/table/complexTable.vue
+++ b/src/views/example/table/complexTable.vue
@@ -17,7 +17,7 @@
搜索
添加
- 导出
+ 导出
显示审核人
@@ -196,7 +196,8 @@ export default {
type: [{ required: true, message: 'type is required', trigger: 'change' }],
timestamp: [{ type: 'date', required: true, message: 'timestamp is required', trigger: 'change' }],
title: [{ required: true, message: 'title is required', trigger: 'blur' }]
- }
+ },
+ downloadLoading: false
}
},
filters: {
@@ -330,12 +331,13 @@ export default {
})
},
handleDownload() {
- require.ensure([], () => {
- const { export_json_to_excel } = require('@/vendor/Export2Excel')
+ this.downloadLoading = true
+ import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['时间', '地区', '类型', '标题', '重要性']
const filterVal = ['timestamp', 'province', 'type', 'title', 'importance']
const data = this.formatJson(filterVal, this.list)
- export_json_to_excel(tHeader, data, 'table数据')
+ excel.export_json_to_excel(tHeader, data, 'table数据')
+ this.downloadLoading = false
})
},
formatJson(filterVal, jsonData) {
diff --git a/src/views/excel/exportExcel.vue b/src/views/excel/exportExcel.vue
index 13359a2d..63e75764 100644
--- a/src/views/excel/exportExcel.vue
+++ b/src/views/excel/exportExcel.vue
@@ -60,13 +60,12 @@ export default {
},
handleDownload() {
this.downloadLoading = true
- require.ensure([], () => {
- const { export_json_to_excel } = require('@/vendor/Export2Excel')
+ import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['序号', '文章标题', '作者', '阅读数', '发布时间']
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
const list = this.list
const data = this.formatJson(filterVal, list)
- export_json_to_excel(tHeader, data, this.filename)
+ excel.export_json_to_excel(tHeader, data, this.filename)
this.downloadLoading = false
})
},
diff --git a/src/views/excel/selectExcel.vue b/src/views/excel/selectExcel.vue
index 43a90f1f..cc3e2fe3 100644
--- a/src/views/excel/selectExcel.vue
+++ b/src/views/excel/selectExcel.vue
@@ -66,16 +66,15 @@ export default {
handleDownload() {
if (this.multipleSelection.length) {
this.downloadLoading = true
- require.ensure([], () => {
- const { export_json_to_excel } = require('@/vendor/Export2Excel')
- const tHeader = ['序号', '文章标题', '作者', '阅读数', '发布时间']
- const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
- const list = this.multipleSelection
- const data = this.formatJson(filterVal, list)
- export_json_to_excel(tHeader, data, this.filename)
- this.$refs.multipleTable.clearSelection()
- this.downloadLoading = false
- })
+ import('@/vendor/Export2Excel').then(excel => {
+ const tHeader = ['序号', '文章标题', '作者', '阅读数', '发布时间']
+ const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
+ const list = this.multipleSelection
+ const data = this.formatJson(filterVal, list)
+ excel.export_json_to_excel(tHeader, data, this.filename)
+ this.$refs.multipleTable.clearSelection()
+ this.downloadLoading = false
+ })
} else {
this.$message({
message: '请至少选择一条记录',
diff --git a/src/views/zip/index.vue b/src/views/zip/index.vue
index 02abd103..98c3d7ad 100644
--- a/src/views/zip/index.vue
+++ b/src/views/zip/index.vue
@@ -59,13 +59,12 @@ export default {
},
handleDownload() {
this.downloadLoading = true
- require.ensure([], () => {
- const { export_txt_to_zip } = require('@/vendor/Export2Zip')
+ import('@/vendor/Export2Zip').then(zip => {
const tHeader = ['序号', '文章标题', '作者', '阅读数', '发布时间']
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
const list = this.list
const data = this.formatJson(filterVal, list)
- export_txt_to_zip(tHeader, data, this.filename, this.filename)
+ zip.export_txt_to_zip(tHeader, data, this.filename, this.filename)
this.downloadLoading = false
})
},