In my Vue.js 3 (beta) project, I have created an array using the reactive
function in order to bind its items to various UI components through a loop. This setup has been successful thus far.
However, I now face the challenge of updating a specific value within this array. Due to the fact that Vue.js proxies the array, attempting to use methods like find
or findIndex
directly on it does not yield the desired results; the proxy complicates things as it's not just a straightforward array.
To work around this issue, I decided to first get a raw copy of the array using toRaw
, perform the search operation with findIndex
on the copy, and then update the original array using the index obtained. While this method does achieve the desired outcome, it doesn't feel like the most elegant solution.
Can someone suggest a more efficient approach to tackling this problem?
PS: I am specifically looking for solutions that are compatible with Vue 3, so any advice pertaining to Vue 2.x is not necessary in this case.