Suppose I have two data properties:
data() {
return {
a: false,
b: false,
}
}
When a and b become true at the same time, I want to carry out a related task.
How can I use a watch method in Vue to achieve this?
Suppose I have two data properties:
data() {
return {
a: false,
b: false,
}
}
When a and b become true at the same time, I want to carry out a related task.
How can I use a watch method in Vue to achieve this?
It's pretty much the same solution as @Bert suggested. But you can just do the following:
data() {
return {
combined: {
a: false,
b: false,
}
}
},
Then:
watch: {
combined:{
deep:true,
handler
}
}