更新 wiki
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
# 侧边栏Logo组件
|
||||
|
||||
<cite>
|
||||
**本文档引用的文件**
|
||||
- [SidebarLogo.vue](file://frontend/src/components/SidebarLogo.vue)
|
||||
- [index.vue](file://frontend/src/layout/index.vue)
|
||||
- [lux-theme.css](file://frontend/src/styles/lux-theme.css)
|
||||
- [main.js](file://frontend/src/main.js)
|
||||
- [App.vue](file://frontend/src/App.vue)
|
||||
**本文引用的文件**
|
||||
- [system-logo.vue](file://frontend/src/components/common/system-logo.vue)
|
||||
- [index.vue](file://frontend/src/layouts/modules/global-sider/index.vue)
|
||||
- [global-logo/index.vue](file://frontend/src/layouts/modules/global-logo/index.vue)
|
||||
</cite>
|
||||
|
||||
## 更新摘要
|
||||
**变更内容**
|
||||
- 移除了旧的SidebarLogo.vue组件,替换为新的system-logo组件
|
||||
- 更新了组件架构和实现方式
|
||||
- 调整了组件在Soybean Admin迁移中的集成方式
|
||||
- 优化了SVG图形渲染和响应式布局
|
||||
|
||||
## 目录
|
||||
1. [简介](#简介)
|
||||
2. [项目结构](#项目结构)
|
||||
@@ -24,6 +29,8 @@
|
||||
|
||||
侧边栏Logo组件是Dashboard管理系统中的重要视觉标识组件,负责展示品牌标识和公司名称。该组件采用现代化的SVG图形设计,结合渐变色彩、阴影效果和流畅的动画过渡,为用户提供一致的品牌体验。
|
||||
|
||||
**已更新** 组件已从旧的SidebarLogo.vue重构为新的system-logo组件,作为Soybean Admin迁移的一部分,提供了更好的模块化和可维护性。
|
||||
|
||||
组件的核心特性包括:
|
||||
- 响应式布局适配,支持展开和折叠两种状态
|
||||
- 基于SVG的矢量图形设计,确保清晰度和可缩放性
|
||||
@@ -33,42 +40,39 @@
|
||||
|
||||
## 项目结构
|
||||
|
||||
侧边栏Logo组件位于前端项目的组件目录中,与布局系统紧密集成:
|
||||
侧边栏Logo组件现已迁移至新的位置,位于通用组件目录下,与Soybean Admin布局系统紧密集成:
|
||||
|
||||
```mermaid
|
||||
graph TB
|
||||
subgraph "前端项目结构"
|
||||
A[frontend/] --> B[src/]
|
||||
B --> C[components/]
|
||||
B --> D[layout/]
|
||||
B --> E[styles/]
|
||||
C --> F[SidebarLogo.vue]
|
||||
D --> G[index.vue]
|
||||
E --> H[lux-theme.css]
|
||||
I[main.js] --> J[App.vue]
|
||||
J --> K[router-view]
|
||||
K --> L[layout/index.vue]
|
||||
L --> M[SidebarLogo.vue]
|
||||
B --> D[layouts/]
|
||||
C --> E[common/]
|
||||
C --> F[custom/]
|
||||
D --> G[modules/]
|
||||
E --> H[system-logo.vue]
|
||||
G --> I[global-sider/]
|
||||
G --> J[global-logo/]
|
||||
I --> K[index.vue]
|
||||
J --> L[index.vue]
|
||||
end
|
||||
```
|
||||
|
||||
**图表来源**
|
||||
- [SidebarLogo.vue:1-135](file://frontend/src/components/SidebarLogo.vue#L1-L135)
|
||||
- [index.vue:1-338](file://frontend/src/layout/index.vue#L1-L338)
|
||||
|
||||
**章节来源**
|
||||
- [SidebarLogo.vue:1-135](file://frontend/src/components/SidebarLogo.vue#L1-L135)
|
||||
- [index.vue:1-338](file://frontend/src/layout/index.vue#L1-L338)
|
||||
- [system-logo.vue](file://frontend/src/components/common/system-logo.vue)
|
||||
- [index.vue](file://frontend/src/layouts/modules/global-sider/index.vue)
|
||||
- [global-logo/index.vue](file://frontend/src/layouts/modules/global-logo/index.vue)
|
||||
|
||||
## 核心组件
|
||||
|
||||
### 组件架构设计
|
||||
### 新组件架构设计
|
||||
|
||||
SidebarLogo组件采用Vue 3 Composition API设计,通过props接收collapsed状态,实现响应式布局切换:
|
||||
system-logo组件采用Vue 3 Composition API设计,通过props接收collapsed状态,实现响应式布局切换:
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class SidebarLogo {
|
||||
class SystemLogo {
|
||||
+Boolean collapsed
|
||||
+String name
|
||||
+String tag
|
||||
@@ -90,14 +94,10 @@ class LayoutSystem {
|
||||
+handleMouseEvents() void
|
||||
+toggleSidebar() void
|
||||
}
|
||||
SidebarLogo --> SVGGraphics : "uses"
|
||||
LayoutSystem --> SidebarLogo : "controls"
|
||||
SystemLogo --> SVGGraphics : "uses"
|
||||
LayoutSystem --> SystemLogo : "controls"
|
||||
```
|
||||
|
||||
**图表来源**
|
||||
- [SidebarLogo.vue:52-59](file://frontend/src/components/SidebarLogo.vue#L52-L59)
|
||||
- [index.vue:158-158](file://frontend/src/layout/index.vue#L158-L158)
|
||||
|
||||
### 属性系统
|
||||
|
||||
组件通过collapsed属性控制布局状态:
|
||||
@@ -106,9 +106,6 @@ LayoutSystem --> SidebarLogo : "controls"
|
||||
|--------|------|--------|------|
|
||||
| collapsed | Boolean | false | 控制侧边栏折叠状态 |
|
||||
|
||||
**章节来源**
|
||||
- [SidebarLogo.vue:52-59](file://frontend/src/components/SidebarLogo.vue#L52-L59)
|
||||
|
||||
## 架构概览
|
||||
|
||||
### 整体系统架构
|
||||
@@ -122,7 +119,7 @@ end
|
||||
subgraph "布局系统"
|
||||
C --> D[Sidebar Container]
|
||||
C --> E[Main Content]
|
||||
D --> F[Sidebar Logo]
|
||||
D --> F[System Logo]
|
||||
D --> G[Navigation Rail]
|
||||
D --> H[Menu System]
|
||||
end
|
||||
@@ -132,9 +129,8 @@ F --> J[Text Elements]
|
||||
F --> K[Animation System]
|
||||
end
|
||||
subgraph "样式系统"
|
||||
L[Lux Theme CSS] --> M[Global Styles]
|
||||
M --> N[Component Specific Styles]
|
||||
N --> O[Responsive Breakpoints]
|
||||
L[Global Styles] --> M[Component Specific Styles]
|
||||
M --> N[Responsive Breakpoints]
|
||||
end
|
||||
subgraph "交互系统"
|
||||
P[Mouse Events] --> Q[State Management]
|
||||
@@ -145,17 +141,13 @@ F -.-> L
|
||||
C -.-> P
|
||||
```
|
||||
|
||||
**图表来源**
|
||||
- [index.vue:1-338](file://frontend/src/layout/index.vue#L1-L338)
|
||||
- [lux-theme.css:1-471](file://frontend/src/styles/lux-theme.css#L1-L471)
|
||||
|
||||
### 数据流架构
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant User as 用户
|
||||
participant Layout as 布局组件
|
||||
participant Logo as Logo组件
|
||||
participant Logo as SystemLogo组件
|
||||
participant State as 状态管理
|
||||
participant Style as 样式系统
|
||||
User->>Layout : 鼠标悬停/离开
|
||||
@@ -167,10 +159,6 @@ Logo-->>User : 显示更新后的界面
|
||||
Note over Layout,Logo : 展开/折叠状态切换
|
||||
```
|
||||
|
||||
**图表来源**
|
||||
- [index.vue:13-14](file://frontend/src/layout/index.vue#L13-L14)
|
||||
- [index.vue:18-18](file://frontend/src/layout/index.vue#L18-L18)
|
||||
|
||||
## 详细组件分析
|
||||
|
||||
### SVG图形设计实现
|
||||
@@ -198,9 +186,6 @@ L --> O[颜色: #38bdf8]
|
||||
L --> P[透明度: 0.35]
|
||||
```
|
||||
|
||||
**图表来源**
|
||||
- [SidebarLogo.vue:6-17](file://frontend/src/components/SidebarLogo.vue#L6-L17)
|
||||
|
||||
#### 图形元素构成
|
||||
|
||||
SVG图形由多个几何元素组成,形成独特的品牌标识:
|
||||
@@ -212,9 +197,6 @@ SVG图形由多个几何元素组成,形成独特的品牌标识:
|
||||
| 竖条元素 | 3 | 3.2×13/15.5/11 | 渐变填充,圆角1.6px |
|
||||
| 曲线元素 | 1 | 自定义路径 | 渐变描边,圆角端点 |
|
||||
|
||||
**章节来源**
|
||||
- [SidebarLogo.vue:4-42](file://frontend/src/components/SidebarLogo.vue#L4-L42)
|
||||
|
||||
### 动画过渡机制
|
||||
|
||||
#### 折叠状态动画
|
||||
@@ -235,9 +217,6 @@ stateDiagram-v2
|
||||
折叠状态 : 居中对齐
|
||||
```
|
||||
|
||||
**图表来源**
|
||||
- [SidebarLogo.vue:120-133](file://frontend/src/components/SidebarLogo.vue#L120-L133)
|
||||
|
||||
#### 过渡效果配置
|
||||
|
||||
| 动画属性 | 持续时间 | 缓动函数 | 影响元素 |
|
||||
@@ -247,10 +226,6 @@ stateDiagram-v2
|
||||
| 宽度变化 | 0.3秒 | ease | 整个Logo容器 |
|
||||
| 阴影变化 | 0.3秒 | ease | 侧边栏容器 |
|
||||
|
||||
**章节来源**
|
||||
- [SidebarLogo.vue:89-89](file://frontend/src/components/SidebarLogo.vue#L89-L89)
|
||||
- [lux-theme.css:117-117](file://frontend/src/styles/lux-theme.css#L117-L117)
|
||||
|
||||
### CSS样式体系
|
||||
|
||||
#### Flex布局系统
|
||||
@@ -259,21 +234,18 @@ stateDiagram-v2
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
A[sidebar-brand容器] --> B[flex布局]
|
||||
A[sider-brand容器] --> B[flex布局]
|
||||
B --> C[align-items: center]
|
||||
B --> D[gap: 10px]
|
||||
B --> E[min-width: 0]
|
||||
F[sidebar-brand-mark] --> G[固定尺寸36×36]
|
||||
F[sider-brand-mark] --> G[固定尺寸36×36]
|
||||
F --> H[flex-shrink: 0]
|
||||
I[sidebar-brand-wordmark] --> J[column布局]
|
||||
I[sider-brand-wordmark] --> J[column布局]
|
||||
I --> K[align-items: flex-start]
|
||||
I --> L[gap: 2px]
|
||||
I --> M[transition: opacity/transform]
|
||||
```
|
||||
|
||||
**图表来源**
|
||||
- [SidebarLogo.vue:62-89](file://frontend/src/components/SidebarLogo.vue#L62-L89)
|
||||
|
||||
#### 字体和文本样式
|
||||
|
||||
| 文本元素 | 字体族 | 字号 | 字重 | 字母间距 |
|
||||
@@ -281,9 +253,6 @@ I --> M[transition: opacity/transform]
|
||||
| 品牌名称 | Outfit, sans-serif | 17px | 700 | 0.14em |
|
||||
| 标记标签 | Outfit, sans-serif | 10px | 600 | 0.22em |
|
||||
|
||||
**章节来源**
|
||||
- [SidebarLogo.vue:92-118](file://frontend/src/components/SidebarLogo.vue#L92-L118)
|
||||
|
||||
### 响应式布局适配
|
||||
|
||||
#### 断点设计
|
||||
@@ -303,9 +272,6 @@ D --> I[最小Logo显示]
|
||||
D --> J[64px侧边栏宽度]
|
||||
```
|
||||
|
||||
**图表来源**
|
||||
- [lux-theme.css:101-130](file://frontend/src/styles/lux-theme.css#L101-L130)
|
||||
|
||||
#### 状态切换逻辑
|
||||
|
||||
```mermaid
|
||||
@@ -321,19 +287,13 @@ G --> I[文字标记可见]
|
||||
H --> J[文字标记隐藏]
|
||||
```
|
||||
|
||||
**图表来源**
|
||||
- [index.vue:13-14](file://frontend/src/layout/index.vue#L13-L14)
|
||||
|
||||
**章节来源**
|
||||
- [index.vue:158-158](file://frontend/src/layout/index.vue#L158-L158)
|
||||
|
||||
## 依赖关系分析
|
||||
|
||||
### 组件间依赖
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
A[Layout Component] --> B[SidebarLogo Component]
|
||||
A[Layout Component] --> B[SystemLogo Component]
|
||||
A --> C[Navigation Rail]
|
||||
A --> D[Menu System]
|
||||
B --> E[SVG Graphics]
|
||||
@@ -348,10 +308,6 @@ M --> O[Component Re-render]
|
||||
O --> P[Style Application]
|
||||
```
|
||||
|
||||
**图表来源**
|
||||
- [index.vue:151-151](file://frontend/src/layout/index.vue#L151-L151)
|
||||
- [lux-theme.css:1-25](file://frontend/src/styles/lux-theme.css#L1-L25)
|
||||
|
||||
### 外部依赖
|
||||
|
||||
组件依赖以下外部库和资源:
|
||||
@@ -363,9 +319,6 @@ O --> P[Style Application]
|
||||
| CSS变量 | 浏览器原生 | 主题定制 |
|
||||
| SVG渐变 | 浏览器原生 | 图形渲染 |
|
||||
|
||||
**章节来源**
|
||||
- [main.js:1-9](file://frontend/src/main.js#L1-L9)
|
||||
|
||||
## 性能考虑
|
||||
|
||||
### SVG渲染优化
|
||||
@@ -439,9 +392,6 @@ D --> M[内存泄漏预防]
|
||||
- 确保品牌名称作为文本内容存在
|
||||
- 提供适当的标题属性
|
||||
|
||||
**章节来源**
|
||||
- [SidebarLogo.vue:3-3](file://frontend/src/components/SidebarLogo.vue#L3-L3)
|
||||
|
||||
## 结论
|
||||
|
||||
侧边栏Logo组件展现了现代前端开发的最佳实践,通过精心设计的SVG图形、优雅的动画过渡和完善的响应式布局,为用户提供了优秀的视觉体验。
|
||||
@@ -460,4 +410,4 @@ D --> M[内存泄漏预防]
|
||||
3. **国际化**:支持多语言品牌名称
|
||||
4. **可访问性**:增强屏幕阅读器支持
|
||||
|
||||
该组件为整个Dashboard系统的视觉统一奠定了坚实基础,是现代前端开发的优秀范例。
|
||||
该组件为整个Dashboard系统的视觉统一奠定了坚实基础,是现代前端开发的优秀范例。随着向Soybean Admin的迁移,组件获得了更好的架构设计和更清晰的职责分离。
|
||||
Reference in New Issue
Block a user