ErrorAction.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <Tooltip
  3. :title="t('layout.header.tooltipErrorLog')"
  4. placement="bottom"
  5. :mouseEnterDelay="0.5"
  6. @click="handleToErrorList"
  7. >
  8. <Badge :count="getCount" :offset="[0, 10]" :overflowCount="99">
  9. <Icon icon="ion:bug-outline" />
  10. </Badge>
  11. </Tooltip>
  12. </template>
  13. <script lang="ts">
  14. import { defineComponent, computed } from 'vue';
  15. import { Tooltip, Badge } from 'ant-design-vue';
  16. import { Icon } from '/@/components/Icon';
  17. import { useI18n } from '/@/hooks/web/useI18n';
  18. import { useErrorLogStore } from '/@/store/modules/errorLog';
  19. import { PageEnum } from '/@/enums/pageEnum';
  20. import { useRouter } from 'vue-router';
  21. export default defineComponent({
  22. name: 'ErrorAction',
  23. components: { Icon, Tooltip, Badge },
  24. setup() {
  25. const { t } = useI18n();
  26. const { push } = useRouter();
  27. const errorLogStore = useErrorLogStore();
  28. const getCount = computed(() => errorLogStore.getErrorLogListCount);
  29. function handleToErrorList() {
  30. push(PageEnum.ERROR_LOG_PAGE).then(() => {
  31. errorLogStore.setErrorLogListCount(0);
  32. });
  33. }
  34. return {
  35. t,
  36. getCount,
  37. handleToErrorList,
  38. };
  39. },
  40. });
  41. </script>