How to listen for 'props' changes

前端 未结 13 1536
无人及你
无人及你 2020-11-30 17:27

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

13条回答
  •  时光取名叫无心
    2020-11-30 18:10

    I use props and variables computed properties if I need create logic after to receive the changes

    export default {
    name: 'getObjectDetail',
    filters: {},
    components: {},
    props: {
        objectDetail: {
          type: Object,
          required: true
        }
    },
    computed: {
        _objectDetail: {
            let value = false
            ...
    
            if (someValidation)
            ...
        }
    }
    
    

提交回复
热议问题