Vuejs : How to pass an object as prop and have the component update sub-objects

前端 未结 5 1314
小鲜肉
小鲜肉 2021-01-02 23:16

I am trying to create a component that accepts an object as prop and can modify different properties of that object and return the value to the parent, using either sync or

5条回答
  •  佛祖请我去吃肉
    2021-01-02 23:38

    Another method without using props could be to access the components attributes $attrs in the child component.

    In parent

    
    

    And in child, the value attribute generated by v-model can be accessed in template as

    $attrs.value.value1
    

    And this is reactive.

    Demo HERE

提交回复
热议问题