no message
Former-commit-id: 684be8262ac4ab6c8c1657b30a36ab77106a0f4e Former-commit-id: 3d4da83c6d5a2a6dbfdbf87f205aad3e88660df0 Former-commit-id: 8c8b222f8eeac2d47af25cf3e5dd860b85076b9a
This commit is contained in:
65
src/pages/demo/plugins/export/table.vue
Normal file
65
src/pages/demo/plugins/export/table.vue
Normal file
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<Container>
|
||||
<PageHeader
|
||||
slot="header"
|
||||
title="基本示例">
|
||||
</PageHeader>
|
||||
<div class="dd-mb">
|
||||
<el-button @click="exportCsv">
|
||||
<Icon name="download"></Icon>
|
||||
导出CSV
|
||||
</el-button>
|
||||
<el-button @click="exportExcel">
|
||||
<Icon name="download"></Icon>
|
||||
导出Excel
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table v-bind="table" style="width: 100%" class="dd-mb">
|
||||
<el-table-column
|
||||
v-for="(item, index) in table.columns"
|
||||
:key="index"
|
||||
:prop="item.prop"
|
||||
:label="item.label">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<Markdown url="/static/markdownFiles/article/插件 - 导出数据.md"></Markdown>
|
||||
</Container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 假数据
|
||||
import table from './data'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
table: {
|
||||
columns: table.columns,
|
||||
data: table.data,
|
||||
size: 'mini',
|
||||
stripe: true,
|
||||
border: true
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
exportCsv (params = {}) {
|
||||
this.$export.csv({
|
||||
columns: this.table.columns,
|
||||
data: this.table.data
|
||||
})
|
||||
.then(() => {
|
||||
this.$message('导出CSV成功')
|
||||
})
|
||||
},
|
||||
exportExcel () {
|
||||
this.$export.excel({
|
||||
columns: this.table.columns,
|
||||
data: this.table.data
|
||||
})
|
||||
.then(() => {
|
||||
this.$message('导出表格成功')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user