ny
昨天 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<script lang="ts" setup>
import { computed, ref, unref } from 'vue';
 
import { useAttrs } from '@jnpf/hooks';
 
import { Empty } from 'ant-design-vue';
 
defineOptions({ inheritAttrs: false, name: 'JnpfEmpty' });
 
const props = defineProps({
  image: { default: null, type: [String, Boolean, Object] },
});
 
const attrs = useAttrs({ excludeDefaultKeys: false });
const defaultImage = ref(Empty.PRESENTED_IMAGE_SIMPLE);
 
const getBindValue: any = computed(() => ({ ...unref(attrs), image: props.image || props.image === false ? props.image : unref(defaultImage) }));
</script>
 
<template>
  <Empty v-bind="getBindValue">
    <template v-for="item in Object.keys($slots)" #[item]="data"><slot :name="item" v-bind="data || {}"></slot></template>
  </Empty>
</template>