Vue?ElementUI?table實(shí)現(xiàn)表格斜線分隔線
本文實(shí)例為大家分享了Vue ElementUI table給表格一個(gè)斜線分隔線的具體代碼,供大家參考,具體內(nèi)容如下
效果:
實(shí)現(xiàn):
通過(guò)改css樣式實(shí)現(xiàn)
1、去掉第一個(gè)單元格的下邊框/
2、第一列第一個(gè)單元格和第二個(gè)單元格的偽元素設(shè)置絕對(duì)定位,寬度設(shè)成1px,高度根據(jù)自己表格調(diào)整
3、通過(guò)旋轉(zhuǎn)兩個(gè)單元格偽元素,并設(shè)置旋轉(zhuǎn)起始點(diǎn),使兩個(gè)偽元素旋轉(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)項(xiàng)目" ? ? ? ? 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: '項(xiàng)目A', ? ? ? ? ? mechanism: [ ? ? ? ? ? ? { ? ? ? ? ? ? ? frequency: 8, ? ? ? ? ? ? ? cost: 1000 ? ? ? ? ? ? }, ? ? ? ? ? ? { ? ? ? ? ? ? ? frequency: 9, ? ? ? ? ? ? ? cost: 2000 ? ? ? ? ? ? }, ? ? ? ? ? ? { ? ? ? ? ? ? ? frequency: 10, ? ? ? ? ? ? ? cost: 3000 ? ? ? ? ? ? }, ? ? ? ? ? ? { ? ? ? ? ? ? ? frequency: 11, ? ? ? ? ? ? ? cost: 4000 ? ? ? ? ? ? } ? ? ? ? ? ] ? ? ? ? }, ? ? ? ? { ? ? ? ? ? name: '項(xiàng)目B', ? ? ? ? ? mechanism: [ ? ? ? ? ? ? { ? ? ? ? ? ? ? frequency: 3, ? ? ? ? ? ? ? cost: 3001 ? ? ? ? ? ? }, ? ? ? ? ? ? { ? ? ? ? ? ? ? frequency: 4, ? ? ? ? ? ? ? cost: 2002 ? ? ? ? ? ? }, ? ? ? ? ? ? { ? ? ? ? ? ? ? frequency: 5, ? ? ? ? ? ? ? cost: 2003 ? ? ? ? ? ? }, ? ? ? ? ? ? { ? ? ? ? ? ? ? frequency: 6, ? ? ? ? ? ? ? cost: 2004 ? ? ? ? ? ? } ? ? ? ? ? ] ? ? ? ? } ? ? ? ]
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- vue elementUI table表格數(shù)據(jù) 滾動(dòng)懶加載的實(shí)現(xiàn)方法
- Vue+EleMentUI實(shí)現(xiàn)el-table-colum表格select下拉框可編輯功能實(shí)例
- Vue+ElementUI table實(shí)現(xiàn)表格分頁(yè)
- VUE2.0+ElementUI2.0表格el-table實(shí)現(xiàn)表頭擴(kuò)展el-tooltip
- VUE2.0+ElementUI2.0表格el-table循環(huán)動(dòng)態(tài)列渲染的寫(xiě)法詳解
- VUE2.0 ElementUI2.0表格el-table自適應(yīng)高度的實(shí)現(xiàn)方法
- vue elementUI table表格自定義樣式滾動(dòng)效果
相關(guān)文章
Vue Spa切換頁(yè)面時(shí)更改標(biāo)題的實(shí)例代碼
本篇文章主要介紹了Vue Spa切換頁(yè)面時(shí)更改標(biāo)題的實(shí)例代碼,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-07-07vue 實(shí)現(xiàn)axios攔截、頁(yè)面跳轉(zhuǎn)和token 驗(yàn)證
這篇文章主要介紹了vue 實(shí)現(xiàn)axios攔截、頁(yè)面跳轉(zhuǎn)和token 驗(yàn)證,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-07-07關(guān)于electron-vue打包后運(yùn)行白屏的解決方案
這篇文章主要介紹了關(guān)于electron-vue打包后運(yùn)行白屏的解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-10-10VUE項(xiàng)目實(shí)現(xiàn)主題切換的多種方法
這篇文章主要介紹了VUE項(xiàng)目實(shí)現(xiàn)主題切換的方法,本文通過(guò)多種方法給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-11-11詳解vue使用vue-layer-mobile組件實(shí)現(xiàn)toast,loading效果
這篇文章主要介紹了詳解vue使用vue-layer-mobile組件實(shí)現(xiàn)toast,loading效果,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-08-08vue安裝less-loader依賴(lài)失敗問(wèn)題及解決方案
這篇文章主要介紹了vue安裝less-loader依賴(lài)失敗問(wèn)題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-08-08