JS代理写法
JS代理,给元素添加事件并节省大量的性能,优化性能
document.body.onclick = function (e) {
var e = e || window.event;
var target = e.target || e.srcElement;
// console.dir(target.name);
if (target.className == 'sortInput') {
// 遍历选中的字段
for (let item of _this.resultValue) {
// 选中已选字段中选中排序的字段
if (item.fieldId == target.name) {
item.isSort = target.checked ? 'Y' : 'N';
}
}
}
}