复制代码
1
2
3
4
5
6
7
8
9
10
11
12// 验证表单 this.$refs.componentForm.$refs.form.validate((valid) => { if (valid) { //验证通过 } else { //验证不通过 this.$message.error('请检查表单是否填写完整') this.$nextTick(()=>{ this.scrollToError() }) } })
复制代码
1
2
3
4
5
6
7
8// 定位未填写的表单 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' }) }) },
最后
以上就是爱笑鱼最近收集整理的关于antd表单验证,自动跳转到未填写的位置的全部内容,更多相关antd表单验证,自动跳转到未填写内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复