Vue如何設(shè)置el-table背景透明樣式
【前言】
一般我們在使用ElementUI組件庫的時候,在使用el-table時,背景通常是白色的,但有時候不能滿足我們的實際需求,我想讓el-table背景變?yōu)橥该魃?,下面就來說一下如何實現(xiàn)。
【內(nèi)容】
說明:因為我們通常都是使用ElementUI庫的組件,這個組件庫是有自己的一套樣式的,所以要想實現(xiàn)自己想要的效果,難免要重寫樣式來實現(xiàn)。
重寫樣式需要加(>>> 或者 /deep/),不加的話是不會生效的。
1、在el-table外加div并自定義class
<div class="table" style="margin-top:20px;">
<el-table :data="tableData" :header-cell-style="getRowClass" >
<el-table-column label="a" type="index"></el-table-column>
<el-table-column label="b" prop="data"></el-table-column>
</el-table>
</div>
2、重寫css樣式
.table /deep/ .el-table th {
background-color: transparent!important;
}
.table /deep/ .el-table tr {
background-color: transparent!important;
}
.table /deep/ .el-table--enable-row-transition .el-table__body td, .el-table .cell{
background-color: transparent;
}
.el-table::before {//去除底部白線
left: 0;
bottom: 0;
width: 100%;
height: 0px;
}
到此這篇關(guān)于Vue如何設(shè)置el-table背景透明樣式的文章就介紹到這了,更多相關(guān)Vue el-table背景透明內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Vue3組件不發(fā)生變化如何監(jiān)聽pinia中數(shù)據(jù)變化
這篇文章主要給大家介紹了關(guān)于Vue3組件不發(fā)生變化如何監(jiān)聽pinia中數(shù)據(jù)變化的相關(guān)資料,pinia是Vue的存儲庫,它允許您跨組件/頁面共享狀態(tài),文中通過代碼介紹的非常詳細,需要的朋友可以參考下2023-11-11

