ref 用 v-for创建调用子组件报错问题

<son v-for="(item, index) in data" :key="index" :ref="item.ref" />
// 子组件加上key值, 调用加上对应的下标,如果还不行加上setTimeout.
this.$refs.refSon[index].init()  //refSon  ref名  index对应的下标

 

posted @ 2021-12-13 11:57  Webwhl  阅读(68)  评论(0编辑  收藏  举报