直接放代码spa
// 获取焦点 focusInput() { let commentDom = document.querySelector('#textarea') setTimeout(function() { commentDom.scrollIntoView(true); commentDom.scrollIntoViewIfNeeded(); }, 500) },
在使用的input 或者textarea 须要被键盘顶起来,被顶起来的容器元素id为textareacode
以上若是还不能够,在作第二步操做:给这个元素设置position:stickyblog