执行: specId为undefined(或其它为否的变量)则返回false for-of 遍历list数组,如果满足条件则返回那一项 说明上面数组没有一项满足条件,返回false 改造下 getSpec(specId) { return specId && this.tempSpecList.filter(item => item.spec_id === specId).pop(); } // 就是这里把false变成了undefined
执行:
specId
为undefined
(或其它为否的变量)则返回false
for-of
遍历list
数组,如果满足条件则返回那一项false
改造下