Within my code, I currently have a watcher set up like this (inside <script setup>
):
const form = reactive({
body: '',
image: ''
})
watch(() => form.image, () => {
console.log(form.image)
})
I am looking to enhance this watcher by monitoring two reactive objects simultaneously:
watch(() => (form.image, form.body), () => {
console.log(form)
})
However, it seems that only form.body
is being watched now. I have attempted to follow the guidance from this question's answer, but it does not function the same way as my original watcher in terms of capturing both new and old values. My objective is for the watcher to activate only when both values are updated.