Skip to content

Commit c085000

Browse files
authored
Update README.md
1 parent d1366b6 commit c085000

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ All features can be obtained from $wait property in Vue components.
189189

190190
Returns boolean value if any loader exists in page.
191191

192-
```html
192+
```vue
193193
<template>
194194
<progress-bar v-if="$wait.any">Please wait...</progress-bar>
195195
</template>
@@ -199,15 +199,15 @@ Returns boolean value if any loader exists in page.
199199

200200
Returns boolean value if given loader exists in page.
201201

202-
```html
202+
```vue
203203
<template>
204204
<progress-bar v-if="$wait.is('creating user')">Creating User...</progress-bar>
205205
</template>
206206
```
207207

208208
You can use **`waiting`** alias instead of **`is`**.
209209

210-
```html
210+
```vue
211211
<template>
212212
<div v-if="$wait.waiting('fetching users')">
213213
Fetching users...
@@ -219,7 +219,7 @@ Also you can use matcher to make it more flexible:
219219

220220
Please see [matcher](https://github.com/sindresorhus/matcher/) library to see how to use matchers.
221221

222-
```html
222+
```vue
223223
<template>
224224
<progress-bar v-if="$wait.is('creating.*')">Creating something...</progress-bar>
225225
</template>
@@ -229,7 +229,7 @@ Please see [matcher](https://github.com/sindresorhus/matcher/) library to see ho
229229

230230
Returns boolean value if some of given loaders exists in page.
231231

232-
```html
232+
```vue
233233
<template>
234234
<progress-bar v-if="$wait.is(['creating user', 'page loading'])">Creating User...</progress-bar>
235235
</template>
@@ -239,7 +239,7 @@ Returns boolean value if some of given loaders exists in page.
239239

240240
Starts the given loader.
241241

242-
```html
242+
```vue
243243
<template>
244244
<button @click="$wait.start('creating user')">Create User</button>
245245
</template>
@@ -249,7 +249,7 @@ Starts the given loader.
249249

250250
Stops the given loader.
251251

252-
```html
252+
```vue
253253
<template>
254254
<button @click="$wait.end('creating user')">Cancel</button>
255255
</template>
@@ -259,7 +259,7 @@ Stops the given loader.
259259

260260
Sets the progress of the given loader.
261261

262-
```html
262+
```vue
263263
<template>
264264
<progress min="0" max="100" :value="$wait.percent('downloading')" />
265265
<button @click="$wait.progress('downloading', 10)">Set progress to 10</button>
@@ -273,21 +273,21 @@ Sets the progress of the given loader.
273273
To complete the progress, `current` value should be set bigger than `100`.
274274
If you `total` is given, `current` must be bigger than `total`.
275275

276-
```html
276+
```vue
277277
<button @click="$wait.progress('downloading', 101)">Set as downloaded (101 of 100)</button>
278278
```
279279

280280
or
281281

