Is there a way to programmatically update an object / property datain vue.js? For example, when my component loads, my data object:
data: function () {
return {
cars: true,
}
}
And after triggering the event, I want the object to datalook like this:
data: function () {
return {
cars: true,
planes: true
}
}
I tried:
<script>
module.exports = {
data: function () {
return {
cars: true
}
},
methods: {
click_me: function () {
this.set(this.planes, true);
}
},
props: []
}
</script>
But that gives me an error this.set is not a function. Can anyone help?
Thanks in advance!
source
share