Vue.js watching deep properties

后端 未结 2 743
小蘑菇
小蘑菇 2020-12-21 09:35

I\'m trying to watch properties on a vue.js object, but i\'m not getting the result that i want, my code is the following:

var vueTable = new Vu         


        
2条回答
  •  长情又很酷
    2020-12-21 09:55

    The documentation covers this here.

    Due to the limitations of modern JavaScript (and the abandonment of Object.observe), Vue cannot detect property addition or deletion.

    By starting with an empty object and setting v-model to filters.name, you end up adding a property dynamically. The best approach in this case would be to initialize the property in the data. It doesn't have to have a value.

    data: {
        filters: { name: null },
    }
    

提交回复
热议问题