Skip to content

Commit 4797a55

Browse files
committed
Add a property which called spinner to support change loading animation
1 parent c06fe45 commit 4797a55

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/components/InfiniteLoading.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="infinite-loading-container">
3-
<i class="loading-default" v-show="isLoading"></i>
3+
<i :class="spinnerType" v-show="isLoading"></i>
44
<div class="infinite-status-prompt" v-show="!isLoading && isNoResults">
55
<slot name="no-results">No results :(</slot>
66
</div>
@@ -10,6 +10,14 @@
1010
</div>
1111
</template>
1212
<script>
13+
const spinnerMapping = {
14+
bubbles: 'loading-bubbles',
15+
circles: 'loading-circles',
16+
default: 'loading-default',
17+
spiral: 'loading-spiral',
18+
waveDots: 'loading-wave-dots',
19+
};
20+
1321
/**
1422
* get the first scroll parent of an element
1523
* @param {DOM} elm the element which find scorll parent
@@ -51,9 +59,15 @@
5159
isNoMore: false,
5260
};
5361
},
62+
computed: {
63+
spinnerType() {
64+
return spinnerMapping[this.spinner] || spinnerMapping.default;
65+
},
66+
},
5467
props: {
5568
distance: Number,
5669
onInfinite: Function,
70+
spinner: String,
5771
},
5872
ready() {
5973
if (this.distance === undefined) {

0 commit comments

Comments
 (0)