Posts

Showing posts from December 27, 2018

Update data property / object in vue.js

Image
5 is there a way I can programmatically update the data object / property in vue.js? For example, when my component loads, my data object is: data: function () { return { cars: true, } } And after an event is triggered, I want the data object to look like: 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 this gives me the error this.set is not a function . Can someone help? Thanks in advance! javascript vue.js