In the VueJs 2.0 docs I can\'t find any hooks that would listen on props
changes.
Does VueJs have such hooks like onPropsUpdated()
or simi
You can watch
props to execute some code upon props changes:
new Vue({
el: '#app',
data: {
text: 'Hello'
},
components: {
'child' : {
template: `{{ myprop }}
`,
props: ['myprop'],
watch: {
myprop: function(newVal, oldVal) { // watch it
console.log('Prop changed: ', newVal, ' | was: ', oldVal)
}
}
}
}
});