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
For me this is a polite solution to get one specific prop(s) changes and create logic with it
I would use props
and variables computed
properties to create logic after to receive the changes
export default {
name: 'getObjectDetail',
filters: {},
components: {},
props: {
objectDetail: { // <--- we could access to this value with this.objectDetail
type: Object,
required: true
}
},
computed: {
_objectDetail: {
let value = false
// ...
// if || do || while -- whatever logic
// insert validation logic with this.objectDetail (prop value)
value = true
// ...
return value
}
}
So, we could use _objectDetail on html render
<span>
{{ _objectDetail }}
</span>
or in some method:
literallySomeMethod: function() {
if (this._objectDetail) {
....
}
}