表单重置

This commit is contained in:
xing 2020-06-16 11:26:06 +08:00
parent 13d6786499
commit 2d4abadfa8

View File

@ -4,7 +4,7 @@
<div class="avatar"> <div class="avatar">
<img src="../assets/logo.png" alt="logo"> <img src="../assets/logo.png" alt="logo">
</div> </div>
<el-form class="login-from" :rules="loginFormRules" :model="loginForm"> <el-form ref="loginFormRef" class="login-from" :rules="loginFormRules" :model="loginForm">
<el-form-item prop="username" label=""> <el-form-item prop="username" label="">
<el-input v-model="loginForm.username" prefix-icon="iconfont icon-user"></el-input> <el-input v-model="loginForm.username" prefix-icon="iconfont icon-user"></el-input>
</el-form-item> </el-form-item>
@ -13,7 +13,7 @@
</el-form-item> </el-form-item>
<el-form-item class="btns"> <el-form-item class="btns">
<el-button type="primary">登录</el-button> <el-button type="primary">登录</el-button>
<el-button type="info">重置</el-button> <el-button @click="reset" type="info">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -40,6 +40,11 @@ export default {
] ]
} }
} }
},
methods: {
reset () {
this.$refs.loginFormRef.resetFields()
}
} }
} }
</script> </script>