REPL
<script>
export default {
computed: {
b: a => a + 1
},
oncreate() {
let obj = { a: 1 };
this.set( obj );
console.log( obj );
}
}
</script>
This logs { a: 1, b: 2 }.
I have an app where I have an array of different objects that I pass to component.set as appropriate. The computed property is getting assigned into the object that's passed in. Calling component.set again with a previously used (and mutated) object is a problem when dev mode is enabled, because attempting to set the read-only computed property throws an error.
REPL
This logs
{ a: 1, b: 2 }.I have an app where I have an array of different objects that I pass to
component.setas appropriate. The computed property is getting assigned into the object that's passed in. Callingcomponent.setagain with a previously used (and mutated) object is a problem when dev mode is enabled, because attempting to set the read-only computed property throws an error.