i have array inside object
Vue.component('greeting', {
template: '<button @click="cool">getdate! </button> ',
data :function () {
return {
message:"15/10/1999",
}
},
methods:{
cool(){
this.$parent.info.date.push(this.message);
}
}
});
var vm = new Vue({
el: '#app',
data:{
name:"",
info:{
date:[]
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<greeting></greeting>
{{info.date}}
</div>
I sent date from component it works fine but watch won't work.
how to use watch in this case in vuejs