Vue 错误:Avoid mutating a prop directly

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

这个错误是因为,因为我们直接修改父组件传递过来的参数,这样会存在影响外部 组件的风险。

解决方案:

在组件内部再构建一套属性域,来存储父组件传递过来的参数,从而与外界解耦

posted @ 2018-07-26 09:24  FeelRose  阅读(4062)  评论(0编辑  收藏  举报