[Vuejs]-How to use data value inside mounted vue js

2👍

You can use computed properties:

export default {
    props: ['userid'],

    computed: {
        userID() {
            return this.userid
        }
    },

    mounted() {
        console.log(this.userID);
    }
}

Or simply:

export default {
    props: ['userid'],

    mounted() {
        console.log(this.userid);
    }
}
👤Ikbel

Leave a comment