ErrorAction.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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]" dot :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 { errorStore } from '/@/store/modules/error';
  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 getCount = computed(() => {
  28. return errorStore.getErrorListCountState;
  29. });
  30. function handleToErrorList() {
  31. push(PageEnum.ERROR_LOG_PAGE).then(() => {
  32. errorStore.commitErrorListCountState(0);
  33. });
  34. }
  35. return {
  36. t,
  37. getCount,
  38. handleToErrorList,
  39. };
  40. },
  41. });
  42. </script>