fix nuxt ui 参数传递错误

This commit is contained in:
2025-07-26 00:02:37 +08:00
parent e6e27c8ccf
commit 9264107b3c
2 changed files with 5 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
<template> <template>
<aside <div
class="w-64 bg-white dark:bg-gray-900 flex flex-col h-screen border-r border-gray-200 dark:border-gray-700 overflow-hidden"> class="w-64 bg-white dark:bg-gray-900 flex flex-col h-screen border-r border-gray-200 dark:border-gray-700 overflow-hidden">
<!-- Logo --> <!-- Logo -->
<div class="flex-shrink-0 p-4 border-gray-200 dark:border-gray-700"> <div class="flex-shrink-0 p-4 border-gray-200 dark:border-gray-700">
@@ -18,7 +18,7 @@
<!-- Search Box --> <!-- Search Box -->
<div class="p-4 border-gray-200 dark:border-gray-700"> <div class="p-4 border-gray-200 dark:border-gray-700">
<ClientOnly> <ClientOnly>
<UContentSearchButton :collapsed="false" loading="true" label="搜索文档" description="请输入关键词" class="w-full" <UContentSearchButton :collapsed="false" label="搜索文档" class="w-full"
color="primary" /> color="primary" />
</ClientOnly> </ClientOnly>
</div> </div>
@@ -50,8 +50,6 @@
<!-- 文档目录导航 --> <!-- 文档目录导航 -->
<div class="mt-6 flex items-center justify-start pl-8 w-4/5"> <div class="mt-6 flex items-center justify-start pl-8 w-4/5">
<NuxtLink>
<UContentNavigation highlight :navigation="navigation" color="primary" type="single" variant="pill" :ui="{ <UContentNavigation highlight :navigation="navigation" color="primary" type="single" variant="pill" :ui="{
root: '', root: '',
content: '', content: '',
@@ -69,12 +67,9 @@
linkTitle: '', linkTitle: '',
linkTitleExternalIcon: 'size- align-top text-dimmed' linkTitleExternalIcon: 'size- align-top text-dimmed'
}" /> }" />
</NuxtLink>
</div> </div>
</div> </div>
</aside> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">

View File

@@ -23,11 +23,11 @@
/> />
<!-- Main Content --> <!-- Main Content -->
<main class="flex-1 overflow-y-auto pt-16"> <UMain class="flex-1 overflow-y-auto">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6"> <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
<slot /> <slot />
</div> </div>
</main> </UMain>
<!-- Footer --> <!-- Footer -->
<AppFooter /> <AppFooter />
@@ -47,16 +47,5 @@ const toggleSidebar = () => {
isSidebarOpen.value = !isSidebarOpen.value isSidebarOpen.value = !isSidebarOpen.value
} }
// 监听路由变化,在移动端自动关闭侧边栏
const route = useRoute()
const stopWatch = watch(() => route.path, () => {
if (isSidebarOpen.value) {
isSidebarOpen.value = false
}
})
// 组件卸载时清理监听器
onUnmounted(() => {
stopWatch()
})
</script> </script>