這是一個很奇怪的問題,我子組件的模態框保存,結果父組件模態框會報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()
}