87
rated 0 times
[
88]
[
1]
/ answers: 1 / hits: 45267
/ 8 Years ago, sun, november 6, 2016, 12:00:00
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!
More From » vue.js