alex-oleshkevich / vue-introjs

intro.js bindings for Vue.
MIT License
301 stars 53 forks source link

Unable to listen to any of the events #33

Closed devWaleed closed 6 years ago

devWaleed commented 6 years ago

My intro of app is working correctly but I am unable to listen to events.

In mounted of main App.js I have this code:


mounted: {

    this.$intro().onbeforechange(function (targetElement) {
        console.log("before new step"); // no output
        console.log(targetElement); // no output
    });

    this.$intro().onchange(function (targetElement) {
        console.log("new step"); // no output
    });

    console.log('Post intro start', this.$intro()); // this prints some instance variables
}
devWaleed commented 6 years ago

introJS is chaining events and start() needs to be called here apparently. So correct way to do this is::

this.$intro()
.onbeforechange(function (targetElement) {
    console.log("before new step"); // no output
    console.log(targetElement); // gets element
})
.start();