Skip to content

ownego/vue-promise-button

This branch is up to date with mihnsen/vue-promise-button:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8b3283c · Apr 13, 2020

History

10 Commits
Oct 15, 2019
Apr 13, 2020
Oct 15, 2019
Oct 15, 2019
Oct 15, 2019
Oct 15, 2019
Oct 15, 2019
Oct 3, 2019
Oct 15, 2019
Oct 15, 2019
Oct 15, 2019
Apr 13, 2020
Oct 15, 2019
Oct 15, 2019
Oct 15, 2019
Mar 30, 2020

Repository files navigation

vue-promise-button

Installation

npm install vue-promise-button
or
yarn add vue-promise-button

Usage

import PromiseButton from 'vue-promise-button';

// For typescript users
import PromiseButton from 'vue-promise-button/src/components/PromiseButton.vue'

// Set global if you want
Vue.component('promise-button', PromiseButton);

// Use it
<promise-button class="button" :promise="promise">
I'm a promise button
</promise-button>

Setup your promise function as a promise like this.

export default {
  methods: {
    promise() {
      return new Promise((resolve, reject) => {
        setTimeout(() => {
          resolve(true)
        }, 2000)
      })
    }
  }
}

With axios and api

export default {
  methods: {
    promise() {
      return axios.get('/users/1234')
    }
  }
}

Development

yarn install

Compiles and hot-reloads for development

yarn run serve

Compiles and minifies for production

yarn run build

Run your tests

yarn run test

Lints and fixes files

yarn run lint

Run your unit tests

yarn run test:unit

Customize configuration

See Configuration Reference.

About

Simple promise button for vuejs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vue 60.6%
  • JavaScript 22.8%
  • HTML 9.0%
  • TypeScript 7.6%