69 lines
1.6 KiB
Vue
69 lines
1.6 KiB
Vue
<script lang="ts" setup>
|
|
import type { LucideIcon } from "lucide-vue-next";
|
|
import type { SidebarProps } from "../ui/sidebar";
|
|
import type { RouteLocationRaw } from "vue-router";
|
|
|
|
export interface SidebarNavItem {
|
|
title: string;
|
|
url?: string | RouteLocationRaw;
|
|
icon: LucideIcon | string;
|
|
isActive?: boolean;
|
|
items?: {
|
|
title: string;
|
|
url: string;
|
|
}[];
|
|
}
|
|
|
|
export interface SidebarNavGroup {
|
|
label?: string;
|
|
items: SidebarNavItem[];
|
|
}
|
|
|
|
const props = withDefaults(
|
|
defineProps<
|
|
SidebarProps & {
|
|
nav: SidebarNavGroup[];
|
|
}
|
|
>(),
|
|
{
|
|
collapsible: "offcanvas",
|
|
variant: "sidebar",
|
|
}
|
|
);
|
|
|
|
const data = {
|
|
user: {
|
|
name: "Timothy Yin",
|
|
email: "master@uniiem.com",
|
|
avatar: "https://bh8.ga/avatar.jpg",
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<Sidebar v-bind="props">
|
|
<SidebarHeader>
|
|
<div
|
|
class="flex h-12 justify-center items-center gap-2 rounded truncate group-has-[[data-collapsible=icon]]/sidebar-wrapper:justify-start transition-all duration-200 ease-in-out"
|
|
>
|
|
<NuxtImg
|
|
src="/images/xsh_logo.png"
|
|
alt="Logo"
|
|
class="w-9 max-w-9 aspect-square group-has-[[data-collapsible=icon]]/sidebar-wrapper:w-full transition-all duration-200 ease-in-out"
|
|
/>
|
|
<h1 class="text-lg font-medium">智课教学平台</h1>
|
|
</div>
|
|
</SidebarHeader>
|
|
<SidebarContent>
|
|
<slot name="extra-header" />
|
|
<AppNavMain :nav="nav" />
|
|
</SidebarContent>
|
|
<SidebarFooter>
|
|
<AppNavUser :user="data.user" />
|
|
</SidebarFooter>
|
|
<SidebarRail />
|
|
</Sidebar>
|
|
</template>
|
|
|
|
<style scoped></style>
|