在vue父组件传递数据给子组件时候,通过双向绑定给属性赋值时候,报错如下:Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "content"

1、报错详情
[Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "items_index"

2、错误原因

改动了子组件中引用的父组件的变量,也就是props中的数据

在Vue2中组件props中的数据只能单向流动,即只能从父组件通过组件的DOM属性attribute传递props给子组件,子组件只能被动接收父组件传递过来的数据,并且在子组件中,不能修改由父组件传来的props数据。

3、解决方案avoid mutating a prop directly since the value will be overwritten whenever

不要直接修改从父组件传过

avoid mutating a prop directly since the value will be overwritten whenever完美解决相关推荐

  1. Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-

    原因: 子组件改了父组件的值 避免修改父组件传过来的值 注意: 如果value是obj,需要进行深拷贝. 可以参考: https://blog.csdn.net/u013948858/article/ ...

  2. [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever...

    报错 [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the paren ...

  3. Avoid mutating a prop directly since the value will be overwritten whenever

    Avoid mutating a prop directly since the value will be overwritten whenever the parent component re- ...

  4. vue使用prop通信出错:Avoid mutating a prop directly since the value will be overwritten whenever the parent

    使用props进行父子组件通信时产生错误:Avoid mutating a prop directly since the value will be overwritten whenever the ...

  5. vue 报错avoid mutating a prop directly since the value will be overwritten whenever

    这里写自定义目录标题 avoid mutating a prop directly since the value will be overwritten whenever 子组件修改父组件值时报的错 ...

  6. 报错信息:Avoid mutating a prop directly since the value will be overwritten

    报错信息:Avoid mutating a prop directly since the value will be overwritten whenever the parent componen ...

  7. Avoid mutating a prop directly since the value will be overwritten whenever the parent ...

    错误:[Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the paren ...

  8. 【VUE】异常解决:Avoid mutating a prop directly since the value will be overwritten

    author: date: 2021.07.03 文章目录 1. 需求及报错 2. 分析原因 2.1 这是什么原因造成? 3. 解决方案: 使用 v-on 明确实现修改方式 4. 参考 1. 需求及报 ...

  9. 【VUE】异常解决:Avoid mutating a prop directly since the value will be overwritten ...

    author: jwensh date: 2021.07.03 文章目录 1. 需求及报错 2. 分析原因 2.1 这是什么原因造成? 3. 解决方案: 使用 v-on 明确实现修改方式 4. 参考 ...

最新文章

  1. ios cocopods 安装使用及高级教程
  2. 每位开发人员都应铭记的10句编程谚语 (我超喜欢,转载了)
  3. Android入门(九)文件存储与SharedPreferences存储
  4. 【Linux】 iptables vs firewalld
  5. 【Linux】一步一步学Linux——whatis命令(14)
  6. 40动态数组:打印锯齿矩阵
  7. 电脑端腾讯视频如何设置离线下载完成后自动关机
  8. Python报错: RuntimeError: The current Numpy installation (‘D:\\Develop\\anaconda\\lib\\site-packages\\
  9. java LinkedList(链表)
  10. 微信小程序云开发教程-微信小程序的JS高级-页面间数据传递
  11. Java 笔试练习 01: T1~19
  12. 编写站点robots文件
  13. 阿里数据港张北数据中心项目本月底运营
  14. nape.geom.MarchingSquares
  15. 计算机能用到的英语积累(持续更新)
  16. 设计模式之观察者模式、中介者模式、迭代器模式、访问者模式、备忘录模式、解释器模式
  17. win10哪里看计算机配置,Win10如何查看电脑配置信息?
  18. 亚马逊营销和运营手法的运用知多少?
  19. 学习xpath解析用的代码
  20. Vue 开发必须知道的 36 个技巧【近1W字】

热门文章

  1. SpringBoot整合SpringDataElasticSearch 完成地理搜索 附近人搜索 距离搜索
  2. python内置函数用来返回列表、元组、字典_python程序设计第一章基础知识 题库及选解...
  3. mysql使得df和du不一致_df和du显示的磁盘空间使用情况不一致的原因及处理
  4. Qt多线程http下载器之一:仿百度网盘的http下载器
  5. 雷锋网特约专访易科成志创始人、CEO潘真
  6. 马云点了人类史上最贵“外卖”,又一场“三国杀”即将来临?
  7. 【微信】一、微信开发环境
  8. MWC就快到来!5G、物联网应用以及折迭手机为本次焦点
  9. 云虎拜年,好运连连!虎年限定三件套来啦
  10. 利用matplotlib实现TMDB电影数据可视化