element table表格表头显示斜杠/斜线

<el-table
   :data="form.tableData"
   ref="table"
   tooltip-effect="dark"
   border
   height="100%"
   @selection-change='selectRow'>
   <el-table-column
      label="项目"
      align="right">
      <el-table-column
         prop="name"
         label="数量">
         <el-table-column
            width="150"
            prop="month"
            label="月份">
            <template slot-scope="scope">
                <el-form-item :prop="'tableData.' + scope.$index + '.taskCode'">
                   <el-input 
                      v-model="scope.row.new_exceptQuota" 
                      :disabled="requestStatus == 'detail'" 
                      clearable>
                   </el-input>
                </el-form-item>
             </template>
         </el-table-column>
      </el-table-column>
   </el-table-column>
   <el-table-column
      label="右侧大标题"
      align="center"
      :key="item">
      <el-table-column
         label="第二行第一列"
         align="center">
         <template slot-scope="scope">
            <el-form-item  :prop="'tableData.' + scope.$index + '.taskCode'">
               <el-input 
                    v-model="scope.row.new_exceptQuota" 
                    :disabled="requestStatus == 'detail'" 
                    clearable>
               </el-input>
             </el-form-item>
         </template>
      </el-table-column>


      //多个<el-table-column></el-table-column>


   </el-table-column>
</el-table>

样式部分:

/deep/ .el-table th{
	overflow: initial;
}
/deep/ .el-table thead tr:first-of-type th:first-of-type,
/deep/ .el-table thead tr:nth-of-type(2) th:first-of-type{
	border-bottom: none;
}
/deep/ .el-table thead tr:first-of-type th:first-of-type .cell{
	text-align: right;
}
/deep/ .el-table thead tr:nth-of-type(2) th:first-of-type .cell{
	padding-left: 0;
}
/deep/ .el-table thead tr:last-of-type th:first-of-type .cell{
	text-align: left;
}
/deep/ .el-table thead tr:first-of-type th:first-of-type:before,
/deep/ .el-table thead tr:last-of-type th:first-of-type:before{
	content: '';
	position: absolute;
	width: 1px;
	background-color: #666;
	display: block;
}
/deep/ .el-table thead tr:first-of-type th:first-of-type:before {
	height: 198px; //根据情况调整
	top: 0; 
	left: 39px;  //根据情况调整
	transform: rotate(-34deg);  //根据情况调整
	transform-origin: top;
	z-index: 2;
}
/deep/ .el-table thead tr:last-of-type th:first-of-type:before {
	height: 183px;  //根据情况调整
	bottom: 0;
	right: 0;  //根据情况调整
	transform: rotate(-54deg);  //根据情况调整
	transform-origin: bottom;
}

完成效果:

### 修改 `el-table` 表头边框为圆角样式 为了实现 `el-table` 表头的边框圆角效果,可以采用自定义 CSS 来覆盖默认样式。具体方法如下: #### 方法一:使用全局样式文件 可以在项目的全局样式文件中添加特定的选择器来调整表头单元格的 `border-radius` 属性。 ```css /* 自定义表头单元格的圆角 */ .el-table th.is-leaf { border-top-left-radius: 8px; border-top-right-radius: 8px; } ``` 对于首列的特殊处理,可以通过增加额外的选择器来确保仅对该列应用圆角效果[^1]。 ```css /* 针对首列的第一个和最后一个th元素设置不同的圆角半径 */ .el-table .cell:first-child { border-bottom-left-radius: 8px !important; } .el-table thead tr th:nth-last-of-type(2) { border-bottom-right-radius: 8px !important; } ``` #### 方法二:内联样式或 scoped 样式 如果希望作用范围更局限,则可以直接在组件内部通过 `<style scoped>` 定义局部样式,或者利用 inline-style 方式指定单个表格实例上的样式。 需要注意的是,在移除不需要的边框线条方面,可能还需要重置一些默认属性以防止多余的边框显现出来[^2]。 ```css /* 移除整个表格以及各部分之间的内外边距与间距 */ .el-table, .el-table__expanded-cell { border: none; } .el-table td, .el-table th.is-leaf { border-bottom: none; } ``` 上述代码片段展示了如何有效地去除不必要的边框并设定所需的圆角效果。
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值