Table 表格


本组件标签类似HTML的table表格,由table、tr、th、td四个组件组成

table 组件裹在最外层,可以配置一些基础参数

tr 组件用于显示"行"数据

th 组件用于显示表头内容,类似td,不同之处在于字体加粗了,也带有背景颜色,也可以直接用td替代th

td组件不是最小单位,为了合并单元格时,内部可以嵌入 tr 和 td 组件

效果图

在这里插入图片描述


Template 文件

<view class="table_box">
	<u-table>
                 <u-tr>
			<u-td width="25%">车辆种类</u-td>
			<u-td width="75%" class="box_br box_pd">
				<u-td width="80%" class="box_cus">月折旧系数</u-td>
                         <u-tr>
                         	<u-td class="box_bt">家庭自用</u-td>
                         	<u-td class="box_bt">非营业</u-td>
					<u-td width="50%" class="box_bt box_pd box_br">
						<u-td class="box_cus">营业</u-td>
						<u-tr >
							<u-td class="box_bt box_cus">1.10%</u-td>
							<u-td class="box_bt box_cus">0.90%</u-td>
						</u-tr>
					</u-td>
                         </u-tr>
			</u-td>	
		</u-tr>
                 <u-tr>
                 	<u-td class="box_cus" width="25%">9座以下客车</u-td>
                 	<u-td class="box_cus">0.60%</u-td>
                 	<u-td class="box_cus">0.60%</u-td>
                 	<u-td class="box_cus">1.10%</u-td>
                 	<u-td class="box_cus">0.90%</u-td>
                 </u-tr>
                 <u-tr>
                 	<u-td class="box_cus" width="25%">10座以下上客车</u-td>
                 	<u-td class="box_cus">0.90%</u-td>
                 	<u-td class="box_cus">0.90%</u-td>
                 	<u-td class="box_cus">1.10%</u-td>
                 	<u-td class="box_cus">0.90%</u-td>
                 </u-tr>
                 <u-tr>
                 	<u-td class="box_cus" width="25%">微型载货汽车</u-td>
                 	<u-td class="box_cus">/</u-td>
                 	<u-td class="box_cus">0.90%</u-td>
                 	<u-td class="box_cus">1.10%</u-td>
                 	<u-td class="box_cus">1.10%</u-td>
                 </u-tr>
                 <u-tr>
                 	<u-td class="box_cus" width="25%">带拖挂的载货汽车</u-td>
                 	<u-td class="box_cus">/</u-td>
                 	<u-td class="box_cus">0.90%</u-td>
                 	<u-td class="box_cus">1.10%</u-td>
                 	<u-td class="box_cus">1.10%</u-td>
                 </u-tr>
                 <u-tr>
                 	<u-td class="box_cus" width="25%">低速货车和三轮汽车</u-td>
                 	<u-td class="box_cus">/</u-td>
                 	<u-td class="box_cus">1.10%</u-td>
                 	<u-td class="box_cus">1.40%</u-td>
                 	<u-td class="box_cus">1.40%</u-td>
                 </u-tr>
                 <u-tr>
                 	<u-td class="box_cus" width="25%">其他车辆</u-td>
                 	<u-td class="box_cus">/</u-td>
                 	<u-td class="box_cus">0.90%</u-td>
                 	<u-td class="box_cus">1.10%</u-td>
                 	<u-td class="box_cus">0.90%</u-td>
                 </u-tr>
	</u-table>
</view>

Style 文件

.table_box{
	.box_bt{
		border-bottom: unset !important;
	}
	.box_pd{
		padding: unset !important;
	}
	.box_br{
		border-right: unset !important;
	}
	.box_cus{
		padding: 10px 3px !important;
	}
	/deep/ .u-td[data-v-35ace0c0]{
		height: auto;
	}
}
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