Setup data overwrites data in component
What problem does this feature solve?
It allows the api composition function to set values for variables in data
, and if the api composition function does not allow them, then data() in the component can set them in default.
What does the proposed API look like?
export default {
name: 'job-edit',
setup() {
const data = reactive({
id: 42,
});
return data;
},
data() {
return {
id: null,
}
}
I want the value to be 42
, rather than null
.
This is expected and you should not combine the composition api with the option api.
Remember to use the forum or the Discord chat to ask questions!