当尝试查询数据库中的各种记录时,使用下面的数组,TaffyDB 将无法正确查找记录。从语法上讲,它似乎是合理的,应该查询并返回记录的值,但我认为我错过了一些致命的点。
$(".cat").each(function(){
$this = $(this);
var db = ($this.data("category")).toString()
var fn = window[db];
if (typeof fn === "function") fn().each(function(r){
var parts = ["cpu", "mobo", "ram", "gpu", "sc", "hdd", "ssd", "psu", "case", "cooler", "os"];
var pmup = "";
for(i=0;i<parts.length;i++){
var part = r.parts[i];
console.log(part) // returns: Uncaught TypeError: Cannot read property '0' of undefined
}
}
});