Sometimes, we want to access props in mounted function with Vue.js.
In this article, we’ll look at how to access props in mounted function with Vue.js.
How to access props in mounted function with Vue.js?
To access props in mounted function with Vue.js, we can get the value from this
.
For instance, we write
<script>
//...
export default {
//...
props: ["subscriptions"],
async mounted() {
await this.$nextTick();
console.log(this.subscriptions);
},
//...
};
</script>
to register the subscriptions
prop with
props: ["subscriptions"]
Then we get the subscriptions
prop value in the mounted
hook with
this.subscriptions