index.vue 677 B

1234567891011121314151617181920212223242526272829
  1. <script lang="ts" setup>
  2. import { useRoutesStore } from '@/store/modules/routes'
  3. import { handleActivePath } from '@/utils/routes'
  4. import { VabRoute } from '/#/router'
  5. const route: VabRoute = useRoute()
  6. const routesStore: any = useRoutesStore()
  7. const { tab, activeMenu } = storeToRefs(routesStore)
  8. watch(
  9. route,
  10. () => {
  11. if (tab.value.data !== route.matched[0].name)
  12. tab.value.data = route.matched[0].name
  13. activeMenu.value.data = handleActivePath(route)
  14. },
  15. { immediate: true }
  16. )
  17. </script>
  18. <template>
  19. <div class="vab-app-main">
  20. <section>
  21. <VabRouterView />
  22. </section>
  23. <vab-footer />
  24. </div>
  25. </template>