首先:非套答案,確實有點看不,確實有點看不明白,求解!function getMatchedData(data,match){ var result = data; var attrs = _______; attrs.each(function(obj){ result = typeof result == 'object' && result.hasOwnProperty(obj) ? _____ : ______; }); result = typeof result == "undefind" ? "" : result; return result; } function templateDataMapping(temp,data){ if(temp){ var matches = temp.match(/{{[a-z_A-Z](\w+)?([\.][a-z_A-Z](\w+)?)*}}/g); matches.each(function(index,match){ temp = temp.replace(match,getMatchedData(data,match.substring(2,match.length-2))); }) } return temp; }
這兩個方法中有這個each()方法嗎?下邊這段代碼這如何理解?
慕哥9229398
2019-03-13 13:15:16