what is nuxt.js code example
Example 1: Nuxt js
methods: {
formatDate(date) {
const options = { year: 'numeric', month: 'long', day: 'numeric' }
return new Date(date).toLocaleDateString('en', options)
}
}
Example 2: Nuxt js
<template>
<article>
<h1>{{ article.title }}</h1>
<p>{{ article.description }}</p>
<img :src="article.image" :alt="article.alt" />
<p>Article last updated: {{ formatDate(article.updatedAt) }}</p>
<nuxt-content :document="article" />
</article>
</template>
Example 3: Nuxt JS
<template>
<article>
<h1>{{ article.title }}</h1>
<p>{{ article.description }}</p>
<img :src="require(`~/assets/images/${article.img}`)" :alt="article.alt" height="100px" />
<p>Article last updated: {{ formatDate(article.updatedAt) }}</p>
<nuxt-content :document="article" />
<NuxtLink to="/" class="button--grey">Статья 1</NuxtLink>
</article>
</template>