vue: passing props down to all descendants

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

I have a parent component with the following line


6条回答
  •  清酒与你
    2021-01-22 19:06

    Solution possible from Vue 2.2.0

    provide / inject

    This pair of options are used together to allow an ancestor component to serve as a dependency injector for all its descendants, regardless of how deep the component hierarchy is, as long as they are in the same parent chain.

    https://fr.vuejs.org/v2/api/index.html#provide-inject

提交回复
热议问题