Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-loading-overlay

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-loading-overlay

Vue.js v2.x component for full screen loading indicator

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
53K
increased by1.94%
Maintainers
1
Weekly downloads
 
Created
Source

Vue Loading Overlay Component

vue-js downloads npm-version github-tag license

Vue.js v2.x component for full screen loading indicator

Demo on JSFiddle

Installation

:mega: Now published to npm

# npm
npm install vue-loading-overlay --save

# Yarn
yarn add vue-loading-overlay

Usage

As component
<template>
    <div>
        <loading :active.sync="isSaving" :can-cancel="true"></loading>
    </div>
</template>

<script>
    // Import component
    import Loading from 'vue-loading-overlay';
    // Import stylesheet
    import 'vue-loading-overlay/dist/vue-loading.min';

    export default {
        data() {
            return {
                isSaving: false,
            }
        },
        components: {
            Loading
        },
        methods: {
            submit() {
                this.isSaving = true;
                // do AJAX here
            }
        }
    }
</script>

As plugin

<template>
    <form @submit.prevent="submit">
        <!-- form inputs -->
    </form>
</template>

<script>
    import Vue from 'vue';
    // Import component
    import Loading from 'vue-loading-overlay';
    // Import stylesheet
    import 'vue-loading-overlay/dist/vue-loading.min';
    // Init plugin
    Vue.use(Loading);

    export default {
        methods: {
            submit() {
                let loader = this.$loading.show();
                axios.post('/api').then((response)=>{
                  loader.hide()
                })                 
            }
        }
    }
</script>

Available props

The component accepts these props:

AttributeTypeDefaultDescription
canCancelBooleanfalseAllow user to cancel
onCancelFunction()=>{}Do something upon cancel

Install in non-module environments (without webpack)

<!-- Vue js -->
<script src="https://unpkg.com/vue@2.5/dist/vue.min.js"></script>
<!-- Lastly add this package -->
<script src="https://unpkg.com/vue-loading-overlay@2"></script>
<link rel="stylesheet" href="https://unpkg.com/vue-loading-overlay@latest/dist/vue-loading.min.css">
<!-- Init the plugin -->
<script>
Vue.use(VueLoading)
</script>

Run examples on your localhost

  • Clone this repo
  • Make sure you have node-js >=6.10 and yarn >=1.x pre-installed
  • Install dependencies - yarn install
  • Run webpack dev server - yarn start
  • This should open the demo page at http://localhost:8000 in your default web browser

Credits

License

MIT License

Keywords

FAQs

Package last updated on 11 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc