微信咨询

微信咨询

13610*910*9

服务热线 7*24小时

电话咨询

淘宝小程序模块调取宝贝接口在低版本手淘上无法显示宝贝的问题处理

iamdu2021-12-08 09:48:35 浏览: 629544

低版本手淘和H5页面报错如下,导致宝贝无法加载

CallMethod error Cannot read property ‘shopGetItem’ of undefined/TypeError: Cannot read property ‘shopGetItem’ of undefined

原版本代码是这么写的

my.tb.shopGetItem({
              "sellerId":sellerId,
              "isAuto":true,
              "itemIds":"",
              "pageSize":goods_number,
              "catId":mds.moduleData.category_2,
              "sort":mds.moduleData.sort_2,
              "keyWord":mds.moduleData.keyword_2,
              "startPrice":startPrice,
              "endPrice":endPrice,
            }).then(resp => {

修改成下面的即可

          const TB = this.props.data.modUtils
          TB.my || (TB.my = my || {} )
          TB.my.tb.shopGetItem({
            "sellerId":sellerId,
            "isAuto":true,
            "itemIds":"",
            "pageSize":mds.moduleData.goods_number?mds.moduleData.goods_number:4,
            "catId":mds.moduleData.category,
            "sort":mds.moduleData.sort,
            "keyWord":mds.moduleData.keyword,
            "startPrice":startPrice,
            "endPrice":endPrice,
          }).then(resp => {