Add click switch to Indicator

This commit is contained in:
2023-09-22 17:02:15 +08:00
parent 970f70d470
commit f744748a85
3 changed files with 19 additions and 3 deletions

View File

@@ -126,6 +126,11 @@ const Home: React.FC = () => {
}
}
const handleIndicatorSwitch = (index: number) => {
setCurrentContent(index)
handleScrollToContent(index)()
}
const content = [
{
backgroundColor: '#FBFBFB',
@@ -153,7 +158,11 @@ const Home: React.FC = () => {
</div>
<div hidden={navbarHidden} className={'indicator'}>
<Indicator total={content.length} current={currentContent} />
<Indicator
total={content.length}
current={currentContent}
onSwitch={handleIndicatorSwitch}
/>
</div>
</>
)