vue-promise-btn

Vue.js plugin that handles buttons asynchronous lock and show loading state indicator
6,334 173
Install
npm install vue-promise-btn
Latest Version:2.1.0
Vue:2
License:MIT
Last Updated:Dec 29, 2022
Links: GitHub  ·  npm
Maintainer: stukh

vue-promise-btn

NPM Version Download Month

Example and Documentation

https://STUkh.github.io/vue-promise-btn/

vue-promise-btn

Features

  • Easy-to-use API
  • Flexible Usage
  • Works with any tag and even forms
  • In Extended Mode - compatible with 3rd party components
  • Packaged with optional built-in spinner
  • Only 1.5KB minified and gzipped
  • ESM, CommonJS, UMD versions

Installation

npm install --save vue-promise-btn
Quick Start:
  • Import and "handshake" plugin with vue
import Vue from 'vue'
import VuePromiseBtn from 'vue-promise-btn'

// not required. Styles for built-in spinner
import 'vue-promise-btn/dist/vue-promise-btn.css'

Vue.use(VuePromiseBtn) // or with global options Vue.use(VuePromiseBtn, {})
  • Simple usage: <button v-promise-btn @click="getData">Get Data</button>
  • Extended usage: <button v-promise-btn={ promise: dataPromise } @click="getData('param')">Get Data</button>
If you face any issue with simple mode, just try out extended, it's more reliable way.

Change log

Please see CHANGELOG for more information what has changed recently.

Important Notice

Always return Promise from expression. Especially in simple mode.

Don't use semicolon in event expressions. It may break promise return in template-compiler:
Good: @click="handler($event)"
Bad: @click="handler($event);"

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

© STUkh stukak@gmail.com

Related Packages

@gits-id/button

GITS Button Component

3,969
vue-csspin

vue spinner component for vue.js 3.x(css-pin wrapper)

1,637 0
vue-preloaders

Stable, Flexible and Fully Customizable Vue preloaders library

1,220
vue-activity-indicator

Activity indicating (loading) icon in shape of a spinning wheel

1,014 0
vue-loading-overlay

Vue.js component for full screen loading indicator.

2,880,068 1,261

Version History

Version Released Vue License
2.1.0 ^2.6.3 MIT
2.0.2 ^2.6.3 MIT
2.0.1 ^2.6.3 MIT
2.0.0 ^2.6.3 MIT
1.3.1 ^2.6.3 MIT