Skip to content

Commit

Permalink
customization ui via slot options
Browse files Browse the repository at this point in the history
  • Loading branch information
HELMAB committed Jun 30, 2020
1 parent 1275edc commit 5a3f74e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ Vue.use(loading, {
| icon | `deault: 'spinner'` | : support font-awesome |
| size | `default: '3'` | : {1, 2, 3, 4, 5} string |
| icon_color | `default: '#ffffff'` | : color string |
| slot | `default: font-awesome` | : raw html |
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export default {
if (options.hasOwnProperty('icon_color')) {
vm.icon_color = options.icon_color
}
if (options.hasOwnProperty('slot')) {
vm.slot = options.slot
}
}
}
})
Expand Down
12 changes: 9 additions & 3 deletions index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
<div class="loading"
:style="`background-color: ${bg};`"
v-show="isLoading">
<i :class="`fa fa-${icon} fa-pulse fa-${size}x fa-fw`"
:style="`color: ${icon_color}`"></i>
<span class="sr-only">Loading...</span>
<template v-if="slot">
<div v-html="slot"></div>
</template>
<template v-else>
<i :class="`fa fa-${icon} fa-pulse fa-${size}x fa-fw`"
:style="`color: ${icon_color}`"></i>
<span class="sr-only">Loading...</span>
</template>
</div>
</template>

Expand All @@ -18,6 +23,7 @@
icon: 'spinner',
size: '3',
icon_color: '#ffffff',
slot: null,
}
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vuejs-loading-screen",
"version": "1.0.7",
"version": "1.0.8",
"description": "Blocking screen while process worked",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 5a3f74e

Please # to comment.