I am curious about the behavior of VueJS2 when using a colon for one-way data binding. In this specific example, I find it interesting that the child component is able to update an array declared in the parent component even though it was passed down as a prop (which should be one-way binding).
https://jsfiddle.net/ecgxykrt/
<script src="https://unpkg.com/vue"></script>
<div id="app">
<span>Parent value: {{ dataTest }}</span>
<test :datatest="dataTest" />
</div>
var test = {
props: ['datatest'],
mounted: function() {
this.datatest.push(10)
},
render: function() {}
}
new Vue({
el: '#app',
components: {
'test': test
},
data: function() {
return {
dataTest: []
}
}
})
Any insights on this would be greatly appreciated!