From e123b0eefed8a3d84f45660f709c8e0f942cf8ab Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Tue, 26 Aug 2025 17:14:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=81=E8=A3=85=E9=80=9A=E7=94=A8=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E6=A0=8F=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/custom-nav-bar/README.md | 118 +++++++++++++++++++ components/custom-nav-bar/custom-nav-bar.vue | 9 +- pages/agents/requestAgent.vue | 2 +- pages/cashFlow/cashFlow.vue | 9 +- pages/index/index.vue | 6 +- pages/lease/lease.vue | 7 +- 6 files changed, 143 insertions(+), 8 deletions(-) create mode 100644 components/custom-nav-bar/README.md diff --git a/components/custom-nav-bar/README.md b/components/custom-nav-bar/README.md new file mode 100644 index 0000000..e6eac4c --- /dev/null +++ b/components/custom-nav-bar/README.md @@ -0,0 +1,118 @@ +# Custom Nav Bar 通用导航栏组件 + +这是一个融合了多个导航栏版本的通用组件,支持多种配置选项。 + +## 功能特性 + +- ✅ 可配置背景颜色 +- ✅ 可配置标题颜色 +- ✅ 可选的返回按钮 +- ✅ 可选的搜索按钮 +- ✅ 可配置标题对齐方式 +- ✅ 支持自定义事件处理 +- ✅ 响应式设计,适配不同设备 + +## 使用方法 + +### 基础用法 + +```vue + +``` + +### 带返回按钮的导航栏 + +```vue + +``` + +### 带搜索按钮的导航栏 + +```vue + +``` + +### 完整配置示例 + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| title | String | '标题' | 导航栏标题 | +| backgroundColor | String | '#ffddca' | 背景颜色 | +| titleColor | String | '#3d3d3d' | 标题颜色 | +| iconColor | String | '#888' | 图标颜色 | +| showBack | Boolean | false | 是否显示返回按钮 | +| showSearch | Boolean | false | 是否显示搜索按钮 | +| titleAlign | String | 'center' | 标题对齐方式 ('left', 'center', 'right') | +| onBack | Function | null | 返回按钮点击回调函数 | +| onSearch | Function | null | 搜索按钮点击回调函数 | + +## 事件说明 + +| 事件名 | 说明 | 回调参数 | +|--------|------|----------| +| back | 返回按钮点击事件 | 无 | +| search | 搜索按钮点击事件 | 无 | + +## 样式定制 + +组件使用 SCSS 编写,支持通过 CSS 变量或覆盖样式进行定制。主要样式类: + +- `.layout` - 整体布局容器 +- `.navbar` - 导航栏容器 +- `.titleBar` - 标题栏区域 +- `.title` - 标题文本 +- `.back-button` - 返回按钮 +- `.search` - 搜索按钮 + +## 注意事项 + +1. 组件会自动处理状态栏高度,确保在不同设备上正确显示 +2. 返回按钮默认使用 `navigateBack(1)` 进行页面返回 +3. 搜索按钮需要配合 `showSearch` 属性使用 +4. 标题对齐方式会影响按钮的布局,建议根据实际需求调整 \ No newline at end of file diff --git a/components/custom-nav-bar/custom-nav-bar.vue b/components/custom-nav-bar/custom-nav-bar.vue index a6be02f..aa316db 100644 --- a/components/custom-nav-bar/custom-nav-bar.vue +++ b/components/custom-nav-bar/custom-nav-bar.vue @@ -24,7 +24,7 @@ - + @@ -50,7 +50,7 @@ const props = defineProps({ // 背景颜色 backgroundColor: { type: String, - default: '#ffddca', + default: '#fff', }, // 标题颜色 titleColor: { @@ -87,6 +87,11 @@ const props = defineProps({ type: Function, default: null, }, + //是否填充 + fill: { + type: Boolean, + default: true, + }, }) // 定义事件 diff --git a/pages/agents/requestAgent.vue b/pages/agents/requestAgent.vue index 206b744..8c74343 100644 --- a/pages/agents/requestAgent.vue +++ b/pages/agents/requestAgent.vue @@ -1,7 +1,7 @@