// @hack
// 长按当前的数据元素颜色变深
nodeTouchmoveStyle(sortDrag, typeId) {
function add() {
if (typeId === '7') {
this.parentNode.style.background = '#E6E6E6'
return
}
this.style.background = '#E6E6E6'
}
function remove() {
if (typeId === '7') {
this.parentNode.style.background = ''
return
}
this.style.background = ''
}
if (sortDrag.length) {
sortDrag.forEach(item => {
// item.removeEventListener('touchstart', add.bind(item), false)
// item.removeEventListener('touchmove', add.bind(item), false)
// item.removeEventListener('touchend', remove.bind(item), false)
item.addEventListener('touchstart', add.bind(item), false)
item.addEventListener('touchmove', add.bind(item), false)
item.addEventListener('touchend', remove.bind(item), false)
})
}
},

你
xxx.bind()
已经创建一个新的 Function 对象了,你得有个变量持有它才行,后面remove
这个变量,否则每次bind
都是新对象。