init
This commit is contained in:
47
pages/category/_slug.vue
Normal file
47
pages/category/_slug.vue
Normal file
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<v-container grid-list-md>
|
||||
<!-- <h1>Mountaiins</h1> -->
|
||||
<!-- <ul v-for="wn in worldNews.slice(-4)" :key="wn.slug">
|
||||
<li>{{ wn.title }}</li>
|
||||
<li>{{ wn.image.url }}</li>
|
||||
</ul> -->
|
||||
|
||||
<v-layout row wrap v-if="worldNews.length > 0">
|
||||
<v-flex v-for="wn in worldNews" :key="worldNews.slug" xs12 md6 lg3>
|
||||
<nuxt-link :to="`/${wn.slug}`">
|
||||
<v-card width="95%">
|
||||
<v-img :src="`https://api5.siliconpin.com${wn.image.url}`" aspect-ratio="2.75"></v-img>
|
||||
|
||||
<v-card-title primary-title>
|
||||
<span class="px-4">Published on : {{wn.created_at.slice(0,10)}} </span><br>
|
||||
<span class="px-4">At : {{wn.created_at.slice(11, -5)}} </span>
|
||||
<div>
|
||||
<p style="overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp:2;" class="" v-text="wn.title">
|
||||
</p>
|
||||
</div>
|
||||
</v-card-title>
|
||||
</v-card>
|
||||
</nuxt-link>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout v-else>
|
||||
<h4 style="margin-left: 20px;">No news available in this topic now! Please visit again.</h4>
|
||||
</v-layout>
|
||||
</v-container>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
async asyncData({ $axios, route }) {
|
||||
let worldNews = await $axios.$get(
|
||||
`/bartas/?category=` + route.params.slug + `&lang=bn&_sort=id:DESC`
|
||||
);
|
||||
// console.log(worldNews);
|
||||
worldNews = JSON.parse(JSON.stringify(worldNews).replace(/\:null/gi, "\:\"\""));
|
||||
|
||||
return { worldNews };
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user