dimanche 14 juillet 2019

how to renders props before all other method on vue js

i want to load/render the props before the created method loaded. so that i can use the props on my on my created method in here in vuejs.this is the way i did it. but my created method is not receiving the data.id. how should i do it? thanks in advance.

 props:['data'],
    data(){
        return {
            products:{},

            abc:1,

        }
    },

    created(){
        axios.get(`/api/category/${this.data.id}`)
            .then(res => this.products = res.data.data)
            .catch(error => console.log(error.response.data))

        console.log(this.data.id);
    },



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire