Skip to content

Commit 3b3680d

Browse files
authored
add quick start
1 parent 1b9c191 commit 3b3680d

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,66 @@ Multiple Process Loader Management for [Vue](http://vuejs.org/) and (optionally)
1616
1717
**vue-wait** helps to manage multiple loading states on the page without any conflict. It's based on a **very simple idea** that manages an array (or Vuex store optionally) with multiple loading states. The **built-in loader component** listens its registered loader and immediately become loading state.
1818

19+
# ⏩Quick Start
20+
21+
1. Install:
22+
```bash
23+
yarn add vue-wait
24+
```
25+
26+
2. Require:
27+
```js
28+
import VueWait from 'vue-wait'
29+
30+
Vue.use(VueWait)
31+
32+
new Vue({
33+
// your vue config
34+
wait: new VueWait(),
35+
})
36+
```
37+
38+
3. Use in Your Components
39+
40+
```js
41+
<template>
42+
<v-wait for="my list is to load">
43+
<template slot="waiting">
44+
<div>
45+
<img src="loading.gif" />
46+
Loading the list...
47+
</div>
48+
</template>
49+
<ul>
50+
<li v-for="item in myList">{{ item }}</li>
51+
</ul>
52+
</v-wait>
53+
</template>
54+
55+
<script>
56+
export default {
57+
data() {
58+
return {
59+
myList: []
60+
}
61+
},
62+
async created() {
63+
// start waiting
64+
this.$wait.start('my list is to load');
65+
66+
this.myList = await fetch('/my-list-url');
67+
68+
// stop waiting
69+
this.$wait.end('my list is to load');
70+
},
71+
};
72+
</script>
73+
```
74+
75+
**vue-wait has more abilities to make the management easier, please read the complete documentation.**
76+
77+
# ▶️Detailed Start
78+
1979
## 📦 Requirements
2080

2181
- [Vue.js](https://vuejs.org) (v2.0.0+)
@@ -385,6 +445,8 @@ By default `waitFor` return async function, if you want to wrap default sync fun
385445
_Example using with async function_
386446

387447
```js
448+
import { waitFor } from 'vue-wait';
449+
388450
...
389451
methods: {
390452
fetchDataFromApi: waitFor('fetch data', async function () {

0 commit comments

Comments
 (0)