1.0.2 • Published 5 years ago

vue-component-loading-screen v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

VUE-COMPONENT-LOADING-SCREEN PLUGIN

Vue Component Loading screen is a simple plugin for show an indicator when your component is busy.

  • You can activate/disable loading screens manually
  • You can bind your screen states to Axios.

Installation

$ npm install vue-component-loading-screen

Implementation

import Vue from 'vue'
import App from './App.vue'
import VueComponentLoading from "./VueComponentLoadingScreenPlugin";
import "./vue-component-loading-screen.css";

Vue.use(VueComponentLoading,{
  loadingImage:"[YOUR LOADING IMAGE PATH]", //-> Required
  overlayBackgroundColor:"rgba(0,0,0,0.3)" //-> Optional (RGB OR HEX)
});

Manual Screen Activation

export default {
  name: 'HelloWorld',
  methods:{
      exampleMethod(){
          this.COMPONENT_IS_BUSY(); //->Activates loading screen
          /*
          Bunch of code doing something.
          ..................
          ..............................
          .........................................
          */
          this.COMPONENT_IS_IDLE(); // -> Disables loading screen
      }
  }
}

Binding Screen States To Axios Instance

Loading screen activates before request sent and disables when response received or error occured.

import axios from "axios";
export default {
  name: 'HelloWorld',
  methods:{
    sendAjax(){
        var yourAxiosInstance = axios.create({
              baseURL: '[SOME API PATH]'
        });
        this.bindLoadingScreenToAxios(yourAxiosInstance);
        yourAxiosInstance();
    }
  }
}

OPTIONS

OptionDescriptionIs RequiredDefault Value
loadingImagePath of your loading imagetrue-
overlayBackgroundColorLoading screen background color. You can set HEX or RGB valuefalsergba(0,0,0,0.5)

License

MIT

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago