(Vue3) How to watch and modify array correctly #9131
Unanswered
Irisloverain
asked this question in
Help/Questions
Replies: 2 comments 1 reply
-
watch(selectedFlow, (newValue, oldValue) => {
if (newValue.length === 3) {
console.log("Watch works")
resetSelection(FlowButtonList)
}
},
{
deep: true
}) |
Beta Was this translation helpful? Give feedback.
1 reply
-
Splice works well so I guesse it need to be the deep copy.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I have a question regarding array observation.
For context, when all options are selected, the 'checked' option should return to "All."
I'm using 'Watch' to track the selected option array, but it only works once.
It seems that the way I filter the selected options prevents the watch from tracking correctly.
Should I use a deep copy to modify the reactive array?
I apologize for the lengthy post, and thank you for your time in addressing this.
Kind regards,
Enya
https://github.com/vuejs/core/assets/56682095/db081eee-dee6-4380-bd6a-b392bebca6df
Beta Was this translation helpful? Give feedback.
All reactions