初始化
缺陷:主题配色需要优化整体的同风格
This commit is contained in:
@@ -232,6 +232,8 @@ interface LogoPreferences {
|
||||
fullLogoHeight?: number | string;
|
||||
/** logo 展示类型,icon 图标模式, full 铺满logo区域 */
|
||||
logoMode: 'full' | 'icon';
|
||||
/** icon 模式下的方形标尺寸(px),默认 32;业务应用可覆盖 */
|
||||
size?: number;
|
||||
/** logo text是否展示 */
|
||||
showText: boolean;
|
||||
/** logo地址 */
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { VbenAvatar } from '../avatar';
|
||||
|
||||
interface Props {
|
||||
/**
|
||||
* @zh_CN 是否收起文本;布局状态,侧边栏收起时隐藏文字。
|
||||
@@ -65,7 +63,7 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
src: '',
|
||||
srcDark: '',
|
||||
theme: 'light',
|
||||
fit: 'cover',
|
||||
fit: 'contain',
|
||||
showText: true,
|
||||
});
|
||||
|
||||
@@ -110,6 +108,13 @@ const fullLogoStyle = computed(() => ({
|
||||
: props.fullLogoHeight,
|
||||
objectFit: props.fit,
|
||||
}));
|
||||
|
||||
/** icon 模式:固定方形,contain 避免线框 SVG 被 cover 裁切 */
|
||||
const iconLogoStyle = computed(() => ({
|
||||
height: `${props.logoSize}px`,
|
||||
width: `${props.logoSize}px`,
|
||||
objectFit: props.fit,
|
||||
}));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -132,13 +137,18 @@ const fullLogoStyle = computed(() => ({
|
||||
class="w-full"
|
||||
/>
|
||||
|
||||
<VbenAvatar
|
||||
<!--
|
||||
品牌标必须用 img,不能用 VbenAvatar:
|
||||
Avatar 加载失败会把 alt 末两字当回退(「佛山铂尔曼」→「尔曼」),
|
||||
且默认圆形裁切,不适合方形线框 SVG。
|
||||
-->
|
||||
<img
|
||||
v-else-if="logoSrc"
|
||||
:alt="text"
|
||||
alt=""
|
||||
:src="logoSrc"
|
||||
:size="logoSize"
|
||||
:fit="fit"
|
||||
class="relative rounded-none bg-transparent"
|
||||
:style="iconLogoStyle"
|
||||
class="relative shrink-0 bg-transparent"
|
||||
draggable="false"
|
||||
/>
|
||||
<template v-if="shouldShowText">
|
||||
<slot name="text">
|
||||
|
||||
@@ -328,6 +328,7 @@ const headerSlots = computed(() => {
|
||||
:text="preferences.app.name"
|
||||
:show-text="preferences.logo.showText"
|
||||
:logo-mode="preferences.logo.logoMode"
|
||||
:logo-size="preferences.logo.size ?? 32"
|
||||
:full-logo-height="preferences.logo.fullLogoHeight"
|
||||
:theme="logoTheme"
|
||||
@click="clickLogo"
|
||||
|
||||
Reference in New Issue
Block a user