代码
<!-- 完工申请start -->
<div v-if="applyShow">
<finish-apply ref="finishApply"
:show.sync="applyShow"
@on-close="onAddDialogClosed"
:parent-form="form"
:is-edit="isEdit"
:is-add="isAdd"
:is-apply="isApply"
:org-user-list="orgUserList"
@refreshData="getList"
>
</finish-apply>
发生过程
当父组件去掉该组件中的方法时 报错 该方法找不到 后来打印 this.$refs['finishApply'] 为空
解决
应该加载问题 组件加了if 判断
当组件渲染完毕后在执行相应的业务 加上this.$nextTick() 就好了
apply({ row }) {
const obj = { ...row }
this.form = obj.completionApply
this.applyShow = true
this.addShow = false
this.isEdit = false
this.isApply = true
this.$nextTick(() => {
this.$refs['finishApply'].approvalRecordsList(obj.completionApply)
})
},