<th></th> 属性 rowspan/colspan


 <form id="myform">
	<table id="mydatatables" class="table table-striped table-bordered" style="table-layout:fixed"> 
		 <thead>
				 <!-- table样式需加入table-layout:fixed     统一标准   复选框:40   行次:50     长项(资产分类):200   中间项:150     短项:100     金额及数量:120 -->
					 <tr>
					       <th width="300px;"  rowspan="4">资产类别</th>
					       <th width="50px;"  rowspan="4">行次</th>
					        <th width="2904px;" colspan="24">合计</th>
					        <th width="2904px;" colspan="24">行政单位</th>
					        <th width="2904px;" colspan="24">事业单位</th>
					 </tr>
		</thead>
		<tbody>
		</tbody>
	</table>
 </form>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在这段代码中,`rows` 是通过循环判断计算得出的一个值,我们可以使用计算属性来获取它。 首先,在组件对象中定义一个计算属性 `rows`,在该属性的 getter 函数中进行循环判断并返回对应的值。例如: ```js import { defineComponent } from 'petite-vue'; const myComponent = defineComponent({ computed: { rows() { let count = 0; for (let item of this.data.list) { if (item.status === '1' && item.type === '附件') { count++; } } return count; } }, methods: { // ... }, data() { return { // ... }; } }); ``` 在上面的例子中,我们通过循环遍历 `data.list` 数组,统计满足条件的元素个数,并将其作为计算属性 `rows` 的值返回。 接下来,我们可以在模板中使用 `rows` 计算属性来设置 `<td>` 元素的 `rowspan` 属性。例如: ```html <table> <colgroup> <col width="20%"> <col width="40%"> <col width="40%"> </colgroup> <th> <td :colspan="rows">附件</td> </th> <tr> <td :rowspan="rows">附件</td> <td>名称</td> <td>数量</td> </tr> <tr v-for="(item, index) in data.list" v-show="item.status === '1' && item.type === '附件'"> <td><input type="text" v-model="item.info.名称"></td> <td><input type="text" v-model="item.info.数量"></td> <td><input type="button" value="删除" @click="del(index)"></td> </tr> <tr> <td colspan="3"> <input type="button" value="添加" @click="add3"> </td> </tr> </table> ``` 在上面的例子中,我们使用 `:rowspan="rows"` 将 `<td>` 元素的 `rowspan` 属性绑定到计算属性 `rows` 上,这样它的值就会自动更新并反映到模板中。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值