0
以下代码在我的其他项目中工作正常,但当我将对象放置到当前项目中的div。有没有什么需要注意的placeAt()方法?无论何时调用placeAt()方法,都会弹出错误(TypeError:无法读取null(...)的属性'样式')
rest.then(function(response){
var dataset = response.data;
array.forEach(dataset, function(single, i){
if(dataset[i].favorite){
favorite++;
}
if(dataset[i].status == "OO"){
outOfService++;
}
});
try{
var dashBoardShortCutCell = new DashBoardShortCutCell();
dashBoardShortCutCell.construct("favorite", favorite);
dashBoardShortCutCell.placeAt(context.shortCutContainerNode);
}catch(err){
console.log(err);
}
dashBoardShortCutCell = new DashBoardShortCutCell();
dashBoardShortCutCell.construct("Out of Service", outOfService);
try{
dashBoardShortCutCell.placeAt(context.shortCutContainerNode);
}catch(err){
console.log(err);
}
}, function(err){
console.log("Error", err);
}, function(evt){
});
控制台,然后显示:
DashboardPage.js:85类型错误:无法读取空(...)
DashboardPage.js的特性 '风格':95类型错误:无法读取属性“风格”空(...)的
由于缺乏足够的上下文(或者,最好将问题充分减少到单独的可重现测试用例),此问题似乎无法回答。在提供的代码中,我没有看到任何引用任何'style'属性的东西(尽管我无法知道DashBoardShortCutCell的作用)。此外,这个问题是否过时了你的[早先](http://stackoverflow.com/questions/32551387/procedure-skipped-after-placeat-method)? –