使用json存入数据库时记得在实体类上添加注解
| @TableName(value = "test",autoResultMap = true) |
| <el-table-column label="图片" align="center" width="180px" :show-overflow-tooltip="false"> |
| <template #default="scope"> |
| <el-image fit="fill" style="width:40px;height: 40px;margin-left: 6px;" |
| v-for="(item, index) in getShowImageList(scope.row.imageList)" :key="index" :preview-teleported="true" |
| :src="item" :preview-src-list="getImgList(scope.row.imageList, index)" /> |
| </template> |
| </el-table-column> |
| |
| const getImgList = (imageList, index) => { |
| let arr = [] as any[] |
| if (imageList.length == 1) { |
| arr.push(imageList[0]) |
| } else if (imageList.length == 0) { |
| return arr; |
| } else { |
| for (let i = 0; i < imageList.length; i++) { |
| arr.push(imageList[i + index]) |
| if (i + index >= imageList.length - 1) { |
| index = 0 - (i + 1); |
| } |
| } |
| } |
| return arr; |
| } |
| |
| const getShowImageList = (imageList) => { |
| if (imageList == null) { |
| return [] |
| } |
| |
| if (imageList.length <= 3) { |
| return imageList |
| } else { |
| return imageList.slice(0, 3) |
| } |
| } |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)