<template><divclass="login"><t-formref="tform":model="loginForm":rules="rules"><divclass="roundBox"><van-fieldv-model.trim="loginForm.username"placeholder="请输入账号"clearable/></div><divclass="roundBox"><t-van-fieldv-model="loginForm.password"type="password"placeholder="请输入密码"clearableshowPassword/></div></t-form><divclass="btn"@click="onLogin">登录</div></div></template><script>exportdefault{name:'initialJudgment',data(){return{loginForm:{username:'',password:'',},rules:{username:[{required:true,message:"请输入账号",trigger:"blur"}],password:[{required:true,message:"请输入密码",trigger:"blur"},{min:6,max:18,message:"密码长度在6到18个字符",trigger:"blur"}]}}},methods:{// 登录onLogin(){this.$refs.tform.validate(async(valid)=>{if(!valid)return;
console.log("验证通过",this.loginForm);const res =awaitthis.$store.dispatch('Login',this.loginForm)if(res.success){this.$router.push({path:'/'});}})}},};</script>