0đź‘Ť
You can’t “watch” a computed value because a computed value is already dynamic.
If you want to perform some logic basic on a computed value, then just use it to do so:
<h1 v-if="isEllipsisActive">{{ title }}</h1>
You don’t need to “watch” your computed value just to set yet another boolean.
- [Vuejs]-V-for not working when building array from external JSON file
- [Vuejs]-Django rest framework websockets auto update
0đź‘Ť
you can try this way and see if trigger the watch for you
watch: {
isEllipsisActive: {
deep: true
handler(now){
this.h1 !== null && console.log('changed')
}
}
since your computed value is in the same component that you are trying to watch the change performed you should not need to do that. Or you can watch one of the values and perform all the logic you need inside the watcher. But As @Dan say in another comment, sometimes we need to watch those computed values. I use this logic when I want to execute extra code after the computed getter from Vuex trigger changes.
- [Vuejs]-Edit row in PrimeVue dataTable strips image tag
- [Vuejs]-Debugging node/prime vue webapp in vs code not hitting break points
Source:stackexchange.com