12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <!-- @format -->
- <script setup lang="ts">
- import { debounce } from 'lodash-es'
- import { useCommonStore } from '@/stores/modules/common'
- const commonStore = useCommonStore()
- onMounted(() => {
- const sections = document.querySelectorAll('.data-section')
- const appScroller = document.getElementById('app-scroller')
- if (!appScroller)
- return
- const handleScroll = debounce(() => {
- const scrollPosition = appScroller.scrollTop + 72
- sections.forEach((section) => {
- const sectionTop = section.offsetTop
- const sectionHeight = section.offsetHeight
- if (scrollPosition >= sectionTop && scrollPosition < sectionTop + sectionHeight) {
- const newColor = section.dataset.sectionColor
- commonStore.setNavigateBgColor(newColor)
- }
- })
- }, 50)
- appScroller.addEventListener('scroll', handleScroll)
- onUnmounted(() => {
- appScroller.removeEventListener('scroll', handleScroll)
- })
- })
- </script>
- <template>
- <div>
- <business-home-banner />
- <business-home-solutions />
- <common-block-catalogs />
- <common-block-partner />
- <common-block-exhibited />
- <common-block-blog />
- <common-block-faq />
- <AppFooter />
- </div>
- </template>
- <style lang="less" scoped></style>
|