You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+63-25Lines changed: 63 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -405,22 +405,32 @@ In this example above, the **tab gets data from back-end**, and the **table load
405
405
406
406
```html
407
407
<templatelang='pug'>
408
-
div
409
-
v-wait(for='fetching tabs')
410
-
template(slot='waiting')
411
-
b-tabs
412
-
template(slot='tabs')
413
-
b-nav-item(active disabled)
414
-
v-icon(name='circle-o-notch', spin)
415
-
b-tabs
416
-
template(slot='tabs')
417
-
b-nav-item(v-for='tab in tabs') {{ tab.name }}
418
-
419
-
v-wait(for='fetching data')
420
-
table-gradient-spinner(slot='waiting')
421
-
table
422
-
tr(v-for='row in data')
423
-
// ...
408
+
<div>
409
+
<v-waitfor="fetching tabs">
410
+
<templateslot="waiting">
411
+
<b-tabs>
412
+
<templateslot="tabs">
413
+
<b-nav-itemactive="active"disabled>
414
+
<v-iconname="circle-o-notch"spin="spin" />
415
+
</b-nav-item>
416
+
</template>
417
+
</b-tabs>
418
+
</template>
419
+
<b-tabs>
420
+
<templateslot="tabs">
421
+
<b-nav-itemv-for="tab in tabs">{{ tab.name }}</b-nav-item>
422
+
</template>
423
+
</b-tabs>
424
+
</v-wait>
425
+
<v-waitfor="fetching data">
426
+
<table-gradient-spinnerslot="waiting" />
427
+
<table>
428
+
<trv-for="row in data">
429
+
<!-- ...-->
430
+
</tr>
431
+
</table>
432
+
</v-wait>
433
+
</div>
424
434
</template>
425
435
```
426
436
@@ -435,11 +445,11 @@ You may want to design your own reusable loader for your project. You better cre
435
445
loading: Loading...
436
446
</i18n>
437
447
438
-
<templatelang="pug">
439
-
div.loading-spinner
440
-
//- Uses vue-awesome spinner
441
-
v-icon(name='refresh', spin)
442
-
span {{ $t('loading') }}
448
+
<template>
449
+
<divclass="loading-spinner">
450
+
<v-iconname="refresh"spin="spin" />
451
+
<span>{{ $t('loading') }}</span>
452
+
</div>
443
453
</template>
444
454
445
455
<stylescopedlang="scss">
@@ -459,13 +469,41 @@ Now you can use your spinner everywhere using `slot='waiting'` attribute:
459
469
460
470
```html
461
471
<templatelang="pug">
462
-
v-wait(for='fetching data')
463
-
my-waiter(slot='waiting')
464
-
div
465
-
p My main content after fetching data...
472
+
<v-waitfor="fetching data">
473
+
<my-waiterslot="waiting" />
474
+
<div>
475
+
<p>My main content after fetching data...</p>
476
+
</div>
477
+
</v-wait>
466
478
</template>
467
479
```
468
480
481
+
## 📦 Using with external spinner libraries
482
+
483
+
You can use `vue-wait` with another spinner libraries like [epic-spinners](/https://github.com/epicmaxco/epic-spinners) or other libraries. You just need to add `slot="waiting"` to the component and Vue handles rest of the work.
484
+
485
+
First register the component,
486
+
```js
487
+
import { OrbitSpinner } from'epic-spinners';
488
+
Vue.component('orbit-spinner', OrbitSpinner);
489
+
```
490
+
491
+
Then use it in your as a `v-wait`'s `waiting` slot.
492
+
```html
493
+
<v-waitfor='something to load'>
494
+
<orbit-spinner
495
+
slot='waiting'
496
+
:animation-duration="1500"
497
+
:size="64"
498
+
:color="'#ff1d5e'"
499
+
/>
500
+
</v-wait>
501
+
```
502
+
503
+
... and done!
504
+
505
+
For other libraries you can use, please see [Loaders section of **vuejs/awesome-vue**](https://github.com/vuejs/awesome-vue#loader).
506
+
469
507
## 🚌 Run example
470
508
471
509
Use `npm run dev-vuex`, `npm run dev-vue` or `npm run dev-wrap` commands.
0 commit comments