thainv-dev: Fix bài viết liên quan

This commit is contained in:
nguyen van thai
2024-06-25 14:52:45 +07:00
parent fcb826a7c6
commit 24ecc2195d
2 changed files with 13 additions and 3 deletions
@@ -1,11 +1,15 @@
<script setup lang="ts">
/**
* Content: Type: 1 - Bài viết liên quan | 2 - Bài viết cùng chuyên mục
*
*/
import DynamicComponent from "~/components/dynamic-page/page-component/templates/index.vue";
import { COLLECTION_QUERY_DROP, getValueStringWithKeyAndColon, getInputValue } from "@/utils/parseSQL";
import { breakpoint } from "~/definitions";
import { useWindowSize } from "@vueuse/core";
const { width } = useWindowSize()
const emit = defineEmits(["dropComponent", "dropData", "selectComponent"]);
const { currentArticle } = storeToRefs(useArticleStore())
// const store = reactive({
// section: usePageSectionStore(),
// });
@@ -35,7 +39,14 @@ const LAYOUT_PARSE = computed(() => {
return Object.assign({}, ...parseLayout, designObject);
});
const CONTENT_PARSE = computed(() => JSON.parse(_props.content))
const _dataResult = computed(() => {
console.log(currentArticle.value, 'Content_parse')
if(CONTENT_PARSE.value?.type && CONTENT_PARSE.value?.type === 1) {
return currentArticle.value.relatedArticles || []
}
let _components = Array(Number(LAYOUT_PARSE.value.MAX) || SETTING_OPTIONS.MAX_ELEMENT).fill(null);
const result = getInputValue(_props.dataResult, "ARRAY");
result &&
@@ -103,7 +114,7 @@ const mapActivesToItems = (index: number) => {
return output[index + 1] || {};
};
const CONTENT_PARSE = computed(() => JSON.parse(_props.content))
</script>
<template>