Is there a method to monitor a specific value within an object that uses a numeric key in Vue2? If the key were a standard string like obj = {keyName: []}
, I am aware that you can achieve this by:
watch: {
'obj.keyName'() {
//Handle array change
}
}
However, what if the object is structured as obj = {1: []}
where the key is a number - it seems that using the same watcher syntax with something like:
'obj[1]'()
and obj.1
results in an error in regular code. Is there an alternative method to configure a watcher specifically for that attribute within the obj
object?