vue中 el-table每個單元格包含多個數(shù)據(jù)項處理
應(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)文章
使用vue2實現(xiàn)帶地區(qū)編號和名稱的省市縣三級聯(lián)動效果
我們知道省市區(qū)縣都有名稱和對應(yīng)的數(shù)字唯一編號,使用編號可以更方便查詢以及程序處理,我們今天來了解一下使用vue2來實現(xiàn)常見的省市區(qū)下拉聯(lián)動選擇效果,需要的朋友可以參考下2018-11-11
解決Antd 里面的select 選擇框聯(lián)動觸發(fā)的問題
這篇文章主要介紹了解決Antd 里面的select 選擇框聯(lián)動觸發(fā)的問題,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-10-10
關(guān)于vue的npm run dev和npm run build的區(qū)別介紹
這篇文章主要介紹了關(guān)于vue的npm run dev和npm run build的區(qū)別介紹,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2019-01-01
通過Vue實現(xiàn)Excel文件的上傳和預(yù)覽功能
在業(yè)務(wù)系統(tǒng)中,Excel 文件作為一種常用的數(shù)據(jù)存儲和傳輸格式,經(jīng)常需要被處理和展示,這篇文章將講解如何通過 Vue 和 xlsx.js 實現(xiàn) Excel 文件的上傳和預(yù)覽功能,需要的朋友可以參考下2025-04-04
關(guān)于vue中ref的使用(this.$refs獲取為undefined)
這篇文章主要介紹了關(guān)于vue中ref的使用(this.$refs獲取為undefined),具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-03-03
vue3中reactive和ref的實現(xiàn)與區(qū)別詳解
reactive和ref都是vue3實現(xiàn)響應(yīng)式系統(tǒng)的api,他們是如何實現(xiàn)響應(yīng)式的呢,reactive和ref又有什么區(qū)別呢,下面小編就來和大家詳細(xì)講講,希望對大家有所幫助2023-10-10
Nuxt封裝@nuxtjs/axios請求后端數(shù)據(jù)方式
這篇文章主要介紹了Nuxt封裝@nuxtjs/axios請求后端數(shù)據(jù)方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-10-10
vue循環(huán)中點擊選中再點擊取消(單選)的實現(xiàn)
這篇文章主要介紹了vue循環(huán)中點擊選中再點擊取消(單選)的實現(xiàn),具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-09-09

