“vue watch handler” Kode Jawaban

vue watch handler

data: function ()  {
    return {
       questions: []
    }
},
    
watch: {
   questions: {
       handler: function(val, oldVal) {
           this.foo(); // call it in the context of your component object
       },
       deep: true
    }
},      
    
methods: {
    foo() {
        console.log("foo called");
    }
}
Suman Majhi

Set Vuejs

Vue.set(vm.someObject, 'propertyName', value)
// Or using alias
this.$set(this.someObject, 'propertyName', value)
// For an array, simply repalce propertyName with the index
this.$set(this.someArray, indexOfItem, value)
// Or assign new props to an object
this.someObject = Object.assign({}, this.someObject, { a: 1, b: 2 })
SmokeFrog

Jawaban yang mirip dengan “vue watch handler”

Pertanyaan yang mirip dengan “vue watch handler”

Lebih banyak jawaban terkait untuk “vue watch handler” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya