Example:

Vue.js Using in an Instance

Since all lifecycle hooks in Vue.js are just functions, you can place any of them directly in the instance declaraction.

//JS
new Vue({

    el: '#example',

    data: {
        ...
    },

    methods: {
        ...
    },

    //LIFECYCLE HOOK HANDLING
    created: function() {
        ...
    },

    ready: function() {
        ...
    }

});

Related Vue.js Tutorial Topics:

Other Tutorial Topics:

This modified content is an extract of the original Stack Overflow Documentation released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow. This topic was created and modified by the Stack Ovedrflow Contributor.