vue-notify-loading-decorators
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

vue-notify-loading-decorators

A library for Vue.js to toggle a loading indicator with decorators on a component.

(use along with vue-class-component)

Installation

npm install vue-notify-loading-decorators

or

yarn add vue-notify-loading-decorators

Example

<template>
  <div>
    <my-loader v-if="isLoading" /> 
    <!--... dynamic data visualisation -->
  </div>
</template>
<script lang="ts">
import {mixins, Component} from 'vue-class-component'; 
import { NotifyLoadingMixin, NotifyLoadingAsync } from 'vue-notify-loading-decorator'; 
 
@Component
class SomeDynamicComponent extends mixins(NotifyLoadingMixin) {
  
  @NotifyLoadingAsync
  async loadSomething() {
     await service.getAll();
  }
 
  @NotifyLoadingAsync
  async loadSomethingElse() {
    await someAction();
  }  
}
</script>

Instead of:

 
<template>
  <div>
    <my-loader v-if="isLoading" /> 
    <!--... dynamic data visualisation -->
  </div>
</template>
<script >
import {Component} from 'vue-class-component';
@Component
class SomeDynamicComponent extends Vue {
  loading: boolean = false; 
 
   async loadSomething() {
    this.loading = true;
    this.products = await service.getAll();
    this.loading = false;  
  }
 
   async loadSomethingElse() {
    this.loading = true;
    await someAction();
    this.loading = false;
  }  
}
</script>
 

Package Sidebar

Install

npm i vue-notify-loading-decorators

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

20.1 kB

Total Files

33

Last publish

Collaborators

  • robbertvh