File size: 903 Bytes
2d9063d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(function () {
    "use strict";
    var app = new Alpine.Application(document.getElementById('app'));
    app.component({
        // Wrapping element with the appropriate Alpine data
        el: '#app',
        data: {
            // "open" is a boolean that controls the visibility of the modal
            open: false,
            // "step" is a number that indicates which step of the guide we are on
            step: 0,
            // "stepper" is a function that increments the "step" number by 1
            stepper: function(value) {
                if (typeof value === 'number' && value > 0) {
                    this.step += value;
                } else {
                    this.step = 1;
                }
            }
        },
        // When the app starts, the modal is open and the first step is displayed
        mounted() {
            this.open = true;
        }
    });
})();