// 验证表单
this.$refs.componentForm.$refs.form.validate((valid) => {
if (valid) {
//验证通过
} else {
//验证不通过
this.$message.error('请检查表单是否填写完整')
this.$nextTick(()=>{
this.scrollToError()
})
}
})
// 定位未填写的表单
scrollToError() {
let error_div = document.body.querySelector('.ant-form-explain')
this.$nextTick(() => {
if (error_div)
document.body.querySelector('.ant-form-explain').scrollIntoView({ behavior: 'smooth', block: 'center' })
})
},