问题: vue/element的@change事件调用2次/或者打印2次,change事件有新旧值
解决: 设定一个变量, 将值存起来, 比较后拿最新的值
changeDept(item) {
if (item.signUserId !== undefined) {
// 判断值和变量,如果之和变量相等,则不做操作,否则执行
if (this.newSignUserId === item.signUserId) {
console.log(11)
} else {
// 储存我所改变的值
this.newSignUserId = item.signUserId
this.setDept(item.signUserId)
// 执行change事件所执行的代码
}
}
},