Example 1
const newCount = computed(() => {
return a + b
})
const formState = ref({
name: '...',
count: newCount
})
// deep relieve
const onSubmit = () => {
const data = deepUnref(formState)
/*
{
name: '...',
count: 1
}
*/
}
Example 2
const skus = ref([
// ...
])
const tables = ref([])
const generateTables = () => {
skus.map(item => {
return {
title: computed(() => item.title),
// .....
}
})
}
generateTables()
// deep relieve
const onSubmit = () => {
const data = deepUnref(tables)
/*
[
{
title: '...',
//....
}
]
*/
}