diff --git a/components/custom-navbar/README.md b/components/custom-navbar/README.md new file mode 100644 index 0000000..51ef383 --- /dev/null +++ b/components/custom-navbar/README.md @@ -0,0 +1,98 @@ +# CustomNavbar 自定义导航栏组件 + +## 功能特性 + +- 自动适配微信小程序状态栏高度 +- 自动计算胶囊按钮高度,确保文字与胶囊水平对齐 +- 支持自定义标题、返回按钮图标 +- 支持右侧插槽,可添加自定义内容 +- 支持返回事件回调 + +## 使用方法 + +### 基础用法 + +```vue + + + +``` + +### 自定义返回按钮图标 + +```vue + +``` + +### 隐藏返回按钮 + +```vue + +``` + +### 添加右侧内容 + +```vue + + + +``` + +## Props + +| 参数 | 类型 | 默认值 | 说明 | +|------|------|--------|------| +| title | String | '' | 导航栏标题 | +| backIcon | String | CommonEnum.BACK_BUTTON | 返回按钮图标路径 | +| showBack | Boolean | true | 是否显示返回按钮 | + +## Events + +| 事件名 | 说明 | 回调参数 | +|--------|------|----------| +| back | 点击返回按钮时触发 | - | + +## Slots + +| 插槽名 | 说明 | +|--------|------| +| right | 右侧内容插槽 | + +## 注意事项 + +1. 组件会自动计算状态栏和胶囊高度,无需手动设置 +2. 组件使用 `position: fixed` 定位,确保在页面顶部 +3. 组件内部包含填充区,页面内容无需设置 `margin-top` +4. 组件样式使用 `scoped`,不会影响其他组件 \ No newline at end of file diff --git a/components/custom-navbar/custom-navbar.vue b/components/custom-navbar/custom-navbar.vue new file mode 100644 index 0000000..ace9b51 --- /dev/null +++ b/components/custom-navbar/custom-navbar.vue @@ -0,0 +1,130 @@ + + + + + \ No newline at end of file diff --git a/pages/walkInto/walkInto.vue b/pages/walkInto/walkInto.vue index f015277..b552bde 100644 --- a/pages/walkInto/walkInto.vue +++ b/pages/walkInto/walkInto.vue @@ -1,15 +1,12 @@