mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
docs: add version select (#532)
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
<script setup lang="ts">
|
||||
import type { NuxtError } from '#app'
|
||||
|
||||
const { prefix, removePrefixFromNavigation, removePrefixFromFiles } = useContentSource()
|
||||
|
||||
useSeoMeta({
|
||||
title: 'Page not found',
|
||||
description: 'We are sorry but this page could not be found.'
|
||||
@@ -30,14 +32,26 @@ defineProps<{
|
||||
error: NuxtError
|
||||
}>()
|
||||
|
||||
const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation(), {
|
||||
default: () => []
|
||||
const { data: navigation } = await useLazyAsyncData('navigation', () => fetchContentNavigation(), {
|
||||
default: () => [],
|
||||
transform: (navigation) => {
|
||||
navigation = navigation.find(link => link._path === prefix.value)?.children || []
|
||||
|
||||
return prefix.value === '/main' ? removePrefixFromNavigation(navigation) : navigation
|
||||
}
|
||||
})
|
||||
|
||||
const { data: files } = await useLazyAsyncData('files', () => queryContent().where({ _type: 'markdown', navigation: { $ne: false } }).find(), {
|
||||
default: () => []
|
||||
default: () => [],
|
||||
transform: (files) => {
|
||||
files = files.filter(file => file._path.startsWith(prefix.value))
|
||||
|
||||
return prefix.value === '/main' ? removePrefixFromFiles(files) : files
|
||||
}
|
||||
})
|
||||
|
||||
// Provide
|
||||
|
||||
provide('navigation', navigation)
|
||||
provide('files', files)
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user