Vue?ElementUI?table實現(xiàn)表格斜線分隔線
本文實例為大家分享了Vue ElementUI table給表格一個斜線分隔線的具體代碼,供大家參考,具體內(nèi)容如下
效果:
實現(xiàn):
通過改css樣式實現(xiàn)
1、去掉第一個單元格的下邊框/
2、第一列第一個單元格和第二個單元格的偽元素設(shè)置絕對定位,寬度設(shè)成1px,高度根據(jù)自己表格調(diào)整
3、通過旋轉(zhuǎn)兩個單元格偽元素,并設(shè)置旋轉(zhuǎn)起始點(diǎn),使兩個偽元素旋轉(zhuǎn)到重合位置,達(dá)到斜線的效果
代碼:
1、html
<el-table ? ? :data="tableData3" ? ? style="width: 100%"> ? ? <el-table-column ? ? ? label="醫(yī)療機(jī)構(gòu)" ? ? ? align="right" ? ? ? width="150"> ? ? ? ?<el-table-column ? ? ? ? prop="name" ? ? ? ? label="收費(fèi)項目" ? ? ? ? width="120"> ? ? ? </el-table-column> ? ? </el-table-column> ? ? ? <el-table-column ? ? ? ? v-for="(item,index) of mechanism" ? ? ? ? :label="item" ? ? ? ? align="center" ? ? ? ? :key="item" ? ? ? ? width="120"> ? ? ? ? <el-table-column ? ? ? ? ? label="次數(shù)" ? ? ? ? ? align="center" ? ? ? ? ? width="120"> ? ? ? ? ? <template slot-scope="scope"> ? ? ? ? ? ? {{scope.row.mechanism[index].frequency}} ? ? ? ? </template> ? ? ? ? </el-table-column> ? ? ? ? <el-table-column ? ? ? ? ? label="費(fèi)用" ? ? ? ? ? align="center" ? ? ? ? ? width="120"> ? ? ? ? ? <template slot-scope="scope"> ? ? ? ? ? ? {{scope.row.mechanism[index].cost}} ? ? ? ? </template> ? ? ? ? </el-table-column> ? ? ? </el-table-column> ? </el-table>
2、css
.el-table thead.is-group th { ? ? background: none; ? } ? .el-table thead.is-group tr:first-of-type th:first-of-type { ? ? border-bottom: none; ? } ? .el-table thead.is-group tr:first-of-type th:first-of-type:before { ? ? content: ''; ? ? position: absolute; ? ? width: 1px; ? ? height: 75px; /*這里需要自己調(diào)整,根據(jù)td的寬度和高度*/ ? ? top: 0; ? ? left: 0; ? ? background-color: grey; ? ? opacity: 0.3; ? ? display: block; ? ? transform: rotate(-53deg); /*這里需要自己調(diào)整,根據(jù)線的位置*/ ? ? transform-origin: top; ? } ? .el-table thead.is-group tr:last-of-type th:first-of-type:before { ? ? content: ''; ? ? position: absolute; ? ? width: 1px; ? ? height: 75px; /*這里需要自己調(diào)整,根據(jù)td的寬度和高度*/ ? ? bottom: 0; ? ? right: 0; ? ? background-color: grey; ? ? opacity: 0.3; ? ? display: block; ? ? transform: rotate(-54deg); /*這里需要自己調(diào)整,根據(jù)線的位置*/ ? ? transform-origin: bottom; ? ? // background:red; ? }
3、js
mechanism: ['醫(yī)療機(jī)構(gòu)A', '醫(yī)療機(jī)構(gòu)B', '醫(yī)療機(jī)構(gòu)C', '醫(yī)療機(jī)構(gòu)D'], ? ? ? tableData3: [ ? ? ? ? { ? ? ? ? ? name: '項目A', ? ? ? ? ? mechanism: [ ? ? ? ? ? ? { ? ? ? ? ? ? ? frequency: 8, ? ? ? ? ? ? ? cost: 1000 ? ? ? ? ? ? }, ? ? ? ? ? ? { ? ? ? ? ? ? ? frequency: 9, ? ? ? ? ? ? ? cost: 2000 ? ? ? ? ? ? }, ? ? ? ? ? ? { ? ? ? ? ? ? ? frequency: 10, ? ? ? ? ? ? ? cost: 3000 ? ? ? ? ? ? }, ? ? ? ? ? ? { ? ? ? ? ? ? ? frequency: 11, ? ? ? ? ? ? ? cost: 4000 ? ? ? ? ? ? } ? ? ? ? ? ] ? ? ? ? }, ? ? ? ? { ? ? ? ? ? name: '項目B', ? ? ? ? ? mechanism: [ ? ? ? ? ? ? { ? ? ? ? ? ? ? frequency: 3, ? ? ? ? ? ? ? cost: 3001 ? ? ? ? ? ? }, ? ? ? ? ? ? { ? ? ? ? ? ? ? frequency: 4, ? ? ? ? ? ? ? cost: 2002 ? ? ? ? ? ? }, ? ? ? ? ? ? { ? ? ? ? ? ? ? frequency: 5, ? ? ? ? ? ? ? cost: 2003 ? ? ? ? ? ? }, ? ? ? ? ? ? { ? ? ? ? ? ? ? frequency: 6, ? ? ? ? ? ? ? cost: 2004 ? ? ? ? ? ? } ? ? ? ? ? ] ? ? ? ? } ? ? ? ]
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- vue elementUI table表格數(shù)據(jù) 滾動懶加載的實現(xiàn)方法
- Vue+EleMentUI實現(xiàn)el-table-colum表格select下拉框可編輯功能實例
- Vue+ElementUI table實現(xiàn)表格分頁
- VUE2.0+ElementUI2.0表格el-table實現(xiàn)表頭擴(kuò)展el-tooltip
- VUE2.0+ElementUI2.0表格el-table循環(huán)動態(tài)列渲染的寫法詳解
- VUE2.0 ElementUI2.0表格el-table自適應(yīng)高度的實現(xiàn)方法
- vue elementUI table表格自定義樣式滾動效果
相關(guān)文章
vue 實現(xiàn)axios攔截、頁面跳轉(zhuǎn)和token 驗證
這篇文章主要介紹了vue 實現(xiàn)axios攔截、頁面跳轉(zhuǎn)和token 驗證,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-07-07關(guān)于electron-vue打包后運(yùn)行白屏的解決方案
這篇文章主要介紹了關(guān)于electron-vue打包后運(yùn)行白屏的解決方案,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-10-10詳解vue使用vue-layer-mobile組件實現(xiàn)toast,loading效果
這篇文章主要介紹了詳解vue使用vue-layer-mobile組件實現(xiàn)toast,loading效果,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-08-08