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

02-27 阅读 0评论

在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"

avoid mutating a prop directly since the value will be overwritten whenever完美解决,avoid mutating a prop directly since the value will be overwritten whenever完美解决,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,修改,第1张
(图片来源网络,侵删)

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

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完美解决,avoid mutating a prop directly since the value will be overwritten whenever完美解决,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,修改,第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完美解决,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,修改,第4张
(图片来源网络,侵删)

免责声明
本网站所收集的部分公开资料来源于AI生成和互联网,转载的目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。
文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

发表评论

快捷回复: 表情:
评论列表 (暂无评论,人围观)

还没有评论,来说两句吧...

目录[+]