feat: add dynamic FeaturedBlog

This commit is contained in:
kmacoders 2021-07-01 00:33:45 +07:00
parent 5036d3602f
commit d642a70773
2 changed files with 25 additions and 7 deletions

View File

@ -3,21 +3,29 @@
<div class="column is-12 post"> <div class="column is-12 post">
<article class="columns featured"> <article class="columns featured">
<div class="column is-7 post-img "> <div class="column is-7 post-img ">
<img src="https://cdn.emk.dev/templates/featured-image.png" alt=""> <img :src="firstBlog.image" :alt="firstBlog.title">
</div> </div>
<div class="column is-5 featured-content va"> <div class="column is-5 featured-content va">
<div> <div>
<h3 class="heading post-category"> <h3 class="heading post-category">
Category Name <NuxtLink
v-for="(tag, index) in firstBlog.tags"
:key="index"
to="/"
>
{{ tag }}
</NuxtLink>
</h3> </h3>
<h1 class="title post-title"> <h1 class="title post-title">
Blog Posts Template {{ firstBlog.title }}
</h1> </h1>
<p class="post-excerpt"> <p class="post-excerpt">
This template is based off of the official default blog template created by the fine folks over at <a href="https://ghost.io">Ghost</a>. If you are looking for a fully featured blog platform, I highly recommend checking them out! {{ firstBlog.description }}
</p> </p>
<br> <br>
<a href="#" class="button is-primary">Read More</a> <NuxtLink :to="firstBlog.path" class="button is-primary">
Read More
</NuxtLink>
</div> </div>
</div> </div>
</article> </article>
@ -28,7 +36,17 @@
<script> <script>
import { Vue, Component } from 'nuxt-property-decorator' import { Vue, Component } from 'nuxt-property-decorator'
@Component @Component({
props: {
firstBlog: {
type: Object,
required: true
}
}
})
export default class FeaturedBlog extends Vue { export default class FeaturedBlog extends Vue {
mounted () {
console.log(this.firstBlog)
}
} }
</script> </script>

View File

@ -3,7 +3,7 @@
<div class="container"> <div class="container">
<div class="columns"> <div class="columns">
<div class="column is-10 is-offset-1"> <div class="column is-10 is-offset-1">
<FeaturedBlog /> <FeaturedBlog :first-blog="allArticles[0]" />
<hr> <hr>
<ListBlog /> <ListBlog />
</div> </div>