element-ui报错Cannot read property 'resetFields' of undefined

这是一个很奇怪的问题,我子组件的模态框保存,结果父组件模态框会报element-ui报错Cannot read property 'resetFields' of undefined
原因是我table数据渲染了,可是我模态框还没有mounted
解决办法
第一个,不太成功

   this.$nextTick(() => {
         this.$refs['pointForm'].resetFields()
       })

第二个方法如下,成功

    if (this.$refs['pointForm'] !== undefined) {
        this.$refs['pointForm'].resetFields()
      }
原文地址:https://www.cnblogs.com/smart-girl/p/12133644.html