All files / src/entities/catalog/ui CatalogAsyncState.vue

66.66% Statements 2/3
100% Branches 2/2
50% Functions 1/2
66.66% Lines 2/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38                                              11x                     6x      
<script setup lang="ts">
import { AsyncState } from "../../../shared/ui";
 
withDefaults(defineProps<{
  loading?: boolean;
  error?: string | null;
  empty?: boolean;
  emptyTitle?: string;
  emptyMessage?: string;
}>(), {
  loading: false,
  error: null,
  empty: false,
  emptyTitle: "这里暂时没有商品。",
  emptyMessage: "可以调整查找词或返回全部商品。",
});
 
defineEmits<{
  retry: [];
}>();
</script>
 
<template>
  <AsyncState
    :loading="loading"
    loading-message="正在整理商品信息…"
    :error="error"
    error-title="商品信息没有被加载为成功。"
    retry-label="重新读取商品 →"
    :empty="empty"
    :empty-title="emptyTitle"
    :empty-message="emptyMessage"
    @retry="$emit('retry')"
  >
    <slot />
  </AsyncState>
</template>