解决办法:
监听input框失去焦点事件:
当失去焦点执行一下代码,就可以解决问题
gotoView1() {
var currentPosition,timer;
var speed=1;
timer=setInterval(function(){
currentPosition=document.documentElement.scrollTop || document.body.scrollTop;
currentPosition-=speed;
window.scrollTo(0,currentPosition);//页面向上滚动
currentPosition+=speed;
window.scrollTo(0,currentPosition);//页面向下滚动
clearInterval(timer);
},100);
},
原文链接:https://blog.csdn.net/weixin_45378485/article/details/102551252