vuetify-loading-overlay

1.0.4 • Public • Published

Vuetify loading overlay

This package serves to display a load on the whole page, useful when you expect an ajax response from an API. It only works with the vuetify framework, since it uses components of it.

Install

npm -i vuetify-loading-overlay
yarn add vuetify-loading-overlay

Usage

Vue

import {LoadingPlugin} from "vuetify-loading-overlay"
Vue.use(LoadingPlugin, {
    //props
    spinnerProps: {},
    overlayProps: {},
});

Nuxt

for nuxt you have to create a plugin and add it to your nuxtconfig

import Loading from "vuetify-loading-overlay"
export default ({ app }, inject) => {
  inject(
    "vloading",
    Loading({
      spinnerProps: {},
      overlayProps: {},
    })
  );
};

Example

<template>
    <form @submit.prevent="submit">
        <input type="text" name="email" />
        <input type="password" name="password" />
        <button type="submit">Login</button>
    </form>
</template>
 
<script>
    export default {
        data() {
            return {
            }
        },
        methods: {
            submit() {
                this.$vloading.show();
                // simulate AJAX
                setTimeout(() => {
                  this.$vloading.hide()
                },5000)                 
            },
            onCancel() {
              console.log('User cancelled the loader.')
            }                      
        }
    }
</script>

the use is simple, you just have to call the api and its methods this.$vloading.show() this.$vloading.hide()

Props

snipperProps

{
    color: "primary"
}

You can check the properties of the spinner in its official documentation

overlayProps

{
    color: "red"
}

You can check the properties of the overlay in its official documentation

Author

rldev25

Licence

MIT

Package Sidebar

Install

npm i vuetify-loading-overlay

Weekly Downloads

85

Version

1.0.4

License

MIT

Unpacked Size

4.48 kB

Total Files

5

Last publish

Collaborators

  • wimil