Res method call subcomponents


<dynamic :key="index" v-for="(item,index) in initData" :ref="'dynamic'+index" />
console.log(this.$refs.testCom); VueComponent {_uid: 3, _isVue: true, $options: {…}, _renderProxy: Proxy, _self: VueComponent, …}
console.log(this.$refs.dynamic0); [VueComponent]

1, a single component of this $ refs.name an object is selected, it can call this method directly as refs.testCom.say $ ();.
. 2, this $ refs.name traversing component selected from the is an array, you need to call this method this $ refs.dynamic0 [0] .say ( );. [ref although when given name is unique, but still generates an array]

Guess you like

Origin www.cnblogs.com/hyx626/p/11231598.html