vue: passing props down to all descendants

后端 未结 6 1092
夕颜
夕颜 2021-01-22 18:36

I have a parent component with the following line


6条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-22 19:23

    You have to declare the props and bind them to pass them to the child. Have a look at https://vuejs.org/v2/api/#v-bind for available options

    specifically, this may be of interest

    
    

    This means you can pass down the object, and have the child parse the appropriate props. This means that the child has to have the props defined in order to catch them. So what you may be able to do is, in the case of the parent, have :propBag="propBag" and inside edit, pass down v-bind="propBag", and that will use the correct props at the child level

提交回复
热议问题