Skip to content

Commit 185ac92

Browse files
committed
feat: support for setting the default slot as a component
1 parent 8116075 commit 185ac92

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

src/components/InfiniteLoading.vue

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,33 @@
66
</slot>
77
</div>
88
<div class="infinite-status-prompt" v-show="isShowNoResults">
9-
<slot name="no-results">{{ slots.noResults }}</slot>
9+
<slot name="no-results">
10+
<component v-if="slots.noResults.render" :is="slots.noResults"></component>
11+
<template v-else v-text="slots.noResults"></template>
12+
</slot>
1013
</div>
1114
<div class="infinite-status-prompt" v-show="isShowNoMore">
12-
<slot name="no-more">{{ slots.noMore }}</slot>
15+
<slot name="no-more">
16+
<component v-if="slots.noMore.render" :is="slots.noMore"></component>
17+
<template v-else v-text="slots.noMore"></template>
18+
</slot>
1319
</div>
1420
<div class="infinite-status-prompt" v-show="isShowError">
1521
<slot name="error" :trigger="attemptLoad">
16-
{{ slots.error }}
17-
<br>
18-
<button
19-
class="btn-try-infinite"
20-
@click="attemptLoad"
21-
v-text="slots.errorBtnText">
22-
</button>
22+
<component
23+
v-if="slots.error.render"
24+
:is="slots.error"
25+
:trigger="attemptLoad">
26+
</component>
27+
<template v-else>
28+
{{ slots.error }}
29+
<br>
30+
<button
31+
class="btn-try-infinite"
32+
@click="attemptLoad"
33+
v-text="slots.errorBtnText">
34+
</button>
35+
</template>
2336
</slot>
2437
</div>
2538
</div>

0 commit comments

Comments
 (0)