index.vue 641 B

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