本文最后更新于:March 3, 2022 pm
Element Plus 基于 Vue 3,面向设计师和开发者的组件库。Element Plus,由饿了么大前端团队开源出品的一套为开发者、设计师和产品经理准备的基于 Vue 3.0 的组件库,提供了配套设计资源,帮助网站快速成型。
目录
前端
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| <div id="pwd-main"><br> <div class="position-updatepwd"> <el-form :model="resetForm" status-icon :rules="resetFormRules" ref="resetForm" label-width="100px" style="width: 300px"> <el-form-item label="人员ID" prop="manid"> <el-input type="text" v-model="resetForm.manid" auto-complete="off"></el-input> </el-form-item> <el-form-item label="新密码" prop="newpwd"> <el-input type="password" v-model="resetForm.newpwd" auto-complete="off"></el-input> </el-form-item> <el-form-item label="确认密码" prop="renewpwd"> <el-input type="password" v-model="resetForm.renewpwd" auto-complete="off"></el-input> </el-form-item> </el-form> </div> <div class="btn-sub"> <el-button type="primary" style="margin-left: 150px;margin-top: 10px" @click="subup('resetForm')">修改</el-button> </div>
</div>
|
处理
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| export default { name: "index", data(){ var validatePass = (rule, value, callback) => { if (!value) { callback(new Error('请输入新密码')); } else if (value.toString().length < 6 || value.toString().length > 18) { callback(new Error('密码长度为6 - 18个字符')) } else { callback(); } }; var validatePass2 = (rule, value, callback) => { if (value === '') { callback(new Error('请再次输入密码')); } else if (value !== this.resetForm.newpwd) { callback(new Error('两次输入密码不一致!')); } else { callback(); } }; var validateid = (rule, value, callback) => { if (!value) { callback(new Error('请输入被修改人员ID!')); } else if (value.toString().length < 1) { callback(new Error('人员ID不能为空!')); } else { callback(); } }; return{ resetForm: { newpwd: '', renewpwd: '', manid: '', }, resetFormRules: { newpwd: [ { required: true, validator: validatePass, trigger: 'blur' } ], renewpwd: [ { required: true, validator: validatePass2, trigger: 'blur' } ], manid: [ { required: true, validator: validateid, trigger: 'blur' } ] },
} }, methods:{ subup(resetForm){ this.$refs[resetForm].validate((valid)=>{ if(valid){ console.log('yeyeyeyeye') }else{ console.log('nononononoono') return false; } }) } }
}
|