报错 You may have an infinite update loop in a component render function.

问题出现原因:动态变换数据的时候,我将变换的内容写在了其他函数中导致报You may have an infinite update loop in a component render function.(你可以在组件呈现函数中有一个无限更新循环。)

错误代码: 

<el-tooltip class="item" content="创建费后指数" placement="top">  
  <el-button class="mr-10" :disabled="!showControlType(scope.row)" type="text" @click="showAfterFeesIndexDialog(scope.row)">费</el-button>  
</el-tooltip>  
<el-tooltip class="item" :content="showMoveCommonIndexIcon ? '移出常用指数' : '加入常用指数'" placement="top">  
  <el-link type="primary" class="mr-10" :class="showMoveCommonIndexIcon?'el-icon-document-delete':'el-icon-document-add'" :underline="false" @click="moveCommonIndexHandler(scope.row)" />  
</el-tooltip>


data(){
    return {
        showMoveCommonIndexIcon:"

    }
}

mehtods:{
    showControlType(row) {  
      const label = row.label  
      if (label) {  
        const labelArr = label.split(',')  
        const showControlType = labelArr.some(_ => {  
          return _ === '组合指数' || _ === '我的指数' || _ === '费后指数'  
        })  
        const showMoveCommonIndexIcon = labelArr.includes('常用指数')  
         this.showMoveCommonIndexIcon = showMoveCommonIndexIcon
        return showControlType  
      }  
    }
}

我将动态判断showMoveCommonIndexIcon 的代码写在了另一个动态判断的函数showControlType中导致报错

解决方法:就是将动态判断的代码写在自己的函数中

<el-tooltip class="item" :content="showMoveCommonIndexIcon(scope.row) ? '移出常用指数' : '加入常用指数'" placement="top">  
  <el-link type="primary" class="mr-10" :class="showMoveCommonIndexIcon(scope.row)?'el-icon-document-delete':'el-icon-document-add'" :underline="false" @click="moveCommonIndexHandler(scope.row)" />  
</el-tooltip>

showMoveCommonIndexIcon(row) {  
  const label = row.label  
  if (label) {  
    const labelArr = label.split(',')  
    const showMoveCommonIndexIcon = labelArr.includes('常用指数')  
    return showMoveCommonIndexIcon  
  }  
},

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值