282-
```html
282+
```vue
283283
<button @click="$wait.progress('downloading', 5, 6)">Set as downloaded (6 of 5)</button>
284284
```
285285

286286
#### `.percent(loader String)`
287287

288288
Returns the percentage of the given loader.
289289

290-
```html
290+
```vue
291291
<template>
292292
<progress min="0" max="100" :value="$wait.percent('downloading')" />
293293
</template>
@@ -301,7 +301,7 @@ You can use directives to make your template cleaner.
301301

302302
Shows if the given loader is loading.
303303

304-
```html
304+
```vue
305305
<template>
306306
<progress-bar v-wait:visible='"creating user"'>Creating User...</progress-bar>
307307
</template>
@@ -311,7 +311,7 @@ Shows if the given loader is loading.
311311

312312
Hides if the given loader is loading.
313313

314-
```html
314+
```vue
315315
<template>
316316
<main v-wait:hidden='"creating *"'>Some Content</main>
317317
</template>
@@ -321,7 +321,7 @@ Hides if the given loader is loading.
321321

322322
Sets `disabled="disabled"` attribute to element if the given loader is loading.
323323

324-
```html
324+
```vue
325325
<template>
326326
<input v-wait:disabled="'*'" placeholder="Username" />
327327
<input v-wait:disabled="'*'" placeholder="Password" />
@@ -332,7 +332,7 @@ Sets `disabled="disabled"` attribute to element if the given loader is loading.
332332

333333
Removes `disabled="disabled"` attribute to element if the given loader is loading.
334334

335-
```html
335+
```vue
336336
<template>
337337
<button v-wait:enabled='"creating user"'>Abort Request</button>
338338
</template>
@@ -342,7 +342,7 @@ Removes `disabled="disabled"` attribute to element if the given loader is loadin
342342

343343
Starts given loader on click.
344344

345-
```html
345+
```vue
346346
<template>
347347
<button v-wait:click.start='"create user"'>Start loader</button>
348348
</template>
@@ -352,7 +352,7 @@ Starts given loader on click.
352352

353353
Ends given loader on click.
354354

355-
```html
355+
```vue
356356
<template>
357357
<button v-wait:click.end='"create user"'>End loader</button>
358358
</template>
@@ -362,7 +362,7 @@ Ends given loader on click.
362362

363363
Toggles given loader on click.
364364

365-
```html
365+
```vue
366366
<template>
367367
<button v-wait:toggle='"flip flop"'>Toggles the loader</button>
368368
</template>
@@ -372,7 +372,7 @@ Toggles given loader on click.
372372

373373
Sets the progress of given loader on click.
374374

375-
```html
375+
```vue
376376
<template>
377377
<button v-wait:click.progress='["downloading", 80]'>Set the "downloading" loader to 80</button>
378378
</template>
@@ -477,7 +477,7 @@ components: {
477477

478478
In template, you should wrap your content with `v-wait` component to show loading on it.
479479

480-
```html
480+
```vue
481481
<v-wait for='fetching data'>
482482
<template slot='waiting'>
483483
This will be shown when "fetching data" loader starts.
@@ -489,7 +489,7 @@ In template, you should wrap your content with `v-wait` component to show loadin
489489

490490
Better example for a `button` with loading state:
491491

492-
```html
492+
```vue
493493
<button :disabled='$wait.is("creating user")'>
494494
<v-wait for='creating user'>
495495
<template slot='waiting'>Creating User...</template>
@@ -506,7 +506,7 @@ With reusable loader components, you will be able to use custom loader component
506506

507507
In this example above, the **tab gets data from back-end**, and the **table loads data from back-end at the same time**. With **vue-wait**, you will be able to manage these two seperated loading processes easily:
508508

509-
```html
509+
```vue
510510
<template lang='pug'>
511511
<div>
512512
<v-wait for="fetching tabs">
@@ -539,7 +539,7 @@ In this example above, the **tab gets data from back-end**, and the **table load
539539

540540
You may want to design your own reusable loader for your project. You better create a wrapper component called `my-waiter`:
541541

542-
```html
542+
```vue
543543
<!-- MySpinner.vue -->
544544
<i18n>
545545
tr:
@@ -570,7 +570,7 @@ You may want to design your own reusable loader for your project. You better cre
570570

571571
Now you can use your spinner everywhere using `slot='waiting'` attribute:
572572

573-
```html
573+
```vue
574574
<template lang="pug">
575575
<v-wait for="fetching data">
576576
<my-waiter slot="waiting" />
@@ -592,7 +592,7 @@ Vue.component('orbit-spinner', OrbitSpinner);
592592
```
593593

594594
Then use it in your as a `v-wait`'s `waiting` slot.
595-
```html
595+
```vue
596596
<v-wait for='something to load'>
597597
<orbit-spinner
598598
slot='waiting'

0 commit comments

Comments
 (0)