直接放代码

 

// 获取焦点
focusInput() {
  let commentDom = document.querySelector('#textarea')
  setTimeout(function() {
    commentDom.scrollIntoView(true);
    commentDom.scrollIntoViewIfNeeded();
  }, 500)
},

在使用的input 或者textarea 需要被键盘顶起来,被顶起来的容器元素id为textarea

以上如果还不可以,在做第二步操作:给这个元素设置position:sticky

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-10
  • 2022-12-23
  • 2022-12-23
  • 2021-09-03
  • 2022-01-31
  • 2021-07-17
相关资源
相似解决方案