[Vuejs]-Update Vue.js data

0👍

Seems you at least need to place the method inside beforeMount() hook?

Also, defining a data model for a component is a good practice

// methods: {...},
data(){
    return {
        items: null
    }
},
// mounted: {...}

0👍

in the success: portion of your ajax method change that.items to this.items where (as @mannok said) items is defined in your vue instance data property. Also, this.$forceUpdate() is probably unnecessary. Vue will automatically update when data changes (as long as you aren’t adding properties to an existing object or array).

Leave a comment