FWQ
React中如何实现循环创建div并添加行号?
在react中循环创建div时,想要添加行号,可以考虑以下设计: 左侧的索引可以设置为(absolute),右侧的方块可以设置为(relative),两者的父元素设置为相对定位且隐藏: 对应的代码如下: import react from "react"; import reactdom from "react-dom"; import "./styles.css"; function app() { const itemdata = new array(500).fill(0); const indexdata = new array(20).fill(0); return (…