做法:
- before-close 事件中,调用 resetFields
- 取消按钮事件中,调用 resetFields
<el-dialog title="弹出窗口" :visible.sync="bindDialogVisible" :before-close="handleBeforeClose">
<el-form :model="bindForm" :rules="rules" ref="bindForm">
<el-form-item label="作者id" prop="member_id">
<el-input v-model.trim="bindForm.member_id" size="small" class="id_input"></el-input>
</el-form-item>
<el-form-item label="用户id" prop="c_id">
<el-input v-model.trim="bindForm.c_id" size="small" class="id_input"></el-input>
</el-form-item>
</el-form>
<p slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm()">确认绑定</el-button>
<el-button @click="cancelDialog">取 消</el-button>
</p>
</el-dialog>
methods: {
cancelDialog () {
this.bindDialogVisible = false
this.$refs['bindForm'].resetFields();
},
handleBeforeClose (done) {
this.$refs['bindForm'].resetFields()
done()
}
}