| 1 | <template> |
| 2 | <div class="bg-body rounded-lg py-0.5" :class="{ collapsed }"> |
| 3 | <n-menu :options="menuOptions" :collapsed :collapsed-width :indent="18" /> |
| 4 | </div> |
| 5 | </template> |
| 6 | |
| 7 | <script lang="ts" setup> |
| 8 | import { NMenu } from "naive-ui" |
| 9 | import { computed, h, ref } from "vue" |
| 10 | import { useThemeStore } from "@/stores/theme" |
| 11 | import { renderIcon } from "@/utils" |
| 12 | |
| 13 | const { collapsed = false } = defineProps<{ |
| 14 | collapsed?: boolean |
| 15 | }>() |
| 16 | |
| 17 | const BuyIcon = "carbon:shopping-cart" |
| 18 | const DocsIcon = "ion:book-outline" |
| 19 | const menuOptions = ref([ |
| 20 | { |
| 21 | label: () => |
| 22 | h( |
| 23 | "a", |
| 24 | { |
| 25 | href: "https://pinx-docs.vercel.app/", |
| 26 | target: "_blank", |
| 27 | rel: "noopenner noreferrer" |
| 28 | }, |
| 29 | "Documentation" |
| 30 | ), |
| 31 | key: "documentation", |
| 32 | icon: renderIcon(DocsIcon) |
| 33 | }, |
| 34 | { |
| 35 | label: () => |
| 36 | h( |
| 37 | "a", |
| 38 | { |
| 39 | href: "https://themeforest.net/item/pinx-vuejs-admin-template/47799543", |
| 40 | target: "_blank", |
| 41 | rel: "noopenner noreferrer" |
| 42 | }, |
| 43 | "Buy now" |
| 44 | ), |
| 45 | key: "buy-now", |
| 46 | icon: renderIcon(BuyIcon) |
| 47 | } |
| 48 | ]) |
| 49 | |
| 50 | const themeStore = useThemeStore() |
| 51 | const collapsedWidth = computed<number>(() => themeStore.sidebar.closeWidth - 16) |
| 52 | </script> |