ElementUI form表单校验错误滚动到错误位置
作者:互联网
submitBtn() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
this.$emit('submit', this.submitData)
} else {
this.$nextTick(() => {
const isError = document.getElementsByClassName('is-error')
isError[0].scrollIntoView({
// 滚动到指定节点
// 值有start,center,end,nearest,当前显示在视图区域中间
block: 'center',
// 值有auto、instant,smooth,缓动动画(当前是慢速的)
behavior: 'smooth'
})
return
})
return false
}
})
}
标签:return,错误,form,ElementUI,center,smooth,valid,isError,值有 来源: https://www.cnblogs.com/zerofan/p/16563205.html