vue+element UI+js实现分割后台传入的图片字符串中包含多个图片内容,并在表格中显示图片

tech2023-05-20  91

<el-table-column prop="imgUrl" label="图片" align="center"> <template slot-scope="scope"> <div class="wrap" :class="{'moreImg':scope.row.imgUrl.length > 1}"> <el-image v-for="(item,index) in scope.row.imgUrl" :key="index" :src="item" ></el-image> </div> </template> </el-table-column> this.$post("api/control/aluDynamic/selectDynamicByManage", data).then( (res) => { console.log(res); console.log(res.data.list); for (var i = 0; i < res.data.list.length; i++) { var str = res.data.list[i].imgUrl; //字符串截取为数组 var strArr = str.split(";"); console.log(strArr); res.data.list[i].imgUrl = strArr; console.log(res.data.list[i].imgUrl); } this.tableData = res.data.list; this.total = res.data.total; } );
最新回复(0)