父組件中代碼:javascript
html代碼:html
<el-dialog :visible.sync="isDeliveryDialogShow" width="30%" :before-close="handleClearData"> <delivery ref="ref" :form="form" @isDeliveryDialogClose="isDeliveryDialogClose" ></delivery> </el-dialog>
其中ref="ref" :before-close="handleClearData"java
js代碼:express
handleClearData() { console.log('-----') this.$refs.ref.handleClearData() }
子組件中代碼: this
js代碼:code
handleClearData() { this.$refs['form'].resetFields(); this.express_order_image = ''; this.$emit('isDeliveryDialogClose') console.log('111',this.express_order_image, this.form) },
這樣就能實現子組件提交時內容的清除orm