Issues (121)

src/js/components/toggle.js (1 issue)

Labels
Severity
1
Mivhak.component('toggle', {
0 ignored issues
show
The variable Mivhak seems to be never declared. If this is a global, consider adding a /** global: Mivhak */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
2
    template: '<div class="mivhak-toggle"><div class="mivhak-toggle-knob"></div></div>',
3
    props: {
4
        on: true
5
    },
6
    events: {
7
        click: function() {
8
            this.toggle();
9
        }
10
    },
11
    created: function() {
12
        this.$el.addClass('mivhak-toggle-'+(this.on?'on':'off'));
13
    },
14
    methods: {
15
        toggle: function() {
16
            this.on = !this.on;
17
            this.$el.toggleClass('mivhak-toggle-on').toggleClass('mivhak-toggle-off');
18
        }
19
    }
20
});