elementplus表单效验,报错显示formDateRef.value.validateField is not a function 个人云盘 获取验证码 请从垃圾箱中查找验证码 未收到邮箱验证码? 记住我 忘记密码 没有账号 去登录? 去登录? 登录 注册 重置密码 {{ formDate.email }} import{ ref, reactive , getCurrentInstance ,nextTick}from "vue" const {proxy} =getCurrentInstance(); const api={ checkCodeUrl: "/api/checkCode", }; //操作类型:0:注册;1:登录;2:重置密码 const opType=ref(1); const showPanel=(type) =>{ opType.value=type; }; const fromData =ref({}); const formDateRef=ref(); const rules ={ email: [{required: true,message:"请输入正确的邮箱"}], }; const checkCodeUrl=ref(api.checkCode); const changeChekCode =(type)=>{ checkCodeUrl.value= api.checkCode + "?type="+type+"&time="+new Date().getTime; }; //发送邮箱验证码 const formData4SendMailCode = ref({}); const formData4SendMailCodeRef = ref(); const dialogConfig4SendMailCode = reactive({ show: false, title: "发送邮箱验证码", buttons: [ { type: "primary", text: "发送验证码", click: (e) => { submitForm(); }, }, ], }); const getEmailCode=()=>{ formDateRef.value.validateField("email" , (valid) => { if(!valid){ return; } dialogConfig4SendMailCode.show = true; }); }; export default { data() { return { videoCanPlay: false, //控制视屏加载状态显示图片 fixStyle: '' //屏幕发生变化时给播放器设置的样式 } }, mounted() { this.getVideoStyle() }, methods: { //视屏播放失败展示背景图片 canplay() { this.videoCanPlay = true }, //监听屏幕大小实时给播放器设置宽高 getVideoStyle() { window.onresize = () => { const windowWidth = document.body.clientWidth const windowHeight = document.body.clientHeight const windowAspectRatio = windowHeight / windowWidth console.log(windowWidth, windowHeight, windowAspectRatio, '屏幕实时大小') let videoWidth let videoHeight if (windowAspectRatio .login-body { height: calc(100vh); background-size: cover; display: flex; .login-panel{ width: 430px; margin-right: 15%; margin-top: calc((100vh - 500px)/2); .login-register{ position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); background: rgba(255,255,255,0.3); border-radius: 5px; margin-top: 10px; padding: 25px; .login-title{ text-align: center; font-size: 18px; font-weight: bold; margin-bottom: 20px; color: #0b1017; } .send-emali-panel{ display: flex; width: 100%; justify-content: space-between; .send-mail-btn{ margin-left: 5px; } } .rememberme-panel{ width: 100%; color:#007fff; } .no-account{ width:100%; display: flex; justify-content: space-between; } .op-btn{ width: 100%; } } } .check-code-panel{ width: 60%; display: flex; .check-code{ margin-left: 5px; cursor: pointer; } } .login-btn-qq{ margin-top: 20px; text-align: center; display: flex; align-items: center; justify-content: center; img{ cursor: pointer; margin-left: 30px; width: 20px; } } .login-page { background-size: cover; background-attachment: scroll; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; } .login-background { width: 100%; display: block; position: fixed; top: 0; height: 100%; left: 0; z-index: -99; } .login-content { width: 640px; height: 780px; z-index: 2; left: 600px; top: 230px; border-width: 0px; background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(2px); border-radius: 2px; border: none; box-shadow: none; color: #ffffff; display: flex; justify-content: center; align-items: center; } .videoContainer { position: fixed; width: 100%; height: 100%; overflow: hidden; z-index: -100; } .videoContainer:before { content: ''; position: absolute; width: 100%; height: 100%; display: block; z-index: -1; top: 0; left: 0; background: rgba(25, 29, 34, 0.65); } .fillWidth { width: 100%; } } 解决