Skip to content

Commit 5a3f74e

Browse files
committed
customization ui via slot options
1 parent 1275edc commit 5a3f74e

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ Vue.use(loading, {
6363
| icon | `deault: 'spinner'` | : support font-awesome |
6464
| size | `default: '3'` | : {1, 2, 3, 4, 5} string |
6565
| icon_color | `default: '#ffffff'` | : color string |
66+
| slot | `default: font-awesome` | : raw html |

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ export default {
3030
if (options.hasOwnProperty('icon_color')) {
3131
vm.icon_color = options.icon_color
3232
}
33+
if (options.hasOwnProperty('slot')) {
34+
vm.slot = options.slot
35+
}
3336
}
3437
}
3538
})

index.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
<div class="loading"
33
:style="`background-color: ${bg};`"
44
v-show="isLoading">
5-
<i :class="`fa fa-${icon} fa-pulse fa-${size}x fa-fw`"
6-
:style="`color: ${icon_color}`"></i>
7-
<span class="sr-only">Loading...</span>
5+
<template v-if="slot">
6+
<div v-html="slot"></div>
7+
</template>
8+
<template v-else>
9+
<i :class="`fa fa-${icon} fa-pulse fa-${size}x fa-fw`"
10+
:style="`color: ${icon_color}`"></i>
11+
<span class="sr-only">Loading...</span>
12+
</template>
813
</div>
914
</template>
1015

@@ -18,6 +23,7 @@
1823
icon: 'spinner',
1924
size: '3',
2025
icon_color: '#ffffff',
26+
slot: null,
2127
}
2228
},
2329
methods: {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vuejs-loading-screen",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "Blocking screen while process worked",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)