Files
NSG_PORTAL_V2/components/dynamic-page/page-component/templates/articles/details/Video.vue
T

94 lines
2.3 KiB
Vue
Raw Normal View History

2024-06-28 15:39:26 +07:00
<script setup lang="ts">
2024-07-10 17:39:38 +07:00
const { categoryTree } = storeToRefs(useCategoryStore());
const { currentArticle } = storeToRefs(useArticleStore());
if (categoryTree.value) {
await useCategoryStore().fetchBySiteId();
}
const currentCategoryTree = findElementPathById(categoryTree.value, currentArticle.value.categoryId);
function findElementPathById(categories: any[], targetId: number, path: any[] = []) {
for (const category of categories) {
const currentPath = [...path, { title: category.title, code: category.code }];
if (category.id === targetId) {
return currentPath;
}
if (category.children) {
const result: any = findElementPathById(category.children, targetId, currentPath);
if (result) {
return result;
}
}
}
return null;
}
2024-06-28 15:39:26 +07:00
</script>
<template>
2024-07-10 17:39:38 +07:00
<div class="video-container">
<ul class="flex gap-32px lg:ml-80px md:ml-40px sm:ml-20px">
<li v-for="(category, index) in currentCategoryTree" :key="index" class="first:text-#000 text-#929292 last:after:content-[''] relative after:absolute after:content-['/'] after:text-20px after:right--20px">
<nuxt-link class="font-raleway text-18px font-500 leading-180% uppercase" :to="`/${category.code}`">{{ category.title }}</nuxt-link>
</li>
</ul>
2024-06-28 15:39:26 +07:00
2024-07-10 17:39:38 +07:00
<div class="video-content" v-html="currentArticle.detail"></div>
</div>
2024-06-28 15:39:26 +07:00
</template>
<style scoped lang="scss">
2024-07-10 17:39:38 +07:00
.video-container {
width: 100%;
max-width: 1080px;
margin: auto;
.category-list {
display: flex;
gap: 32px;
margin-bottom: 26px;
list-style: none;
padding: 0;
margin: 0 0 0 80px;
.category-item {
color: #929292;
position: relative;
font-size: 18px;
& > span {
font-size: 18px;
font-weight: 500;
line-height: 180%;
text-transform: uppercase;
}
&::after {
position: absolute;
content: "/";
font-size: 20px;
right: -20px;
}
&:first-child {
color: #000;
}
&:last-child {
&::after {
content: "";
}
}
}
}
.video-content {
width: 100%;
// max-width: 1080px;
margin: 26px 0 26px 0px;
// background-color: #eee;
// height: 500px;
font-size: 20px;
display: flex;
align-items: center;
justify-content: center;
}
2024-06-28 15:39:26 +07:00
}
</style>