1.0.5 • Published 7 years ago
vue-on-off v1.0.5
Vue on-off switch component
Installation
npm i -s vue-on-offOr...
yarn add vue-on-offOr...
git clone https://github.com/Onefivefournine/vue-on-off.gitUsage
// register locally
import onOff from 'vue-on-off';
const app = new Vue({
  components: {
    onOff
  },
  data() {
    return {
      model: false
    };
  },
  methods: {
    modelChangeHandler() {
      /*
			* some API request or other actions,
			* you DON'T need to set model = !model
			*/
    }
  }
});
// OR register globally
Vue.component('onOff', onOff);	<on-off v-model="model" :action="modelChangeHandler"></on-off>