docs(app): improve module and framework reactivity

This commit is contained in:
Benjamin Canac
2025-01-17 00:01:06 +01:00
parent 3159a89436
commit a3a562b699
3 changed files with 20 additions and 2 deletions

View File

@@ -6,6 +6,10 @@ const value = ref<string | undefined>(undefined)
onMounted(() => {
value.value = framework.value
})
watch(framework, () => {
value.value = framework.value
})
</script>
<template>

View File

@@ -9,6 +9,16 @@ const props = defineProps<{
const config = useRuntimeConfig().public
const { module } = useSharedData()
const value = ref<string | undefined>(module.value)
watch(module, () => {
value.value = module.value
})
onMounted(() => {
value.value = module.value
})
const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
const items = computed(() => props.links.map(({ icon, ...link }) => link))
@@ -52,11 +62,11 @@ const items = computed(() => props.links.map(({ icon, ...link }) => link))
<UContentSearchButton />
</UTooltip>
<UTooltip text="Open on GitHub" :kbds="['meta', 'G']" class="hidden lg:flex">
<UTooltip text="Open on GitHub" class="hidden lg:flex">
<UButton
color="neutral"
variant="ghost"
:to="`https://github.com/nuxt/${module}`"
:to="`https://github.com/nuxt/${value}`"
target="_blank"
icon="i-simple-icons-github"
aria-label="GitHub"

View File

@@ -6,6 +6,10 @@ const value = ref<string | undefined>(undefined)
onMounted(() => {
value.value = module.value
})
watch(module, () => {
value.value = module.value
})
</script>
<template>