<el-dialog :visible.sync="dialogVisible" width="60%" :before-close="handleClose">
<draw :child="child" :popResId="popResId" :drawData='drawData' @reload='reload' ref='draw' />
</el-dialog>
当弹窗组件里面包裹子组件时候,第一次渲染子组件数据未渲染,子组件接收到的是undifined。
解决方法:
在弹窗为true后用this.$nextTick来更新
handleOpen(data, index) {
this.dialogVisible = true
this.$nextTick(() => {
this.child = true
this.popResId = data.resId
this.drawData.index = index
this.drawData.isReport = !this.drawData.isReport
this.drawData.resId = data.resId
})
},