[Vuejs]-How to solve "Uncaught TypeError: Cannot read property 'get' of undefined"? (Vue.JS 2)

3👍

You lost context,
Use bind:

methods: {
    reloadMessage() {
        setTimeout(function () {
            this.$http.get(window.BaseUrl + '/message/inbox');
        }.bind(this), 1500);
    }
} 

or arrow function:

methods: {
    reloadMessage() {
        setTimeout(() => this.$http.get(window.BaseUrl + '/message/inbox'), 1500);
    }
} 

Leave a comment