1. 安装 npm install js-table2excel
const option = ref([
{ title: "名字", key: "name" },
{ title: "日期", key: "date" },
{ title: "状态", key: "state" },
]);
// 下载时间
const addfile = () => {
const tableDatas = JSON.parse(JSON.stringify(tableData.value)); //这里面填写你接口的数据
const datas = tableDatas;
table2excel(option.value, datas, "文档名称");
};