vue中 el-table每個(gè)單元格包含多個(gè)數(shù)據(jù)項(xiàng)處理
應(yīng)用場(chǎng)景
vue項(xiàng)目中,我們需要在el-table中顯示數(shù)組數(shù)據(jù),有的時(shí)候,需要在一個(gè)單元格中顯示多條數(shù)據(jù),如何實(shí)現(xiàn)呢?看看下面源代碼,一看便知。
示例效果
示例源代碼(共80行)
/* * @Author: 大劍師蘭特(xiaozhuanlan),還是大劍師蘭特(CSDN) * @此源代碼版權(quán)歸大劍師蘭特所有,可供學(xué)習(xí)或商業(yè)項(xiàng)目中借鑒,未經(jīng)授權(quán),不得重復(fù)地發(fā)表到博客、論壇,問(wèn)答,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:一個(gè)表格單元中顯示多條數(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每個(gè)單元格包含多個(gè)數(shù)據(jù)項(xiàng)處理的文章就介紹到這了,更多相關(guān)vue el-table單元格內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
使用vue2實(shí)現(xiàn)帶地區(qū)編號(hào)和名稱的省市縣三級(jí)聯(lián)動(dòng)效果
我們知道省市區(qū)縣都有名稱和對(duì)應(yīng)的數(shù)字唯一編號(hào),使用編號(hào)可以更方便查詢以及程序處理,我們今天來(lái)了解一下使用vue2來(lái)實(shí)現(xiàn)常見(jiàn)的省市區(qū)下拉聯(lián)動(dòng)選擇效果,需要的朋友可以參考下2018-11-11解決Antd 里面的select 選擇框聯(lián)動(dòng)觸發(fā)的問(wèn)題
這篇文章主要介紹了解決Antd 里面的select 選擇框聯(lián)動(dòng)觸發(fā)的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-10-10關(guān)于vue的npm run dev和npm run build的區(qū)別介紹
這篇文章主要介紹了關(guān)于vue的npm run dev和npm run build的區(qū)別介紹,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2019-01-01通過(guò)Vue實(shí)現(xiàn)Excel文件的上傳和預(yù)覽功能
在業(yè)務(wù)系統(tǒng)中,Excel 文件作為一種常用的數(shù)據(jù)存儲(chǔ)和傳輸格式,經(jīng)常需要被處理和展示,這篇文章將講解如何通過(guò) Vue 和 xlsx.js 實(shí)現(xiàn) Excel 文件的上傳和預(yù)覽功能,需要的朋友可以參考下2025-04-04關(guān)于vue中ref的使用(this.$refs獲取為undefined)
這篇文章主要介紹了關(guān)于vue中ref的使用(this.$refs獲取為undefined),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-03-03vue3中reactive和ref的實(shí)現(xiàn)與區(qū)別詳解
reactive和ref都是vue3實(shí)現(xiàn)響應(yīng)式系統(tǒng)的api,他們是如何實(shí)現(xiàn)響應(yīng)式的呢,reactive和ref又有什么區(qū)別呢,下面小編就來(lái)和大家詳細(xì)講講,希望對(duì)大家有所幫助2023-10-10Nuxt封裝@nuxtjs/axios請(qǐng)求后端數(shù)據(jù)方式
這篇文章主要介紹了Nuxt封裝@nuxtjs/axios請(qǐng)求后端數(shù)據(jù)方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-10-10在vue中實(shí)現(xiàn)禁止屏幕滾動(dòng),禁止屏幕滑動(dòng)
這篇文章主要介紹了在vue中實(shí)現(xiàn)禁止屏幕滾動(dòng),禁止屏幕滑動(dòng),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-07-07vue循環(huán)中點(diǎn)擊選中再點(diǎn)擊取消(單選)的實(shí)現(xiàn)
這篇文章主要介紹了vue循環(huán)中點(diǎn)擊選中再點(diǎn)擊取消(單選)的實(shí)現(xiàn),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-09-09