there is a requirement to remove an element from the array when it exists, and to add the element to the array when it does not exist.
this is how I implement it. Is there a more elegant or convenient way to write it? Please do not hesitate to give us advice!
selectTag(row, id) {
if (row.tagId.indexOf(id) > -1) {
row.tagId = row.tagId.filter(n => n !== id)
} else {
row.tagId.push(id)
}
}