解决列表重复/回显问题
methods: {
awemeChange (item, checked) {
let obj = {}
obj.aweme_id = item.aweme_id
obj.author_name = item.author_name
obj.cover_num_str = item.cover_num_str
let awemeAuthorMessage = JSON.parse(JSON.stringify(this.expertKeyWordsList))
let isN = []
if (awemeAuthorMessage.length !== 0) {
for (let k = 0; k < awemeAuthorMessage.length; k++) {
if (item.aweme_id === awemeAuthorMessage[k].aweme_id) {
console.log(awemeAuthorMessage[k].aweme_id, '重复出现~')
isN.push(false)
for (let n = 0; n < this.expertKeyWordsList.length; n++) {
if (this.expertKeyWordsList[n].aweme_id === awemeAuthorMessage[k].aweme_id) {
for (let c = 0; c < this.checkAwemeList.length; c++) {
if (this.checkAwemeList[c].aweme_id === awemeAuthorMessage[k].aweme_id) {
this.checkAwemeList.splice(c, 1)
}
}
console.log(this.expertKeyWordsList[n].aweme_id === awemeAuthorMessage[k].aweme_id, '重复----------出现~')
return this.expertKeyWordsList.splice(n, 1)
}
}
} else {
isN.push(true)
}
}
if (isN.indexOf(true) !== -1) {
this.expertKeyWordsList.push(obj)
this.checkAwemeList.push(item)
}
} else {
for (let s = 0; s < this.awemeListOptions.length; s++) {
if (this.awemeListOptions[s].label_id === item.label_id) {
this.checkAwemeList.push(this.awemeListOptions[s])
}
}
this.expertKeyWordsList.push(obj)
this.addexpert = 'second'
}
this.ruleForm.aweme_fan_accounts = [...new Set(this.ruleForm.aweme_fan_accounts)]
},
}