gpt4 book ai didi

javascript - 相同的表数据 rowspan html css

转载 作者:行者123 更新时间:2023-12-05 05:48:15 26 4
gpt4 key购买 nike

当我尝试用这样的数据构建一个表时我卡住了

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

当数据与数据索引 -1 相同时,我想进行 rowspan

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>

最佳答案

您使用的是原生 JavaScript 吗?我在 react.js 中编写了代码。你可以查看here

关于javascript - 相同的表数据 rowspan html css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70836543/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com