index.vue 940 B

123456789101112131415161718192021222324252627282930313233
  1. <template>
  2. <div v-if="errorLogs.length > 0">
  3. <el-badge type="danger" :value="errorLogs.length" @click="dialogVisible = true">
  4. <vab-icon icon="bug-line" />
  5. </el-badge>
  6. <el-dialog v-model="dialogVisible" append-to-body draggable title="shop-vite 异常捕获" width="60%">
  7. <vab-error-log-content />
  8. <template #footer>
  9. <el-button @click="dialogVisible = false">取 消</el-button>
  10. <el-button type="danger" @click="clearAll">暂不显示</el-button>
  11. </template>
  12. </el-dialog>
  13. </div>
  14. </template>
  15. <script lang="ts" setup>
  16. import { useErrorLogStore } from '/@/store/modules/errorLog'
  17. defineOptions({
  18. name: 'VabErrorLog',
  19. })
  20. const errorLogStore = useErrorLogStore()
  21. const { errorLogs } = storeToRefs(errorLogStore)
  22. const { clearErrorLog } = errorLogStore
  23. const dialogVisible = ref<boolean>(false)
  24. const clearAll = () => {
  25. dialogVisible.value = false
  26. clearErrorLog()
  27. }
  28. </script>