Avoid mutating a prop directly since the value will be overwritten

前端 未结 11 917
被撕碎了的回忆
被撕碎了的回忆 2020-12-10 01:07

I have very common problem with upgrading to Vue 2.0

I am getting warning:

Avoid mutating a prop directly since the value will be overwritte

11条回答
  •  感动是毒
    2020-12-10 02:06

    A computed property with appropriate get and set worked for me:

    computed: {
      dialogDataProp: {
          get: function() {
            return this.dialog;
          },
          set: function() {}
        }
    }
    

    Code above for toggling a dialog box.

提交回复
热议问题