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>
|
||||
78
pages/category/video.vue
Normal file
78
pages/category/video.vue
Normal file
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<v-container grid-list-md>
|
||||
|
||||
<!-- <lite-youtube
|
||||
v-bind:videoid= "`${videoNews[0].slug}`"
|
||||
playlabel="Play: Keynote (Google I/O '18)"
|
||||
params="controls=0&start=10&end=30&modestbranding=2&rel=0&enablejsapi=1"
|
||||
/>
|
||||
<h2> {{videoNews[0].title}} </h2> -->
|
||||
<v-layout row wrap >
|
||||
<v-flex v-for="vn in videoNews" :key="videoNews.id" xs12 md6 lg3>
|
||||
|
||||
<v-card width="95%">
|
||||
<lite-youtube
|
||||
v-bind:videoid= "`${vn.content}`"
|
||||
params="controls=0&start=10&end=30&modestbranding=2&rel=0&enablejsapi=1"
|
||||
/>
|
||||
<p class="px-4">On : <span v-text="vn.created_at.slice(0,10)"></span>
|
||||
, at : <span v-text="vn.created_at.slice(11,-5)"></span></p>
|
||||
|
||||
|
||||
<v-card-title primary-title>
|
||||
<div>
|
||||
<h3 class="headline mb-0" v-text="vn.title"></h3>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<a
|
||||
:href="`https://youtu.be/${vn.content}`">
|
||||
<v-btn color="error"> পুরো দেখুন </v-btn>
|
||||
</a></div>
|
||||
</v-card-title>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
|
||||
</v-container>
|
||||
</template>
|
||||
<script>
|
||||
// import VueYoutube from 'vue-youtube'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
videoId: 'l5yX7cY0iSE',
|
||||
videoNews:[]
|
||||
}
|
||||
},
|
||||
// methods: {
|
||||
// playVideo() {
|
||||
// this.player.playVideo()
|
||||
// },
|
||||
// playing() {
|
||||
// console.log('\o/ we are watching!!!')
|
||||
// }
|
||||
// },
|
||||
// computed: {
|
||||
// player() {
|
||||
// return this.$refs.youtube.player
|
||||
// }
|
||||
// },
|
||||
async asyncData({ $axios, $config }) {
|
||||
let videoNews = await $axios.$get(`/bartas/?category=video&_sort=id:DESC&_limit=20`)
|
||||
|
||||
// need to create the json / var first
|
||||
// if(worldNews.length < 1) { worldNews[0].image.url="", worldNews[0].slug="404", worldNews[0].slug="not found";}
|
||||
// if(nationalNews.length < 1) { nationalNews[0].image.url="", nationalNews[0].slug="404", nationalNews[0].slug="not found";}
|
||||
// if(localNews.length < 1) { localNews[0].image.url="", localNews[0].slug="404", localNews[0].slug="not found";}
|
||||
// if(articleNews.length < 1) { articleNews[0].image.url="", articleNews[0].slug="404", articleNews[0].slug="not found";}
|
||||
// if(editorialNews.length < 1) { editorialNews[0].image.url="", editorialNews[0].slug="404", editorialNews[0].slug="not found";}
|
||||
// if(videoNews.length < 1) { videoNews[0].image.url="", videoNews[0].slug="404", videoNews[0].slug="not found";}
|
||||
|
||||
videoNews = JSON.parse(JSON.stringify(videoNews).replace(/\:null/gi, "\:\"\""));
|
||||
return { videoNews }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user