From 22c9b72b4e6fec174dcc273ab3efcd81fbfc0f50 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Thu, 29 Apr 2021 17:59:47 +0800 Subject: [PATCH] 报错的修复 --- components/diy_goodsGroup/diy_goodsGroup.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/components/diy_goodsGroup/diy_goodsGroup.js b/components/diy_goodsGroup/diy_goodsGroup.js index 38255a6..7ac451a 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.js +++ b/components/diy_goodsGroup/diy_goodsGroup.js @@ -75,10 +75,13 @@ Component({ } // 在组件实例进入页面节点树时执行 - if(nav_item) - this.data.classstyle_id = nav_item.classstyle; + if(nav_item) { + this.data.classstyle_id = nav_item.classstyle; + this.data.wgroup =nav_item.wgroup; + } + this.data.goodscount = this.data.object.goodscount; - this.data.wgroup =nav_item.wgroup; + var hei=280; if(this.data.object.goodstit) hei+=80; @@ -87,13 +90,13 @@ Component({ this.setData({swiper_hei:hei}); - if (nav_item.goodsclass == 1) { + if (nav_item && nav_item.goodsclass == 1) { this.data.is_recommend = 1 } - if (nav_item.goodsclass == 2) { + if (nav_item && nav_item.goodsclass == 2) { this.data.is_hot = 1 } - if (nav_item.goodsclass == 3) { + if (nav_item && nav_item.goodsclass == 3) { this.data.is_new = 1 } -- libgit2 0.21.4