<view class="img-box-school">
<view v-if="items.value != null" class="img-box-view">
<view
v-for="(itemsub, indexsub) in backGraduate"
:key="indexsub"
>
<image
:src="backGraduate[indexsub]"
mode="aspectFit"
class="imgHonor"
></image>
<view
class="img-box-del"
@tap.stop="
DelImg(
$event,
items.fieldName,
optionsFive,
backGraduate[indexsub]
)
"
>
<text class="cuIcon-close"></text>
</view>
</view>
</view>
<view
class="img-box-view"
v-for="(item, index) in imgList"
:key="index"
@tap="ViewImage($event, items.fieldName, optionsFive)"
:data-url="imgList[index]"
>
<image
:src="imgList[index]"
mode="aspectFit"
class="imgHonor"
></image>
<view
class="img-box-del"
@tap.stop="
DelImg(
$event,
items.fieldName,
optionsFive,
imgList[index]
)
"
:data-index="index"
>
<text class="cuIcon-close"></text>
</view>
</view>
<view
传入图片地址,findIndex进行比较返回下标,-1不管.splice大于就删除下标元素
var localIndexOne = this.imgOneList.findIndex((x) => x == url);
var backIndexOne = this.backHonor.findIndex((x: any) => x == url);
if (localIndexOne != -1) {
this.imgOneList.splice(localIndexOne, 1);
}
if (backIndexOne != -1) {
this.backHonor.splice(backIndexOne, 1);
}