I need to force re-render component on update to be able to call FB.XFBML.parse(). However, no matter what I do I am not able to invoke any lifecycle hook beforeUpdate/updated when a property updated. (According to docs it only listens for data updates which props obviously aren't).
<template>
<div>
{{myProp}}
</div>
</template>
<script>
export default {
props: ['myProp'],
watch: {
myprop: function(newVal, oldVal) { // watch it
console.log('Prop changed: ', newVal, ' | was: ', oldVal)
}
},
updated(){ // never invoked},
beforeUpdate(){ // never invoked }
}
</script>
I can see that the property channel changed when sending different values from a parent component.
Is there a hook to listen for props changes?
Update
As @chris suggested, I tried to watch my property but nothing changed. Then I realized that I've got a special case:
<template>
<child :my-prop="myProp"></child>
</template>
<script>
export default {
props: ['myProp']
}
</script>
I am passing myProp that the parent component receives to the child component. Then the watch: {myProp: ...} is not working.
myProp. I just need to know when it changed. When it a newmyPropwas sent from a "higher" (not only parent) component. - Amio.iopropismyPropbut you're watchingmyprop(lower-case). - ZachB