App.vue 792 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <script setup lang="ts">
  2. import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
  3. import { useThemeStore } from '@/stores/theme'
  4. import { isMicro } from '@/config/mainMicro'
  5. import { microName } from '@/config/subMicro'
  6. const locale = zhCn
  7. const themeStore = useThemeStore()
  8. themeStore.initTheme()
  9. if (isMicro) {
  10. const router = useRouter()
  11. const route = useRoute()
  12. watch(
  13. () => route.path,
  14. () => {
  15. window.$wujie?.bus.$emit('sub-route-change', microName, route.path)
  16. },
  17. {
  18. immediate: true
  19. }
  20. )
  21. window.$wujie?.bus.$on(`${microName}-router-change`, (route: string) => {
  22. router.push(route)
  23. })
  24. }
  25. </script>
  26. <template>
  27. <el-config-provider :locale="locale">
  28. <router-view></router-view>
  29. </el-config-provider>
  30. </template>
  31. <style scoped></style>