diff --git a/src/index.vue b/src/index.vue index cbff8d4..0bbcd59 100644 --- a/src/index.vue +++ b/src/index.vue @@ -23,6 +23,10 @@ export default { type: Boolean, default: false, }, + toggle: { + type: Function, + default: () => {} + } }, data() { return { updating: false, }; @@ -39,6 +43,11 @@ export default { } this.$$el.bootstrapToggle(newValue ? 'on' : 'off'); + + // delegate to method + this.$$el.change(() => { + this.toggle($(this).prop('checked')) + }) }, disabled(newValue) { this.$$el.bootstrapToggle(newValue ? 'disable' : 'enable');