Subscribe on changes!

If someone want to merge default value and real value

avatar
Jun 14th 2022

What problem does this feature solve?

when i do coding work if find one problem very unconvinent. when the parent dom transfer props to child dom, if i want to transfer an object,but some property is empty, i cannot use the default value instead .

What does the proposed API look like?

image image image such as this problem, i use props but lack of property,only transfer title prop,but lack of width prop, what i want is to merge width prop as default but use title prop as i transfered

avatar
Jun 14th 2022

image that is what i want ,i want to merge real value and default value , even if real value lack of some property

avatar
Jun 14th 2022

It can be solved in userland with a computed property and a deep-merging function (e.g. defu).

avatar
Jun 15th 2022

It can be solved in userland with a computed property and a deep-merging function (e.g. defu).

it is solved my problem already tks. but i need to import new lib defu , althought it is worked , but need to define a new variable. what if we handle this logic in props? maybe we can integrate defu's main logic in props function? image

avatar
Jun 15th 2022

It will be a breaking change and it's easy enough to find a userland solution so I don't think we'll include this in core.