VEmpty.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <script setup lang="ts">
  2. import lightPng from './images/default_image.png'
  3. import darkPng from './images/default_dark_image.png'
  4. import { useThemeStore } from '@/stores/modules/theme'
  5. import { useI18n } from 'vue-i18n'
  6. const themeStore = useThemeStore()
  7. const { t } = useI18n()
  8. // 判断当前系统主题模式
  9. const emptyImg = computed(() => {
  10. return themeStore.theme === 'dark' ? darkPng : lightPng
  11. })
  12. </script>
  13. <template>
  14. <div class="v-empty">
  15. <div class="empty-img">
  16. <img :src="emptyImg" alt="" />
  17. </div>
  18. <p class="title">
  19. <slot name="title">{{ t('common.noResultsFound') }}</slot>
  20. </p>
  21. <slot name="result">
  22. <p class="light">{{ t('common.emptyResultLine1') }}</p>
  23. <p class="light">{{ t('common.emptyResultLine2') }}</p>
  24. </slot>
  25. <div class="suggestion">
  26. <slot name="suggestion"></slot>
  27. </div>
  28. </div>
  29. </template>
  30. <style lang="scss" scoped>
  31. .v-empty {
  32. display: flex;
  33. flex-direction: column;
  34. align-items: center;
  35. .empty-img {
  36. margin-bottom: 16px;
  37. }
  38. .title {
  39. margin-bottom: 8px;
  40. font-weight: 600;
  41. color: var(--color-neutral-2);
  42. }
  43. .light {
  44. font-size: 12px;
  45. line-height: 18px;
  46. color: var(--color-neutral-3);
  47. }
  48. .suggestion {
  49. margin-top: 16px;
  50. padding: 8px;
  51. font-size: 12px;
  52. line-height: 18px;
  53. border-radius: 6px;
  54. text-align: left;
  55. background-color: var(--color-table-header-bg);
  56. :deep(p) {
  57. margin: 0;
  58. color: var(--color-neutral-3);
  59. }
  60. }
  61. }
  62. </style>