Search code examples
vuejs3vue-composition-api

Vue 3 (compsition API) remove all ref from list of objects with ref (unref deep)


Is there any simple way (without creating custom helpers) to unref(arr) where arr contains objects with ref, computed and other reactive properties?

A simple way is just to iterate the list and the iterate the propries of each object... but there must be a more simple way then this? Im looking for something like

const arr = ref([])

//some code that will fill the arr with objs. props can be ref(someting) or computed

cost req = unref(arr, deep: true)

await api.post(req)

anyone have done this in good way?

/J


Solution

  • I had the same question, so I made: https://www.npmjs.com/package/vue-deepunref