表单提交时回车自动聚焦到需要填写的项 this.$refs.elForm.validate((valid, objects) => { // objects 校验不通过的信息,以数组对象的格式返回 if (objects) { Object.keys(objects).forEach((v, index) => { if (index === 0) { this.$refs[v].focus(); throw new Error("退出循环"); } }); return; } ... }); 注:保证input的prop和ref一致