1、安装
npm install js-table2excel
2、使用
import table2excel from 'js-table2excel'
const column = [
{
title: 'ID',
key: 'id',
type: 'text'
},
{
title: '名字',
key: 'name',
type: 'text'
},
{
title: '图片',
key: 'image',
type: 'image'
},
]
const datas = [
{id:1, name: '八点博客1',image: 'http://1.png'},
{id:2, name: '八点博客2',image: 'http://2.png'},
]; //表单数据
const excelName = '八点博客' //文件名称
table2excel(column, datas, excelName)
发表评论 取消回复