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
@@ -93,7 +93,6 @@ async function copyLink() {
} }
} }
console.log(currentArticle.value,'currentArtice')
</script> </script>
<template> <template>
<div id="breadcrumb" class="flex justify-between items-center my-3 font-arial"> <div id="breadcrumb" class="flex justify-between items-center my-3 font-arial">
@@ -1,11 +1,15 @@
<script setup lang="ts"> <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 DynamicComponent from "~/components/dynamic-page/page-component/templates/index.vue";
import { COLLECTION_QUERY_DROP, getValueStringWithKeyAndColon, getInputValue } from "@/utils/parseSQL"; import { COLLECTION_QUERY_DROP, getValueStringWithKeyAndColon, getInputValue } from "@/utils/parseSQL";
import { breakpoint } from "~/definitions"; import { breakpoint } from "~/definitions";
import { useWindowSize } from "@vueuse/core"; import { useWindowSize } from "@vueuse/core";
const { width } = useWindowSize() const { width } = useWindowSize()
const emit = defineEmits(["dropComponent", "dropData", "selectComponent"]); const emit = defineEmits(["dropComponent", "dropData", "selectComponent"]);
const { currentArticle } = storeToRefs(useArticleStore())
// const store = reactive({ // const store = reactive({
// section: usePageSectionStore(), // section: usePageSectionStore(),
// }); // });
@@ -35,7 +39,14 @@ const LAYOUT_PARSE = computed(() => {
return Object.assign({}, ...parseLayout, designObject); return Object.assign({}, ...parseLayout, designObject);
}); });
const CONTENT_PARSE = computed(() => JSON.parse(_props.content))
const _dataResult = computed(() => { 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); let _components = Array(Number(LAYOUT_PARSE.value.MAX) || SETTING_OPTIONS.MAX_ELEMENT).fill(null);
const result = getInputValue(_props.dataResult, "ARRAY"); const result = getInputValue(_props.dataResult, "ARRAY");
result && result &&
@@ -103,7 +114,7 @@ const mapActivesToItems = (index: number) => {
return output[index + 1] || {}; return output[index + 1] || {};
}; };
const CONTENT_PARSE = computed(() => JSON.parse(_props.content))
</script> </script>
<template> <template>