You may have an infinite update loop in a component render function问题解决
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问题解决相关推荐
- VUE+ELEMENT:表格渲染导致的 异常:You may have an infinite update loop in a component render function
场景: 做一个全文检索,检索到的记录显示到el-table表中,这本是一个简单的问题.后面要对检索的Key在记录中做高亮显示,遇到了这个异常. 百度一下,很吓人.可能有无限更新循环,这怎么行,听着这得 ...
- You may have an infinite update loop in a component render function.
1. 报错代码 <ul><liv-for="item in rankList":key="item.ID"><sparklineB ...
- 工作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. 代 ...
- [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 ...
- 【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- ...
- 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 ...
- 执行sudo apt-get update时,不再含有release文件问题解决
问题描述 在执行sudo apt-get update时,显示如下错误: 命中:1 http://dl.google.com/linux/chrome/deb stable InRelease 命中: ...
- Java SE 7 Update 17的安装配置及相关问题解决
Java SE 7 Update 17 小声说 Eclipse Java EE集成开发环境 下载 安装 配置 总结 小声说 首先非常感谢大家的认可,近一周来收到些私信,有些没及时回复十分不好意思,但是 ...
- react报错Can‘t perform a React state update on an unmounted component. This is a no-op, but it indicat
我们在react开发中经常遇到这个报错: 经过查阅资料后解决了这个报错,在这里记录一下. 这句话大概意思是:我们不能在组件销毁后设置更新状态state,防止出现内存泄漏的情况 关于react中切换路由 ...
最新文章
- 黄聪:Microsoft Enterprise Library 5.0 系列教程(二) Cryptography Application Block (高级)
- 熟悉常用的HBase操作
- 浮点转字符串性能比较
- JavaScript事件的捕获阶段(Capture phase)
- OSI七层-相关协议
- 《统计学》学习笔记之分类数据分析
- 一个微信公众号接入另一个微信公众号的内容
- 19 MM配置-BP业务伙伴-定义编码范围
- Apple Pay 支付集成
- pytorch相关用法
- response下载zip文件
- 外置硬盘一插就卡_为什么电脑一插移动硬盘就卡死了?
- 001 计算思维-卡内基梅隆大学计算机系主任周以真(英汉对照版)
- 《毒液·致命守护着》
- rabbitmq入门(四)Topics主题模式
- caffe-ristretto:定点举例
- 2021年电商企业倒闭名单
- Exceeded maximum number of retries. Exhausted all hosts available for retrying build failures
- echarts5.0新特性
- 计算机网络考研怎样学,计算机网络考研教学视频推荐