A page is a Vue component in nature. What sets it apart from the standard Vue component is the attributes and functions that are added in Nuxt only. We use these special attributes and functions to set or fetch data before rendering the page, as follows:
<template>
<p>{{ message }}!</p>
</template>
<script>
export default {
asyncData (context) {
return { message: 'Hello World' }
}
}
</script>
In the preceding example, we used a function called asyncData to set the data in the message key. This asyncData function is one of the functions you will see and often use in Nuxt apps. Let's dive into the attributes and functions that are designed specifically for a page in Nuxt.