1.0.9 • Published 2 years ago

v-loading-plugin v1.0.9

Weekly downloads
1
License
ISC
Repository
-
Last release
2 years ago

v-loading-plugin


English | 简体中文

  1. It is suitable for vue2.x. It can automatically monitor the state of asynchronous function and display loading according to its state. The effect is remarkable.
  2. source code
  3. If you think it's good, please give a star.

Install

npm install v-loading-plugin

or

yarn add v-loading-plugin

Usage

main.js

import loadingPlugin from 'v-loading-plugin';

Vue.use(loadingPlugin)
//or
Vue.use(loadingPlugin,{
  namespace:'$loadingPlugin'
})

demo.vue

<template>
  <div v-if="$loadingPlugin.getList">loading ...</div> 
  <!-- Here loading is automatically displayed according to the asynchronous state of the getList function. -->
</template>
<script>
export default {
  created(){
    this.getList();
  },
  methods:{
    async getList(){
      await timeout(3000)
    }
  },
}

function timeout (delay){
  return new Promise((resolve, reject)=>{
      setTimeout(()=>{
          resolve();
      },delay)
  })
}
</script>   
1.0.9

2 years ago

1.0.8

3 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago