springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-18 14:08:36
151
我正在重新访问学校课程作业的一个旧项目,但我一直得到一个未定义的网格变量的错误,用于生成我的网格。
我想循环查找行和列的数量,我想将属性存储在一个名为Grid的数组中。然后,我想用.map()显示数组中的行和列的节点。
虽然我对React很陌生,但似乎找不到为什么我不能访问render()中的网格数组。
class PathfinderGrid extends Component {
constructor(props) {
super(props)
this.state = {
grid: [],
};
}
componentDidMount() {
const grid = createGrid();
this.setState({ grid });
//console.log(this.state.grid)
}
render() {
return (
<div>
{grid.map((grid) => {
<div>{ grid }</div>
})}
</div >
);
}
}
const createGrid = () => {
let grid = [];
for (let row = 0; row < 15; row++) {
let currentRow = [];
for (let col = 0; col < 50; col++) {
currentRow.push();
}
grid.push(currentRow);
//console.log(grid);
}
return grid;
};
export default PathfinderGrid;
顺晟科技:
既然你正在使用类组件,我相信你需要写
{this.state.grid.map((grid) => {
return <div>{ grid }</div>
})}
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11