问题描述
小程序前端多组图片如何滤重,原先是可以上传重复的图片,现在要提示用户有重复的图片
相关代码
数组名qsclList:
qsclList在wxml上是wx:for循环出来的。
qscllj数组保存了图片的路径
我现在要做图片滤重
在每组下面分别显示重复的图。只需要同组的图不可以重复就行了
路径的后面32位是相同的就是图片,qspts[]用来保存截取32位的值
我原先是这么做的
that.data.qsclList.forEach((item, index, arr) => {
if (arr[index].qscllj.length != 0) {
arr[index].qscllj.forEach(val => {
let loc = val.lastIndexOf('.')
let str = val.substring(loc - 32, loc)
console.log(str) //32位的值
that.data.qsclList[id].qspts.push(str)
})
}
})
}
发现后面的组的qspts[]会把前面所有的值存放起来。
我现在就是不知道这个滤重到底怎么做或者能帮我解决每个组的qspts[]是自己组的值
之前写的代码,应该能用啥吧