You may have an infinite update loop in a component render function问题解决

今天在用的vue的时候,碰到一个问题,在计算属性中修改data()中的属性时,会报这个错,“You may have an infinite update loop in a component render function”,导致页面无法打开

// An highlighted blockdata() {return {statusStyle:""};},computed: {_status() {return function (status) {switch (status) {case 0:this.statusStyle = "status-init";break;case 1:this.statusStyle = "status-running";break;case 2:this.statusStyle = "status-stopped";break;default:break;}return statusStyle;}},}

修改后的代码

 computed: {_status() {return function (status) {var statusStyle = "";switch (status) {case 0:statusStyle = "status-init";break;case 1:statusStyle = "status-running";break;case 2:statusStyle = "status-stopped";break;default:break;}return statusStyle;}},

简单分析了下,vue中的data()中的属性值本来就是受监控的,如果属性值变化,就可能触发计算属性进行计算,所以在计算属性中修改data()中的属性值,就可能触发无限循环,这也是报这个错误的原因,所以建议在计算属性中避免对data()中的属性值进行修改。

You may have an infinite update loop in a component render function问题解决相关推荐

  1. VUE+ELEMENT:表格渲染导致的 异常:You may have an infinite update loop in a component render function

    场景: 做一个全文检索,检索到的记录显示到el-table表中,这本是一个简单的问题.后面要对检索的Key在记录中做高亮显示,遇到了这个异常. 百度一下,很吓人.可能有无限更新循环,这怎么行,听着这得 ...

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

    1. 报错代码 <ul><liv-for="item in rankList":key="item.ID"><sparklineB ...

  3. 工作214:结构 vue操作一个很有意思的报错 [Vue warn]: You may have an infinite update loop in a component

    结构 vue操作一个很有意思的报错 [Vue warn]: You may have an infinite update loop in a component render function. 代 ...

  4. [Vue warn]: You may have an infinite update loop in watcher with express

    echarts中option的data传数组,千万不要对数组进行操作. 否则会出bug you may have an infinite update loop in watcher with exp ...

  5. 【Bug解决】Can‘t perform a React state update on an unmounted component. This is > a no-op, but it...

    在 React 应用程序中我们遇到以下警告消息: Can't perform a React state update on an unmounted component. This is a no- ...

  6. Warning: Can‘t perform a React state update on an unmounted component. This is a no-op, but it indic

    问题描述: 报错信息:Warning: Can't perform a React state update on an unmounted component. This is a no-op, b ...

  7. 执行sudo apt-get update时,不再含有release文件问题解决

    问题描述 在执行sudo apt-get update时,显示如下错误: 命中:1 http://dl.google.com/linux/chrome/deb stable InRelease 命中: ...

  8. Java SE 7 Update 17的安装配置及相关问题解决

    Java SE 7 Update 17 小声说 Eclipse Java EE集成开发环境 下载 安装 配置 总结 小声说 首先非常感谢大家的认可,近一周来收到些私信,有些没及时回复十分不好意思,但是 ...

  9. react报错Can‘t perform a React state update on an unmounted component. This is a no-op, but it indicat

    我们在react开发中经常遇到这个报错: 经过查阅资料后解决了这个报错,在这里记录一下. 这句话大概意思是:我们不能在组件销毁后设置更新状态state,防止出现内存泄漏的情况 关于react中切换路由 ...

最新文章

  1. 黄聪:Microsoft Enterprise Library 5.0 系列教程(二) Cryptography Application Block (高级)
  2. 熟悉常用的HBase操作
  3. 浮点转字符串性能比较
  4. JavaScript事件的捕获阶段(Capture phase)
  5. OSI七层-相关协议
  6. 《统计学》学习笔记之分类数据分析
  7. 一个微信公众号接入另一个微信公众号的内容
  8. 19 MM配置-BP业务伙伴-定义编码范围
  9. Apple Pay 支付集成
  10. pytorch相关用法
  11. response下载zip文件
  12. 外置硬盘一插就卡_为什么电脑一插移动硬盘就卡死了?
  13. 001 计算思维-卡内基梅隆大学计算机系主任周以真(英汉对照版)
  14. 《毒液·致命守护着》
  15. rabbitmq入门(四)Topics主题模式
  16. caffe-ristretto:定点举例
  17. 2021年电商企业倒闭名单
  18. Exceeded maximum number of retries. Exhausted all hosts available for retrying build failures
  19. echarts5.0新特性
  20. 计算机网络考研怎样学,计算机网络考研教学视频推荐

热门文章

  1. 即将开业的影院,20 亿美刀的元気森林和「五环外」的钉钉|极客一周
  2. enumerate()是什么意思?
  3. 第三章:JQuery
  4. 解决GitHub限速问题
  5. pandas学习笔记(四)
  6. sscanf 其实很强大
  7. 用python写一个程序控制其它软件_程序员:利用Python实现可控制肉鸡的反向Shell...
  8. 软件系统测试方法有哪些?
  9. 工伤事故的人为原因有哪些
  10. 小米M2 M2S刷机包电信版/AOSB/4.4.4/归属地/分屏/稳定版/截图