index.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <!-- @format -->
  2. <script setup lang="ts">
  3. import { useCommonStore } from '@/stores/modules/common'
  4. const commonStore = useCommonStore()
  5. onMounted(() => {
  6. const sections = document.querySelectorAll('.data-section')
  7. const appScroller = document.getElementById('app-scroller')
  8. if (!appScroller)
  9. return
  10. appScroller.addEventListener('scroll', () => {
  11. const scrollPosition = appScroller.scrollTop
  12. sections.forEach((section) => {
  13. const sectionTop = section.offsetTop
  14. const sectionHeight = section.offsetHeight
  15. if (scrollPosition >= sectionTop && scrollPosition < sectionTop + sectionHeight) {
  16. const newColor = section.dataset.sectionColor
  17. commonStore.setNavigateBgColor(newColor)
  18. }
  19. })
  20. })
  21. })
  22. </script>
  23. <template>
  24. <div>
  25. <business-home-banner />
  26. <business-home-solutions />
  27. <common-block-catalogs />
  28. <common-block-partner />
  29. <common-block-exhibited />
  30. <common-block-blog />
  31. <common-block-faq />
  32. <AppFooter />
  33. </div>
  34. </template>
  35. <style lang="less" scoped></style>