关于iView Modal对话框出现" Avoid mutating a prop directly since the value..."错误的解决办法

780 阅读1分钟
  1. iView Modal对话框如果v-model= "modal" 中的modal是一个布尔值,并且这个布尔值是父组件通过 props 传递过来的,那么关闭对话框将会出现下面的错误
    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: "modal"          
    
  2. 解决办法是将modal 换成一个对象如 v-model= "popUps.show",就不会出现上述的问题了。popUps 是通过父组件传递过来的对象