diff --git a/packages/taro-components/src/components/scroll-view/index.js b/packages/taro-components/src/components/scroll-view/index.js index 97a35484a78a..003fcbabb772 100644 --- a/packages/taro-components/src/components/scroll-view/index.js +++ b/packages/taro-components/src/components/scroll-view/index.js @@ -103,6 +103,19 @@ class ScrollView extends Nerv.Component { } this._scrollLeft = nextProps.scrollLeft } + // scrollIntoView + if ( + nextProps.scrollIntoView && + typeof nextProps.scrollIntoView === 'string' && + document && + document.querySelector && + document.querySelector(`#${nextProps.scrollIntoView}`) + ) + document.querySelector(`#${nextProps.scrollIntoView}`).scrollIntoView({ + behavior: 'smooth', + block: 'center', + inline: 'start', + }); } render() {