scrollToErrorField() {
const firstErrorField = document.querySelector('.nameInput') || this.$refs.nameInput // 获取带有 ref 的第一个表单项
if (firstErrorField) {
firstErrorField.scrollIntoView({ behavior: 'smooth', block: 'center' })
}
},
onSubmit() {
this.$refs.drawerForm.validate((valid) => {
if (!valid) {
this.scrollToErrorField()
}
})
}