Skip to content

Commit f074fb7

Browse files
committed
Implement slot support
1 parent fe295d6 commit f074fb7

File tree

6 files changed

+7255
-151
lines changed

6 files changed

+7255
-151
lines changed

README.md

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,11 @@ I would recommend you to create your VUE project using vue-cli, then it should i
5858
| ------------- | ------------- |
5959
| message | Message to be shown in loading screen |
6060
| url | <b>Optional Field</b>, image including svg/gif/png/jpg etc, you can use any animated/static image supported by img tag. Please be aware that you'd better import the image resource then use it instead of directly using relative image path. Example can be found in this document. If <b>url</b> attribute presents and not empty, it will ignore <b>html</b> attribute|
61-
| html | <b>Optional Field</b>, you can insert html template to icon area, this enables you to utilize external animated fonts/css libaries. eg. [fontawesome](http://fontawesome.io/examples/) or [Spinkit](https://github.com/tobiasahlin/SpinKit) etc. <b>Don't forget to import related css & fonts into project by yourself</b>
61+
| html | (Deprecated, suggest to use [slot] option instead), <b>Optional Field</b>, you can insert html template to icon area, this enables you to utilize external animated fonts/css libaries. eg. [fontawesome](http://fontawesome.io/examples/) or [Spinkit](https://github.com/tobiasahlin/SpinKit) etc. <b>Don't forget to import related css & fonts into project by yourself</b>
62+
| [slot] | Directly use any html template or other Vue Component, it will replace the icon part, see examples in readme.
6263

6364
Then, you can combine with <b>v-if</b>/<b>v-show</b> to show or hide the BlockUI.
6465

65-
## In your template
66-
Please note the differences of using ":" or not.
67-
```
68-
<BlockUI message="Loading..."></BlockUI>
69-
70-
or
71-
72-
<BlockUI :message="msg" :url="url"></BlockUI>
73-
74-
or
75-
<BlockUI :message="msg" :html="html"></BlockUI>
76-
```
7766

7867
## In your Code
7968
Please be aware, if you are using webpack and with file-loader to add finger print to your asserts,
@@ -85,18 +74,50 @@ import BlockUI from 'vue-blockui'
8574
import loadingImage from './assets/logo.png'
8675
8776
Vue.use(BlockUI)
77+
```
78+
```
79+
<BlockUI :message="msg" :url="url"></BlockUI>
8880
8981
export default {
9082
name: 'app',
9183
data () {
9284
return {
9385
msg: 'Welcome to Your Vue.js App',
94-
html: '<i class="fa fa-cog fa-spin fa-3x fa-fw"></i>', //this line demostrate how to use fontawesome animation icon
9586
url : loadingImage //It is important to import the loading image then use here
9687
}
9788
}
9889
}
9990
```
91+
or
92+
```
93+
<BlockUI :message="msg" :html="html"></BlockUI>
94+
95+
export default {
96+
name: 'app',
97+
data () {
98+
return {
99+
msg: 'Welcome to Your Vue.js App',
100+
html: '<i class="fa fa-cog fa-spin fa-3x fa-fw"></i>', //this line demostrate how to use fontawesome animation icon
101+
}
102+
}
103+
}
104+
```
105+
106+
Or using inline html or component **[slot example]**
107+
```
108+
<BlockUI :message="msg">
109+
<i class="fa fa-cog fa-spin fa-3x fa-fw"></i>
110+
</BlockUI>
111+
112+
export default {
113+
name: 'app',
114+
data () {
115+
return {
116+
msg: 'Welcome to Your Vue.js App',
117+
}
118+
}
119+
}
120+
```
100121

101122
## Styling Customization
102123
You can override BlockUI sytlings based on your needs.
@@ -134,18 +155,21 @@ Below screen is using spinkit css animation
134155

135156
Sample config for using spinkit css animation:
136157
```
158+
<BlockUI :message="msg">
159+
<div class="sk-wave">
160+
<div class="sk-rect sk-rect1"></div>
161+
<div class="sk-rect sk-rect2"></div>
162+
<div class="sk-rect sk-rect3"></div>
163+
<div class="sk-rect sk-rect4"></div>
164+
<div class="sk-rect sk-rect5"></div>
165+
</div>
166+
</BlockUI>
167+
137168
export default {
138169
name: 'HelloWorld',
139170
data () {
140171
return {
141172
msg: 'Welcome to Your Vue.js App',
142-
html: `<div class="sk-wave">
143-
<div class="sk-rect sk-rect1"></div>
144-
<div class="sk-rect sk-rect2"></div>
145-
<div class="sk-rect sk-rect3"></div>
146-
<div class="sk-rect sk-rect4"></div>
147-
<div class="sk-rect sk-rect5"></div>
148-
</div>`
149173
}
150174
}
151175
}

dist/vue-blockui.browser.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)