I am using VueJS and what I want to do is update data everytime props change.
my code is blow
template code:
<div id="app">
<input type="text" v-model="hello">
<my-component :message="hello"></message>
</div>
vue code:
var Child = {
template: '<div>props: {{message}} data: {{msg.value}}</div>',
props: {
message: {
type: String
}
},
data: function () {
return {
msg: {
value: this.message
}
}
}
}
new Vue({
el: '#app',
data: function () {
return {
hello: 'Hello World !!!'
}
},
components: {
myComponent: Child
}
})
result:
I found out that String Type Props passed by parent component doesn't update data.
I think it seems like observer issue. please give any idea.