Vue: Can watchers be used to watch a computed property?

Viewed 1466

I am trying to see if I can use a watcher method to look for a change in a computed property rather than watching the individual store properties here. Would that work or can they only be used on data properties and props?

computed: {
      optionsTrue() {
            return this.$store.getters.getOption1IsTrue && this.$store.getters.getOption2IsTrue
      } 
},
watch: {
     optionsTrue(newVal) {
         // would this work to check when the value of the computed property has changed or can watcher only watch data properties?
     }

}

1 Answers

Working code

computed: {
  completed: function () {
     return this.required && this.textAnswer !== '';
  },
},
watch: {
  completed: function(val) {
    console.log(val)
  }
}
Related