<my-component>something</my-component>
<!--怎么在my-component里获得something ??-->
<parent-component>
<my-component>
<child1></child1> <!--怎么在my-component里获得child1 ??-->
</my-component>
<my-component>
<child2></child2> <!--怎么在my-component里获得child2 ??-->
</my-component>
<parent-component>
在React里是通过this.props.children
获得
通过v-ref
只能在定义template
的时候才能静态获得子对象
大家讲道理2017-04-10 17:14:20
解决这个问题使用的是Solt
http://vuejs.org/guide/components.html#Content_Distribution_with_Slots
http://cn.vuejs.org/guide/components.html#u4F7F_u7528_Slot__u5206_u53D1_u5185_u5BB9