0.0.2 • Published 8 years ago

vue-disabled v0.0.2

Weekly downloads
38
License
MIT
Repository
github
Last release
8 years ago

vue-disabled

A vue directive to automatically disable buttons or other form elements when certain reactive data are true.

Install

npm i -S vue-disabled

Usage

import Vue from 'vue'
import VueDisabled from 'vue-disabled'
Vue.use(VueDisabled)

In a template of a vue component:

<template>
  ...
  <button @click="run" v-disabled="running">run</button>
  ...
</template>

<script>
export default {
  ...
  data() {
    return {
      ...
      running: false;
      ...
    }
  ...
  }
}
</script>

When this.running turns true, the button is disabled, avoiding redundant operations like network loading etc. When this.running turns false, the button is recovered.