解决[Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent
❤️砥砺前行,不负余光,永远在路上❤️
目录
- 前言
- 一、使用watch
- 二、
前言
[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: “previewList”
一、使用watch
watch: {previewList: {handler(val) {console.log(val, 'val');this.fileList = val;},immediate: true,},},

网上好多说是直接data中赋值给另外一个变量,好像没用,我这直接改previewList的话就会报错,使用watch监听一下然后赋值给fileList就好了,修改的时候直接改fileList就可以。


二、
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
