reactjs - 尝试添加下载按钮
问题描述
我正在一个项目中工作,我正在尝试添加一个下载按钮,但我找不到方法。我正在显示要添加按钮的部分代码。
axios.post("/notas",data)
.then(response => {
//console.log(response.data);
const cols = [];
const rows = [];
response.data.columns.forEach((col,index)=>{
cols.push({
title: col,
dataIndex:col.toLowerCase(),
key:col.toLoweSrCase()
button: <button onClick={activateLasers}> Activate Lasers
</button>
})
});
console.log(cols);
response.data.data.forEach((row,index)=>{
let newRow = {key:index+1};
row.forEach((elem,index)=> {
//console.log(cols[index]);
newRow[cols[index].key] = elem;
});
rows.push(newRow);
});
console.log(rows);
this.setState({
loading:false,
notas:{
columns:cols,
dataSource:rows
},
deleted: false
})
console.log(this.state.notas.dataSource);
})
.catch(err => {
this.setState({loading:false});
console.log(err);
});
}
这是我要添加按钮的部分。感谢您的回答
解决方案
推荐阅读
- continuous-integration - DevOps 和 CI/CD 新手
- python - 在 Python 中使用 Pygame 移动精灵
- java - 如何更改 PApplet GLabel 中的文本颜色
- ruby-on-rails - 使用 capistrano 部署时,Ruby on Rails “KeyError:找不到密钥”
- python - 如何从numpy数组中获取N条记录?
- ruby - RSpec - 如何修复 - ArgumentError:参数数量错误(给定 0,预期为 1) - Ruby
- graphql - graphql sequlize 数据加载器问题,无法为不可为空的字段返回 null
- mysql - 如何显示没有特定值的行?
- r - R中的外部函数调用(arg 1)中的NA / NaN / Inf
- javascript - 在 Angular 中使用 ngFor 在 div 之间画一条线