Commit c3ec6e72 by 李长胜

修改输入框相同出现的bug

1 parent c9b6f0d7
......@@ -509,6 +509,18 @@ export default {
break
}
},
isHasSome(array) {
var temp = [] //一个新的临时数组
for (var i = 0; i < array.length; i++) {
if (temp.indexOf(array[i]) !== -1) {
return true
}
if (temp.indexOf(array[i]) == -1) {
temp.push(array[i])
}
}
return false
},
//编辑触发事件
editEvent(rowData) {
this.handleClose()
......@@ -545,6 +557,17 @@ export default {
this.$message.error('不能提交空标签')
return
}
//如果存在添加标签的输入框的内容的标签相同则不提交
let isSameTagFlag = false
var tempArr = this.tagForm.tagsList.map(item => item.name)
isSameTagFlag = this.isHasSome(tempArr)
console.log('dayin',isSameTagFlag,tempArr)
if (isSameTagFlag) {
this.$message.error('不能提交相同的标签,请修改')
return
}
this.newAddTagFun()
//this.handleClose() //这里不管
} else {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!