收藏
回答

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]
           })
       }
        
   },

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

求解。

回答关注问题邀请回答
收藏

1 个回答

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

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

    2018-09-19
    有用
    回复
登录 后发表内容