change: loading performance
This commit is contained in:
parent
7c8be0ccb9
commit
716b5535ae
14 changed files with 129 additions and 98 deletions
|
@ -29,7 +29,6 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const title = await calculateTitle();
|
||||
const { footer } = await provideGlobal();
|
||||
const { links, maintained_by, copyright } = footer ?? {};
|
||||
const { footer, title } = useGlobal();
|
||||
const { links, maintained_by, copyright } = footer.value ?? {};
|
||||
</script>
|
||||
|
|
|
@ -64,8 +64,6 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import provideGlobal from "../composables/provideGlobal";
|
||||
|
||||
const {
|
||||
params: { slug: params },
|
||||
} = useRoute();
|
||||
|
@ -73,12 +71,12 @@ const {
|
|||
const runtimeConfig = useRuntimeConfig();
|
||||
const baseUrl = runtimeConfig.public.strapi.url;
|
||||
|
||||
const { logo, navbar } = await provideGlobal();
|
||||
const { logo, navbar } = useGlobal();
|
||||
|
||||
const open = ref(false);
|
||||
|
||||
const navbar_sub_items = computed(() => {
|
||||
if (!navbar) return [];
|
||||
return navbar.navbar_items.find((ni) => ni.URL == params?.[0])?.navbar_sub_items;
|
||||
if (!navbar.value) return [];
|
||||
return navbar.value.navbar_items.find((ni) => ni.URL == params?.[0])?.navbar_sub_items;
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
:class="allowNavigation ? '' : 'pointer-events-none'"
|
||||
:to="`${urlOverwrite ?? $route.path}/${data?.slug}`"
|
||||
>
|
||||
<div class="w-full h-56 relative">
|
||||
<div class="w-full h-56 min-h-56 relative">
|
||||
<NuxtPicture
|
||||
loading="lazy"
|
||||
class="w-full h-full object-cover object-center"
|
||||
class="w-full h-full min-h-full object-cover object-center"
|
||||
:src="data?.image?.url || logo?.url ? baseUrl + (data?.image?.url ?? logo?.url) : '/favicon.png'"
|
||||
:imgAttrs="{ class: 'w-full h-full object-cover object-center' }"
|
||||
/>
|
||||
|
@ -20,11 +20,11 @@
|
|||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="w-full h-44 relative bg-white px-2 py-5 flex flex-col justify-start items-start gap-2 overflow-y-auto">
|
||||
<div class="w-full grow relative bg-white p-2 pb-4 flex flex-col justify-start items-start gap-2 overflow-y-auto">
|
||||
<h1>
|
||||
{{ data?.title }}
|
||||
</h1>
|
||||
<p v-if="itemDate && lookup?.show_date" class="w-full text-[#5c5c5c]">
|
||||
<p class="w-full text-[#5c5c5c] line-clamp-2 overflow-hidden">
|
||||
{{ itemDate }}
|
||||
</p>
|
||||
<p class="w-full text-[#5c5c5c] line-clamp-2 overflow-hidden">
|
||||
|
@ -42,7 +42,7 @@ import type Lookup from "../../types/collection/lookup";
|
|||
const runtimeConfig = useRuntimeConfig();
|
||||
const baseUrl = runtimeConfig.public.strapi.url;
|
||||
|
||||
const { logo } = await provideGlobal();
|
||||
const { logo } = useGlobal();
|
||||
|
||||
const props = defineProps({
|
||||
data: Object as PropType<BaseCollection>,
|
||||
|
|
|
@ -25,7 +25,7 @@ import type SharedEmphasiseArticle from "../../types/component/shared/emphasiseA
|
|||
import type Lookup from "../../types/collection/lookup";
|
||||
|
||||
const { find } = useStrapi();
|
||||
const { data: lookup } = await useAsyncData("lookup", () =>
|
||||
const { data: lookup } = await useAsyncData(() =>
|
||||
find<Lookup>("collection-lookups", {
|
||||
filters: {
|
||||
collection: "articles",
|
||||
|
|
|
@ -113,13 +113,13 @@ const pagination = ref<Meta>({ page: 0, pageSize: 0, pageCount: 0, total: 0 });
|
|||
const activeYear = ref<number>(0);
|
||||
|
||||
if (props.data?.lookup.list_with_date != "none") {
|
||||
const { data: year } = await useAsyncData<Array<number>>("distinct-years", () =>
|
||||
const { data: year } = await useAsyncData<Array<number>>(() =>
|
||||
$fetch(`${baseUrl}/api/custom/${props.data?.lookup.collection}/distinct-years`)
|
||||
);
|
||||
years.value = year.value ?? [];
|
||||
activeYear.value = years.value[0] ?? 0;
|
||||
}
|
||||
const { data: collections } = await useAsyncData("collection", () =>
|
||||
const { data: collections } = await useAsyncData(() =>
|
||||
find<BaseCollection>(props.data?.lookup.collection ?? "", {
|
||||
...(props.data?.lookup?.list_with_date != "none"
|
||||
? {
|
||||
|
@ -235,7 +235,7 @@ async function changeTimedData(year: number) {
|
|||
withCount: true,
|
||||
},
|
||||
});
|
||||
console.log(data);
|
||||
|
||||
collection.value = data?.data;
|
||||
pagination.value = (data?.meta.pagination as unknown as {
|
||||
page: number;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue