vue中 el-table每個單元格包含多個數(shù)據(jù)項處理
更新時間:2023年11月11日 11:34:23 作者:還是大劍師蘭特
vue項目中,我們需要在el-table中顯示數(shù)組數(shù)據(jù),有的時候,需要在一個單元格中顯示多條數(shù)據(jù),如何實現(xiàn)呢,對vue el-table單元格相關(guān)知識感興趣的朋友一起看看吧
應(yīng)用場景
vue項目中,我們需要在el-table中顯示數(shù)組數(shù)據(jù),有的時候,需要在一個單元格中顯示多條數(shù)據(jù),如何實現(xiàn)呢?看看下面源代碼,一看便知。
示例效果

示例源代碼(共80行)
/*
* @Author: 大劍師蘭特(xiaozhuanlan),還是大劍師蘭特(CSDN)
* @此源代碼版權(quán)歸大劍師蘭特所有,可供學(xué)習(xí)或商業(yè)項目中借鑒,未經(jīng)授權(quán),不得重復(fù)地發(fā)表到博客、論壇,問答,git等公共空間或網(wǎng)站中。
* @Email: 2909222303@qq.com
* @weixin: gis-dajianshi
* @First published in CSDN
* @First published time: 2023-11-11
*/
<template>
<div class="djs-box">
<div class="topBox">
<h3>vue+element UI:一個表格單元中顯示多條數(shù)據(jù) </h3>
<div>大劍師蘭特, 還是大劍師蘭特,gis-dajianshi</div>
</div>
<div class="cbox">
<el-table :data="tableData">
<el-table-column prop="title" label="圖片" width="180">
<template slot-scope="scope">
<el-image :src="scope.row.thumbnail_pic_s"></el-image>
</template>
</el-table-column>
<el-table-column prop="date" label="日期" width="180">
</el-table-column>
<el-table-column label="混合數(shù)據(jù)">
<template slot-scope="scope">
<div>
<div>文章標(biāo)題:{{scope.row.title}}</div>
<div>作者姓名:{{scope.row.name}}</div>
<div>作者郵箱:{{scope.row.email}}</div>
</div>
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
<script>
export default {
data() {
return {
tableData: [],
}
},
mounted() {
this.getdata()
},
methods: {
getdata() {
let url = "/listdata"
this.$request(url, {}, "GET")
.then((res) => {
this.tableData = res.data.data
console.log(this.tableData)
})
},
}
}
</script>
<style scoped>
.djs-box {
width: 900px;
height: 600px;
margin: 50px auto;
border: 1px solid seagreen;
}
.topBox {
margin: 0 auto 0px;
padding: 10px 0;
background: palevioletred;
color: #fff;
}
.cbox {
padding: 10px;
}
</style>核心代碼
<el-table-column label="混合數(shù)據(jù)">
<template slot-scope="scope">
<div>
<div>文章標(biāo)題:{{scope.row.title}}</div>
<div>作者姓名:{{scope.row.name}}</div>
<div>作者郵箱:{{scope.row.email}}</div>
</div>
</template>
</el-table-column>到此這篇關(guān)于vue中 el-table每個單元格包含多個數(shù)據(jù)項處理的文章就介紹到這了,更多相關(guān)vue el-table單元格內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
vue實現(xiàn)點擊某個div顯示與隱藏內(nèi)容功能實例
最近做項目有用到某個div顯示與隱藏內(nèi)容,所以下面這篇文章主要給大家介紹了關(guān)于vue實現(xiàn)點擊某個div顯示與隱藏內(nèi)容功能的相關(guān)資料,文中通過實例代碼介紹的非常詳細,需要的朋友可以參考下2022-12-12
詳解如何使用router-link對象方式傳遞參數(shù)?
這篇文章主要介紹了如何使用router-link對象方式傳遞參數(shù),文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-05-05
Vue Router的三種歷史模式應(yīng)用與對比詳解
在 Vue.js 單頁應(yīng)用(SPA)中,vue-router 提供了三種不同的 歷史模式 來管理路由導(dǎo)航和 URL 顯示方式,每種模式適用于不同場景,下面小編就和大家簡單介紹一下吧2025-10-10

