vue2使用?element表格展開功能渲染子表格的方式
默認(rèn)樣式

修改后

樣式2

<el-table :data="needDataFollow" border style="width: 100%">
<el-table-column align="center" label="序號(hào)" type="index" width="80" />
<el-table-column align="center" label="計(jì)算方向" prop="direction" />
<el-table-column align="center" label="需求內(nèi)容" prop="demand_content" />
<el-table-column align="center" label="文檔/附件">
<template #default="scope">
<div class="img">
<a v-for="(item, index) in scope.row.report" :key="index" :href="item.url" rel="external nofollow"
target="_blank">
{{ item.name }}
</a>
</div>
</template>
</el-table-column>
<el-table-column align="center" label="創(chuàng)建時(shí)間" prop="createtime" />
<el-table-column align="center" label="成交時(shí)間" prop="bargain_time" />
<el-table-column align="center" label="成交狀態(tài)">
<template #default="scope">
{{ scope.row.is_bargain === 1 ? '未成交' : '已成交' }}
</template>
</el-table-column>
<el-table-column align="center" label="編輯需求">
<template #default="scope">
<img v-if="scope.row.is_bargain == 1" alt="編輯" src="../../assets/edit_icon.png"
style="cursor: pointer" @click="getNeedEdit(scope.row.id)">
<span v-else>需求已成交不可修改</span>
</template>
</el-table-column>
<el-table-column align="center" label="添加報(bào)價(jià)">
<template #default="scope">
<el-icon color="red" size="25px"
@click="get_quotation(scope.row.id, 0, scope.row.direction)">
<CirclePlusFilled />
</el-icon>
</template>
</el-table-column>
<el-table-column type="expand" width="140" label="查看報(bào)價(jià)">
<template #default="scopes">
<el-form label-position="right" inline class="demo-table-expand">
<el-table :data="scopes.row.tea" border
style="width:calc(100% - 80px);float:right" id="child_tab">
<el-table-column align="center" label="報(bào)價(jià)編號(hào)" prop="number"
width="180" />
<el-table-column align="center" label="計(jì)算老師" prop="teacher_name" />
<el-table-column align="center" label="報(bào)價(jià)" prop="tea_money" />
<el-table-column align="center" label="周期" prop="cycle" />
<el-table-column align="center" flex label="報(bào)價(jià)單" width="140">
<template #default="scope">
<el-button :disabled="scope.row.amount_price == '0.00'"
type="success">生成報(bào)價(jià)單</el-button>
</template>
</el-table-column>
<el-table-column align="center" label="修改報(bào)價(jià)">
<template #default="scope">
<el-button type="success"
@click="get_quotation(scope.row.id, 1)"
:disabled="scopes.row.is_bargain == 2">
修改報(bào)價(jià)
</el-button>
</template>
</el-table-column>
</el-table>
</el-form>
</template>
</el-table-column>
</el-table>模擬數(shù)據(jù)
needDataFollow: [
{
"bargain_time": "",
"id": 7,
"direction": "項(xiàng)目",
"demand_content": "777",
"report": [],
"is_bargain": 1,
"createtime": "2024-01-16",
"tea": [
{
"id": 6,
"teacher_id": "555",
"teacher_name": "名字",
"cycle": "10",
"tea_money": "10.00",
"number": "PHAD-BJ-20240116-01"
}
]
},
]修改默認(rèn)樣式
// 父表格顏色
/deep/.el-table th.el-table__cell {
background: #596980 !important;
font-size: 14px;
font-weight: 400;
color: #FFFFFF;
}
// 子表格顏色
#child_tab {
/deep/ th {
background-color: #f0f2fd !important;
color: #000 !important;
}
}
// 展開向右邊
/deep/ .el-table__expand-icon {
color: #29b4ff;
font-size: 15px;
&::before {
content: "展開";
}
.el-icon svg {
transform: rotate(0deg);
transition: 0.3s;
}
}
// 收起向下邊
/deep/ .el-table__expand-icon--expanded {
transform: rotate(0);
&::before {
content: "收起";
}
.el-icon svg {
transform: rotate(90deg);
transition: 0.3s;
}
}到此這篇關(guān)于vue2使用 element表格展開功能渲染子表格的方式的文章就介紹到這了,更多相關(guān)vue2 element表格渲染內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- VUE2.0+ElementUI2.0表格el-table循環(huán)動(dòng)態(tài)列渲染的寫法詳解
- Vue?element-ui中表格過長(zhǎng)內(nèi)容隱藏顯示的實(shí)現(xiàn)方式
- vue+element表格實(shí)現(xiàn)多層數(shù)據(jù)的嵌套方式
- vue element-ui里的table中表頭與表格出現(xiàn)錯(cuò)位的解決
- Vue+Element樹形表格實(shí)現(xiàn)拖拽排序示例
- vue?element-ui動(dòng)態(tài)橫向統(tǒng)計(jì)表格的實(shí)現(xiàn)
- vue+elementui實(shí)現(xiàn)動(dòng)態(tài)控制表格列的顯示和隱藏
- Vue?elementUI表單嵌套表格并對(duì)每行進(jìn)行校驗(yàn)詳解
相關(guān)文章
vue項(xiàng)目中字符串換行顯示方式(返回的數(shù)據(jù)包含‘\r\n’字符)
這篇文章主要介紹了vue項(xiàng)目中字符串換行顯示方式(返回的數(shù)據(jù)包含‘\r\n’字符),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-04-04
vue+axios+element ui 實(shí)現(xiàn)全局loading加載示例
今天小編就為大家分享一篇vue+axios+element ui 實(shí)現(xiàn)全局loading加載示例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-09-09
基于vue 動(dòng)態(tài)菜單 刷新空白問題的解決
這篇文章主要介紹了基于vue 動(dòng)態(tài)菜單 刷新空白問題的解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2020-08-08
Vue實(shí)現(xiàn)base64編碼圖片間的切換功能
這篇文章主要介紹了Vue實(shí)現(xiàn)base64編碼圖片間的切換功能,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-12-12
vuex?設(shè)計(jì)思路和實(shí)現(xiàn)方式
這篇文章主要介紹了vuex?設(shè)計(jì)思路和實(shí)現(xiàn)方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-08-08
vue中使用axios post上傳頭像/圖片并實(shí)時(shí)顯示到頁(yè)面的方法
今天小編就為大家分享一篇vue中使用axios post上傳頭像/圖片并實(shí)時(shí)顯示到頁(yè)面的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-09-09

