this.$nextTick(() => {
let isError = document.getElementsByClassName('is-error')
isError[0].scrollIntoView({
// 滚动到指定节点
// 值有start,center,end,nearest,当前显示在视图区域中间
block: 'center',
// 值有auto、instant,smooth,缓动动画(当前是慢速的)
behavior: 'smooth',
})
})
vue中表单提交,当提交表单的时候,有必填项未填写自动定位到第一个未填写的地方
最新推荐文章于 2024-04-02 17:10:43 发布