解决方案如下: window.addEventListener('resize', () => { const activeElement = document.activeElement if (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA') { setTimeout(() => { activeElement.scrollIntoView() }, 100) } })
解决方案如下: