gpt4 book ai didi

html - 更改最后一个表中的限制

转载 作者:行者123 更新时间:2023-11-28 06:51:59 25 4
gpt4 key购买 nike

我有下表

<table>
<TableHeader className="execution-head"/>
<tbody>
<tr className={this.props.className} onClick={this.handleClick}>
<th>{this.props.execution_id}</th>
<th>{this.props.launch_time}</th>
// more th's here
</tr>
<tr className={this.props.className} onClick={this.handleClick}>
<th>{this.props.execution_id}</th>
<th>{this.props.launch_time}</th>
// more th's here
</tr>
<tr>
<th>+</th>
</tr>
</tbody>
</table>

输出:

<table data-reactid=".1">
<thead data-reactid=".1.0">
<tr class="execution-head" data-reactid=".1.0.0">
<th data-reactid=".1.0.0.0">ID</th>
<th data-reactid=".1.0.0.1">Launch Time</th>
<th data-reactid=".1.0.0.5">Execution Time</th>
</tr>
</thead>
<tbody data-reactid=".1.1">
<tr class="execution-row" data-reactid=".1.1.0:$4x324">
<th data-reactid=".1.1.0:$4x324.0">4x324</th>
<th data-reactid=".1.1.0:$4x324.1">11.11.15 13:30</th>
<th data-reactid=".1.1.0:$4x324.5">2</th>
</tr>
<tr class="execution-row" data-reactid=".1.1.0:$4823748">
<th data-reactid=".1.1.0:$4823748.0">4823748</th>
<th data-reactid=".1.1.0:$4823748.1">13.11.15 13:30:25</th>
<th data-reactid=".1.1.0:$4823748.5">34</th>
<tr class="table-plus" data-reactid=".1.1.1">
<th data-reactid=".1.1.1.0">+</th>
</tr>
</tbody>
</table>

我想让最后一个 tr 元素占据表格的整个宽度,但从我尝试过的一切来看,它总是出错。

P.S 如果你想知道这是用 React 写的

最佳答案

计算一个变量中th的个数,比方说col_cnt然后在最后的 tr 中你可以这样写:

<tr>
<th colspan="{col_cnt}">+</th>
</tr>

关于html - 更改最后一个表中的限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33719775/

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