Skip to content

Coffcer/vue-loading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-loading

Vue directive for show loading block in any element.

Live demo and usage

Build by vue-cli and vue-cli-component

Usage

General usage

<script>
    import loading from 'vue-loading';
    export default {
        directives: { loading },
        data () {
            return { isLoading: false }
        }
    }
</script>

<template>
    <div v-loading="isLoading" :loading-options="{ options }"></div>
    <!--click the button will show the loading block.-->
    <button @click="isLoading = true"></button>
</template>

You can also use vue-loading with vue-router $loadingRouteData

<script>
    export default {
        router: {
            data (transition) {
                // the vue-loading is show.

                window.setTimeout(() => {
                    // the vue-loading will closed after next().
                    transition.next();
                }, 3000);
            }
        }
    }
</script>

<template>
    <div v-loading="$loadingRouteData"></div>
</template>

Options

text:

  • loading block text
  • default value: "Loading ..."

bg:

  • loading block backgroundColor css,
  • default value: "rgba(230, 233, 236, 0.8)"

About

vue1 directive, show loading block in any element

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published