Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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");
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #vue #watch #handler
ADD COMMENT
Topic
Name
3+6 =