官方給的:
<el-table-column label="Thumbnail" width="180">
<template #default="scope">
<div style="display: flex; align-items: center">
<el-image :preview-src-list="srcList"/>
</div>
</template>
</el-table-column>
實際應(yīng)用中的:
首先獲取數(shù)據(jù)中的img
在組件中綁定:
手動綁定scope ;要獲取數(shù)據(jù)中當(dāng)前行的img,只需要綁定 scope.row.img 即可(img是字段名)
組件完整代碼:
<el-table-column label="景區(qū)圖片" width="240">
<template #default="scope">
<el-image style="width: 100px; height: 80px; padding: 5px;" :src="scope.row.img" :zoom-rate="1.2" :max-scale="7" :min-scale="0.2" :preview-src-list="[scope.row.img]" :initial-index="4" fit="cover" />
</template>
</el-table-column>
效果:文章來源:http://www.zghlxwxcb.cn/news/detail-787173.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-787173.html
到了這里,關(guān)于element plus 表格組件怎樣在表格中顯示圖片的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!