mirror of
https://github.com/BluemediaDev/video-platform.git
synced 2025-05-11 17:51:35 +02:00
Initial commit
This commit is contained in:
commit
97917fb531
21 changed files with 9366 additions and 0 deletions
74
src/views/Home.vue
Normal file
74
src/views/Home.vue
Normal file
|
@ -0,0 +1,74 @@
|
|||
<template>
|
||||
<div class="home">
|
||||
<Loader v-if="$data.loading" />
|
||||
<div v-if="!$data.loading" class="categories">
|
||||
<Category
|
||||
v-for="category in $data.categories"
|
||||
:category="category"
|
||||
:key="category.categoryId"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Loader from "@/components/Loader.vue";
|
||||
import Category from "@/components/Category.vue";
|
||||
import axios from "axios";
|
||||
|
||||
export default {
|
||||
name: "Home",
|
||||
components: {
|
||||
Loader,
|
||||
Category,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
categories: [],
|
||||
loading: true,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getCategories();
|
||||
},
|
||||
methods: {
|
||||
getCategories() {
|
||||
axios
|
||||
.get("/index.json")
|
||||
.then((response) => {
|
||||
this.categories = response.data;
|
||||
this.loading = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.home {
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
padding-top: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.loader {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-right: -50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.categories {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.categories > :not(:first-child) {
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
Loading…
Add table
Add a link
Reference in a new issue