use useState composable

Signed-off-by: nurRiyad <asadnurriyad@gmail.com>
This commit is contained in:
nurRiyad
2022-12-22 23:57:11 +06:00
parent 25b94a6859
commit 4508c10b33
10 changed files with 57 additions and 52 deletions

View File

@@ -1,15 +1,17 @@
<script setup lang="ts">
import { ParsedContent } from "@nuxt/content/dist/runtime/types";
const route = useRoute();
const routeType = computed(() => {
return route.params.topic || "";
});
const { data } = await useLazyAsyncData("listhero", () =>
queryContent(`/${routeType.value}`).find()
);
const data = useState("blogData");
const typeName = computed(() => {
return data.value?.at(0)?.type || "";
const allpost = (data.value as Array<ParsedContent>) || [];
const filteredType = allpost.filter((post) => post._dir === routeType.value);
return filteredType.at(0)?.type || "";
});
const title = computed(() => {