El DashboardPanel
xph0000xUso
Su estado (tamaño, colapsado, etc.) se guardará en función de los elementos de apoyo storage y storage-key que proporcione al componente DashboardGroup.
Usarlo dentro de la ranura predeterminada del componente DashboardGroup, puede poner varios paneles uno al lado del otro:
<script setup lang="ts">
definePageMeta({
layout: 'dashboard'
})
</script>
<template>
<UDashboardPanel id="inbox-1" resizable />
<UDashboardPanel id="inbox-2" class="hidden lg:flex" />
</template>
id cuando se utilizan varios paneles en diferentes páginas para evitar conflictos.resizable, así que envuélvalo en un contenedor (por ejemplo, <div class="flex flex-1">) si usa transiciones de página o requiere una sola raíz para el diseño.Utiliza las ranuras header, body y footer para personalizar el panel o la ranura predeterminada si no quieres un cuerpo desplazable con relleno.
Inbox
<template>
<UDashboardPanel resizable>
<template #header>
<UDashboardNavbar title="Inbox">
<template #leading>
<UDashboardSidebarCollapse />
</template>
</UDashboardNavbar>
</template>
<template #body>
<Placeholder class="h-full" />
</template>
</UDashboardPanel>
</template>
DashboardNavbar en la ranura header.redimensionable
Utilice el soporte resizable para hacer que el panel sea redimensionable.
<template>
<UDashboardPanel resizable>
<template #body>
<Placeholder class="h-96" />
</template>
</UDashboardPanel>
</template>Tamaño
Utilice los accesorios min-size, max-size y default-size para personalizar el tamaño del panel.
<template>
<UDashboardPanel resizable :min-size="22" :default-size="35" :max-size="40">
<template #body>
<Placeholder class="h-96" />
</template>
</UDashboardPanel>
</template>unit en el componente DashboardGroup.API (Edición española)
Accesorios
| Prop | Default | Type |
|---|---|---|
id | useId() | stringThe id of the panel. |
minSize | 15 | numberThe minimum size of the panel. |
maxSize | 100 | numberThe maximum size of the panel. |
defaultSize | 0 | numberThe default size of the panel. |
resizable | false | boolean Whether to allow the user to resize the panel. |
ui | { root?: SlotClass; body?: SlotClass; handle?: SlotClass; } |
Slots (Español)
| Slot | Type |
|---|---|
default | {} |
header | {} |
body | {} |
footer | {} |
resize-handle | { onMouseDown: (e: MouseEvent) => void; onTouchStart: (e: TouchEvent) => void; onDoubleClick: (e: MouseEvent) => void; } |
Temas
export default defineAppConfig({
ui: {
dashboardPanel: {
slots: {
root: 'relative flex flex-col min-w-0 min-h-svh lg:not-last:border-e lg:not-last:border-default shrink-0',
body: 'flex flex-col gap-4 sm:gap-6 flex-1 overflow-y-auto p-4 sm:p-6',
handle: ''
},
variants: {
size: {
true: {
root: 'w-full lg:w-(--width)'
},
false: {
root: 'flex-1'
}
}
}
}
}
})import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'
export default defineConfig({
plugins: [
vue(),
ui({
ui: {
dashboardPanel: {
slots: {
root: 'relative flex flex-col min-w-0 min-h-svh lg:not-last:border-e lg:not-last:border-default shrink-0',
body: 'flex flex-col gap-4 sm:gap-6 flex-1 overflow-y-auto p-4 sm:p-6',
handle: ''
},
variants: {
size: {
true: {
root: 'w-full lg:w-(--width)'
},
false: {
root: 'flex-1'
}
}
}
}
}
})
]
})xph05xChangelog (Edición española)