element中对话框取消 表单验证重置

<el-dialog title="充值/冲帐页面" :visible.sync="dialogFormVisible" @close="closeDialog" >

<el-form :model="ruleForm" :rules="rules" ref="contentForm">

添加一个close事件,通过给form一个ref值找到该表单重置

closeDialog(){

this.$refs['contentForm'].resetFields();

},


2. <div slot="footer" class="dialog-footer">

<el-button @click="cancelRecharge('contentForm')">取 消</el-button>

<el-button type="primary" @click="sureRecharge('contentForm')">确 定</el-button>

</div>

点击取消重置

cancelRecharge(formname){

this.dialogFormVisible =false;

this.$refs[formname].resetFields();

},

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容