//js循环 添加
that.workTypeActiveIds.forEach(function (value, key, iterable) {
console.log(key, value, iterable);
var work = that.workTypesItemAll.find(function (work) {
return work.id === value
});
that.WorkTypeActiveTtems.push(work);
that.workTypes.push(work.text);
});
js查找索引和删除
// 查询元素在数组中的索引值 Array.prototype.indexValue = function (arr) { for (var i = 0; i < this.length; i++) { if (this[i] == arr) { return i; } } } Array.prototype.remove = function (val) { var index = this.indexOf(val); if (index > -1) { this.splice(index, 1); } };
根据值进行查找
var salary = that.salaryList.find(function (salary) {
return salary.id === result.JobInfo.SalaryTypeId;
});