vue 最简单的加载插件
vuejs加载插件 (vuejs-loading-plugin)
Simple loading screen plugin for your Vue application.
适用于Vue应用程序的简单加载屏幕插件。
入门 (Getting Started)
Install
安装
npm i --save vuejs-loading-plugin
Set up
建立
import VueLoading from 'vuejs-loading-plugin'
// using default options
Vue.use(VueLoading)
// overwrite defaults
Vue.use(VueLoading, {
dark: true, // default false
text: 'Ladataan', // default 'Loading'
loading: true, // default false
customLoader: myVueComponent, // replaces the spinner and text with your own
background: 'rgb(255,255,255)', // set custom background
classes: ['myclass'] // array, object or string
})
Usage
用法
// set loading state manually in components
this.$loading(true)
this.$loading(false)
// use async function
// takes promise and returns a promise
import { asyncLoading } from 'vuejs-loading-plugin'
const login = new Promise( (resolve, reject) => {
// api call
})
asyncLoading(login).then().catch()
翻译自: https://vuejsexamples.com/simple-loading-screen-plugin-for-your-vue-application/
vue 最简单的加载插件