Error (TypeError: Cannot read property 'style' of null(…)) pop out whenever placeAt() method is called

Error (TypeError: Cannot read property 'style' of null(…)) pop out whenever placeAt() method is called

以下代码在我的其他项目中工作正常,但是当我在当前项目中将对象放置到 div 时,它会不断弹出此错误。 placeAt() 方法有什么必须注意的问题吗?

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 TypeError: 无法读取 null(…)

的 属性 'style'

DashboardPage.js:95 TypeError: 无法读取 null(…)

的 属性 'style'

"Cannot read property 'style' of null"

从错误本身已经提到了根本原因。您的 JavaScript 正在尝试对 undefined/null 节点进行一些样式设置。请确保您正确定义了目标节点