收藏
回答

Expect END descriptor with depth 0 but g

报错信息:

Expect END descriptor with depth 0 but get another

Expect START descriptor with depth 2 but get another

对应的报错代码:

toChangeTab:function(e){
       var _this = this;       
       var tabIndex = e.currentTarget.dataset.index;
       var tabs = _this.data.render.tabs;
       tabs.forEach(
           function (value,index){
               tabs[index].isSelected = tabIndex === index;
           }
       );
       if (tabs[tabIndex].tab_type != 'service') {
           _this.setData({
               'render.opacity': 1.0,    
           })
       } else{
           var opacityWelfareTab = _this.data.render.opacityWelfareTab
           _this.setData({
               'render.opacity': opacityWelfareTab,
           })
       }
       _this.setData({
           'render.tabs': tabs,
           'render.selectedTab': tabs[tabIndex],
       })
   },

更改后的代码:

toChangeTab:function(e){
       var _this = this;       
       var tabIndex = e.currentTarget.dataset.index;
       var tabs = _this.data.render.tabs;
       tabs.forEach(
           function (value,index){
               tabs[index].isSelected = tabIndex === index;
           }
       );
       if (tabs[tabIndex].tab_type != 'service') {
           _this.setData({
               'render.opacity': 1.0,
               'render.tabs': tabs,
               'render.selectedTab': tabs[tabIndex]
           })
       } else{
           var opacityWelfareTab = _this.data.render.opacityWelfareTab
           _this.setData({
               'render.opacity': opacityWelfareTab,
               'render.tabs': tabs,
               'render.selectedTab': tabs[tabIndex]
           })
       }
        
   },

实在不知道为什么这样改就对了。。。。。。

求解。

最后一次编辑于  2018-09-11  (未经腾讯允许,不得转载)
回答关注问题邀请回答
收藏

1 个回答

  • 翩若惊鸿
    翩若惊鸿
    2018-09-19

    用wx:for循环自定义组件也会出现,奇怪的是用wepy循环自定义组件却没有问题,此坑不知道怎么解

    2018-09-19
    赞同
    回复