vuejs / docs-next-zh-cn

:cn: Chinese translation for v3.vuejs.org
https://v3.cn.vuejs.org
MIT License
951 stars 851 forks source link

bug: vue3.2.29通过v-for显示component组件通过ref调用子组件方法时提示子组件方法为undefined #872

Closed zwyao314 closed 2 years ago

zwyao314 commented 2 years ago

代码:


  this.tabs.forEach(tab => {
    let formRef = this.$refs[tab.key];
    if (tab.isForm) {
      let formValidator = formRef.validateForm();  // 该子组件的方法为undefined
    }
  });
zwyao314 commented 2 years ago

请求修正