0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-08 12:35:06 +00:00
VueTube/NUXT/pages/search.vue

55 lines
1.3 KiB
Vue
Raw Normal View History

2022-03-03 18:05:50 +00:00
<template>
<div class="py-1">
2022-03-04 14:32:09 +00:00
2022-03-17 21:58:04 +00:00
<center v-if="videos.length == 0">
2022-03-17 21:54:06 +00:00
<v-skeleton-loader type="card-avatar, article, actions" />
<v-skeleton-loader type="card-avatar, article, actions" />
2022-03-04 14:32:09 +00:00
</center>
2022-03-03 23:13:14 +00:00
<v-list-item v-for="(video, index) in videos" :key="index">
2022-03-13 23:21:41 +00:00
<v-card class="entry" :to="`/watch?v=${video.id}`">
2022-03-03 23:13:14 +00:00
<v-card-text>
<div style="position: relative;">
<v-img :src="video.thumbnails[video.thumbnails.length - 1].url" />
2022-03-15 22:33:16 +00:00
<p v-text="video.runtime" class="videoRuntimeFloat" style="color: #fff;" />
</div>
2022-03-13 20:59:01 +00:00
<div v-text="video.title" style="margin-top: 0.5em;" />
<div v-text="`${video.views} • ${video.uploaded}`" />
2022-03-03 23:13:14 +00:00
</v-card-text>
</v-card>
</v-list-item>
2022-03-03 18:05:50 +00:00
</div>
</template>
2022-03-04 02:25:30 +00:00
<style scoped>
.entry {
2022-03-04 14:17:32 +00:00
margin-top: 1em;
2022-03-13 20:59:01 +00:00
width: 100%; /* Prevent Loading Issues */
2022-03-04 02:25:30 +00:00
}
.videoRuntimeFloat {
position: absolute;
bottom: 0;
right: 10px;
background: rgba(0, 0, 0, 0.5);
border-radius: 1em;
padding: 3px;
}
2022-03-04 02:25:30 +00:00
</style>
2022-03-03 18:05:50 +00:00
<script>
export default {
data() {
return {
2022-03-17 21:54:06 +00:00
videos: []
2022-03-03 18:05:50 +00:00
}
},
mounted() {
2022-03-04 02:25:30 +00:00
const searchQuestion = this.$route.query.q
2022-03-03 18:05:50 +00:00
const vm = this;
2022-03-04 02:25:30 +00:00
this.$youtube.search(searchQuestion, (data) => {
2022-03-03 23:13:14 +00:00
vm.videos = data;
2022-03-03 18:05:50 +00:00
})
}
}
</script>