Coder Social home page Coder Social logo

iq-scm / vue-promise-btn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stukh/vue-promise-btn

0.0 0.0 0.0 4.02 MB

Vue.js plugin that handles buttons async lock state. Demo: https://stukh.github.io/vue-promise-btn/

License: MIT License

JavaScript 46.53% CSS 2.99% HTML 45.66% Vue 4.82%

vue-promise-btn's Introduction

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 [email protected]

vue-promise-btn's People

Contributors

alex-stepchenkov-neyber avatar dependabot[bot] avatar operkh avatar saraedum avatar stukh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.