简体   繁体   English

同表数据rowspan html css

[英]same table data rowspan html css

i got stuck when im try to build a table with data like this当我尝试用这样的数据构建一个表时,我被卡住了

export const arr = [
{no : '1',
name: 'george',
fruit: 'orange'},
{no : '2',
name: 'jason',
fruit: 'orange'},
{no : '3',
name: 'david',
fruit: 'apple'},]

i want to rowspan when the data same with data index -1当数据与数据索引-1相同时,我想行跨度

import arr from './constant'

<table>
<tr>
<th>no</th>
<th>name</th>
<th>fruit</th>
</tr>
{arr.map((el)=>(
<tr>
<td>{el.no}</td>
<td>{el.name}</td>
<td rowspan={?????????}>{el.fruit}</td>
</tr>
))}
</table>

Are you using vanilla JavaScript?您使用的是香草 JavaScript 吗? I made the code in react.js.我在 react.js 中编写了代码。 You can check here你可以在这里查看

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM