Files
mes-ui-d2/static/markdownFiles/article/插件 - 导出数据.md
李杨 7ffb4d6445 no message
Former-commit-id: 3c55ba008e993d03cad81accd7b6949a2fc107f4
Former-commit-id: 6b020867895f8d9cc9a32c9e3ad9739807e990bc
Former-commit-id: 9a98dd7eb7d6a87466c23a91f1fef217d06f3c16
2018-02-10 23:07:32 +08:00

63 lines
898 B
Markdown

# 导出数据
## 使用
### 注册插件
```
import pluginExport from '@/plugin/export'
Vue.use(pluginExport)
```
### 导出 `CSV`
使用方法
```
this.$export.csv({
columns,
data
})
.then(data => {
// ...可选回调
})
```
参数
| 参数名 | 介绍 | 必选 | 值类型 | 可选值 | 默认值 |
| --- | --- | --- | --- | --- | --- |
| columns | 列 | 非 | Array | | 空数组 |
| data | 行数据 | 非 | Array | | 空数组 |
| noHeader | 不导出表头 | 非 | Boolean | | false |
| separator | 数据分隔符 | 非 | String | | , |
| quoted | 每项数据是否加引号 | 非 | Boolean | | false |
示例
```
const columns = [
{
label: '姓名',
prop: 'name'
},
{
label: '年龄',
prop: 'age'
}
]
const data = [
{
name: 'lucy',
age: 24
},
{
name: 'bob',
age: 26
}
]
this.$export.csv({
columns,
data
})
```