Skip to content

Commit 5d8e733

Browse files
committed
Modify template to render function for all spinners #83
1 parent 24aae5b commit 5d8e733

File tree

1 file changed

+50
-31
lines changed

1 file changed

+50
-31
lines changed

src/components/InfiniteLoading.vue

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,45 +20,64 @@
2020
const LOOP_CHECK_MAX_CALLS = 10; // the maximum number of continuous calls
2121
const SPINNERS = {
2222
BUBBLES: {
23-
template: `
24-
<span class="loading-bubbles">
25-
<span class="bubble-item"></span>
26-
<span class="bubble-item"></span>
27-
<span class="bubble-item"></span>
28-
<span class="bubble-item"></span>
29-
<span class="bubble-item"></span>
30-
<span class="bubble-item"></span>
31-
<span class="bubble-item"></span>
32-
<span class="bubble-item"></span>
33-
</span>
34-
`,
23+
render(createElement) {
24+
return createElement('span', {
25+
attrs: {
26+
class: 'loading-bubbles',
27+
},
28+
}, Array.apply(Array, Array(8)).map(() => createElement('span', {
29+
attrs: {
30+
class: 'bubble-item',
31+
},
32+
})),
33+
);
34+
},
3535
},
3636
CIRCLES: {
37-
template: `<span class="loading-circles">
38-
<span class="circle-item"></span>
39-
<span class="circle-item"></span>
40-
<span class="circle-item"></span>
41-
<span class="circle-item"></span>
42-
<span class="circle-item"></span>
43-
<span class="circle-item"></span>
44-
<span class="circle-item"></span>
45-
<span class="circle-item"></span>
46-
</span>`,
37+
render(createElement) {
38+
return createElement('span', {
39+
attrs: {
40+
class: 'loading-circles',
41+
},
42+
}, Array.apply(Array, Array(8)).map(() => createElement('span', {
43+
attrs: {
44+
class: 'circle-item',
45+
},
46+
})),
47+
);
48+
},
4749
},
4850
DEFAULT: {
49-
template: '<i class="loading-default"></i>',
51+
render(createElement) {
52+
return createElement('i', {
53+
attrs: {
54+
class: 'loading-default',
55+
},
56+
});
57+
},
5058
},
5159
SPIRAL: {
52-
template: '<i class="loading-spiral"></i>',
60+
render(createElement) {
61+
return createElement('i', {
62+
attrs: {
63+
class: 'loading-spiral',
64+
},
65+
});
66+
},
5367
},
5468
WAVEDOTS: {
55-
template: `<span class="loading-wave-dots">
56-
<span class="wave-item"></span>
57-
<span class="wave-item"></span>
58-
<span class="wave-item"></span>
59-
<span class="wave-item"></span>
60-
<span class="wave-item"></span>
61-
</span>`,
69+
render(createElement) {
70+
return createElement('span', {
71+
attrs: {
72+
class: 'loading-wave-dots',
73+
},
74+
}, Array.apply(Array, Array(5)).map(() => createElement('span', {
75+
attrs: {
76+
class: 'wave-item',
77+
},
78+
})),
79+
);
80+
},
6281
},
6382
};
6483
const WARNINGS = {

0 commit comments

Comments
 (0)