no message

Former-commit-id: 87f96c930a1d89b148c01ac2401e13ff6a71d12e
Former-commit-id: 9d5e41f4b05c4b2c984d2f61f97e73279c200f5e
Former-commit-id: bbc175f9fc5af0f3b4557cb5082074757b2afa0f
This commit is contained in:
李杨
2018-02-15 14:24:28 +08:00
parent db8c0b2700
commit b1e4bd2b28

View File

@@ -1 +1,26 @@
> 解析 CSV 文件使用 [PapaParse](https://github.com/mholt/PapaParse)
解析 CSV 文件使用 [PapaParse](https://github.com/mholt/PapaParse)
```
// 导入插件
import papa from 'papaparse'
//在选择文件后处理数据
handleUpload (file) {
papa.parse(file, {
header: true,
skipEmptyLines: true,
complete: (results, file) => {
// 设置表格列
this.table.columns = Object.keys(results.data[0]).map(e => ({
label: e,
prop: e
}))
// 表格赋值
this.table.data = results.data
}
})
return false
}
```
> 详细的papaparse使用API请移步官网文档