bootstrap-switch icon indicating copy to clipboard operation
bootstrap-switch copied to clipboard

Use with VueJS and other frameworks besides Angular

Open eberkund opened this issue 9 years ago • 2 comments

I see there is an integration for Angular but I was wondering if it is possible to get this working with VueJS? The problem is that when I add a v-bind attribute to my checkbox it gets removed when bootstrap-switch does it's thing.

eberkund avatar Jul 27 '16 15:07 eberkund

I solved how to use it... I created a directive.

Vue.directive('bsswitch', {
  twoWay: true,
  bind: function () {
    $(this.el).on("switchChange.bootstrapSwitch", function(e) {
      this.set($(this.el).is(':checked'));
    }.bind(this));
  },
  update: function(nv, ov) {
    $(this.el).bootstrapSwitch('state', nv, true);
  }
});

esl-douglas avatar Aug 17 '16 19:08 esl-douglas

+1 👍

Pablo-Araya avatar Apr 28 '19 15:04 Pablo-Araya