fbc2e5ac91
- 创建utils/config.ts集中管理API_BASE和文件URL - 删除.env文件(VITE_SERVER_API_URL=http://localhost:8080) - env.ts默认API前缀改为/api/v1匹配后端路由 - 替换16处硬编码的localhost:8080引用
37 lines
1.3 KiB
Vue
37 lines
1.3 KiB
Vue
<script lang="ts" setup>
|
|
import { ref } from 'vue'
|
|
|
|
import type { Team } from './types'
|
|
|
|
import { getFileUrl } from '@/utils/config'
|
|
|
|
const { teams } = defineProps<{
|
|
teams: Team[]
|
|
}>()
|
|
|
|
const activeTeam = ref<Team>(teams[0])
|
|
|
|
function getAssetUrl(path: string) {
|
|
return getFileUrl(path)
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<UiSidebarMenu>
|
|
<UiSidebarMenuItem>
|
|
<UiSidebarMenuButton size="lg" class="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground">
|
|
<div
|
|
class="flex items-center justify-center rounded-lg aspect-square size-8 overflow-hidden shrink-0"
|
|
:class="typeof activeTeam.logo === 'string' && activeTeam.logo ? '' : 'bg-sidebar-primary text-sidebar-primary-foreground'"
|
|
>
|
|
<img v-if="typeof activeTeam.logo === 'string' && activeTeam.logo" :src="getAssetUrl(activeTeam.logo)" class="size-full object-contain" alt="" />
|
|
<component v-else-if="typeof activeTeam.logo === 'function'" :is="activeTeam.logo" class="size-4" />
|
|
</div>
|
|
<div class="grid flex-1 text-sm leading-tight group-data-[collapsible=icon]:hidden">
|
|
<span class="font-semibold truncate">{{ activeTeam.name }}</span>
|
|
</div>
|
|
</UiSidebarMenuButton>
|
|
</UiSidebarMenuItem>
|
|
</UiSidebarMenu>
|
|
</template>
|