vue往组件中传值,值在组件内如何实现修改

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: "type"
  • 这是 Vue 的一个警告提示,意思是应该避免直接修改一个传入的 prop 值。因为当父组件重新渲染时,prop 的值会被覆盖,并且可能导致出现意料之外的问题。
    如果需要在子组件中修改 prop 的值,可以通过以下方式解决:


posted @ 2023-04-18 09:07  盘思动  阅读(105)  评论(0编辑  收藏  举报