VueJS pass props to children in render function call

后端 未结 1 1522
甜味超标
甜味超标 2021-01-14 21:03

I have a parent component that wraps multiple children \'child\'. I want the parent to essentially have the same template as the vanilla markup which is why I am using the r

1条回答
  •  有刺的猬
    2021-01-14 21:30

    First of all, I think that this.$props will always be undefined. The $props property is accessible in a template like {{ $props }}, but those inline properties (frustratingly) don't always map up directly to the this variable available in the component's script. You can see the component's prop values using this.$options.propsData.

    Secondly, you can use item.componentOptions.propsData to set the property values of the child component. (I think item.data.props is a misnomer referencing something else). Here's a fiddle with the change.

    0 讨论(0)
提交回复
热议问题