elementui 长表单验证滚动到首个错误位置

发布时间 2023-09-02 17:24:30作者: 编程民工
this.$refs['form'].validate(valid => {
    if(valid){
        // 验证通过
        
    } else {
        // 验证失败
        this.$nextTick(() => {
            let isError = document.getElementsByClassName('is-error')
	        isError[0].scrollIntoView({
		        block: 'center',
		        behavior: 'smooth'
	       })
	   })
    }
})