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: “drawer”

element-ul抽屉模块的时候经历这样一个错误片段,已解决
错误:避免直接改变属性,因为每当父组件重新渲染时,该值都将被覆盖。相反,请使用基于属性值的数据或计算属性(子组件不可直接修改父组件传递的Prop值,单向数据流,易于监测数据的流动,出现了错误可以更加迅速的定位到错误发生的位置)。

更简单来说呢 就是一个父组件并不是只有你一个子组件,如果每一个子组件都可以修改父组件的值,那么我们需要定位的错误很难统一。

所以我们把修改数据的权限交付给父组件,才能最快以及准确的定位我们的错误,从而保证了数据源的唯一性。

父组件:

子组件:

Avoid mutating a prop directly子传父报错解决相关推荐

  1. 【vue报错】【子组件改变父组件数据】 Avoid mutating a prop directly since

    [vue报错] Avoid mutating a prop directly since the value will be overwritten whenever the parent compo ...

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

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

  3. [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 ...

  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 overwwritten whenever the parent及解决方案

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

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

    在vue父组件传递数据给子组件时候,通过双向绑定给属性赋值时候,报错如下:Avoid mutating a prop directly since the value will be overwrit ...

  7. 【vue warning】avoid mutating a prop directly

    [vue warning] avoid mutating a prop directly 一.问题描述 使用props,通过父组件给子组件传值,子组件在使用props中的属性时,直接对props中的属 ...

  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. Office2010启动慢的解决方法
  2. Dropout也能自动化了,谷歌大神Quoc Le等人利用强化学习自动找寻模型专用Dropout...
  3. Object.entries(obj)
  4. 抖音:我“弱”我有理
  5. Kindeditor图片上传Controller
  6. MySql 1067错误
  7. linux下飞信安装详细过程
  8. 计算机应用技术头像,意大利科学家应用计算机技术进行头像复原
  9. matlab白化代码,[支持m_map白化] MATLAB对地图进行白化
  10. PHP编译安装常见错误解决
  11. AVG提醒:网银大盗疯狂肆虐阿里旺旺
  12. 源码分析Dubbo监控中心实现原理
  13. 洛谷P3336 [ZJOI2013]话旧 题解
  14. 基于上下文感知计算的APT攻击组织追踪方法
  15. 树莓派桌面多出个计算机,树莓派|计算机实验室之树莓派:课程 9 屏幕04
  16. Docker三剑客——Docker Compose
  17. 摄像头8mm可以看多远_解析智能监控摄像头的监控可视范围及距离
  18. can和could的用法_can和could情态动词的用法
  19. tensorflw视频
  20. SCU软件设计与体系结构第三次测试试卷

热门文章

  1. Win8.1安装与初次体验(图赏)
  2. 从南极到你家,易开得,一支“中国芯”的奇幻漂流
  3. iOS 渐变色 以及 镂空效果的实现(Mask的妙用)以及镂空文字的实现
  4. Harmonious Graph
  5. AutoCAD在指定布局中如何隐藏指定的图形?
  6. GeoScene Pro 2.1下载地址与安装基本要求
  7. 名帖14 吴让之 篆书《吴均帖》
  8. Centos7设置1920x1080分辨率
  9. Maven 入门学习.md
  10. 17.答题卡识别判卷