1 需求:表格中需要显示图片,数据是由后台提供
2 问题:直接使用elementUI中的table组件,通过prop传值,直接把图片路径加入表格中了。
3 解决办法:
a 一张图片
<el-table-column label="识别照片">
<template slot-scope="scope">
<img :src="scope.row.picUrl" width="80"/>
</template>
</el-table-column>
b 多张图片
<el-table-column label="识别照片">
<template scope="scope" prop="picUrls">
<img v-for="item in scope.row.picUrls" :src="item" width="80"/>
</template>
</el-table-column>