ref: use slots to prevent repeating menu

This commit is contained in:
Ruidy 2024-12-16 21:33:55 +01:00
parent 7c4f6419cd
commit 55d857e658
No known key found for this signature in database
GPG key ID: E00F51288CB857CC
2 changed files with 7 additions and 3 deletions

View file

@ -1,6 +1,10 @@
<template>
<div data-theme="cupcake" class="flex flex-col h-screen">
<app-navbar />
<app-navbar>
<template #menu>
<li><nuxt-link to="/categories">Categories</nuxt-link></li>
</template>
</app-navbar>
<main class="flex-grow">
<nuxt-page />
</main>

View file

@ -67,7 +67,7 @@ if (route.path === "/search") {
tabindex="0"
class="menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-200 rounded-box w-52"
>
<li><nuxt-link to="/categories">Categories</nuxt-link></li>
<slot name="menu" />
</ul>
</div>
<nuxt-link to="/" class="btn btn-ghost text-xl">
@ -77,7 +77,7 @@ if (route.path === "/search") {
</div>
<div class="navbar-center hidden lg:flex">
<ul class="menu menu-horizontal px-1">
<li><nuxt-link to="/categories">Categories</nuxt-link></li>
<slot name="menu" />
</ul>
</div>
<div class="navbar-end gap-2">