fix(navheader): 修复 NavHeader 组件警告并更新文档
## 变更内容 ### 修复 NavHeader 组件警告 - 添加 `showBack` prop 定义,解决 extraneous non-props attributes 警告 - 优化返回按钮显示逻辑,优先使用 prop 值 - 添加详细的 JSDoc 注释和使用示例 ### 文档更新 - 更新 CHANGELOG.md,记录 NavHeader 修复内容 - 添加 login_status API 规范文档 **影响文件**: - src/components/NavHeader.vue - docs/CHANGELOG.md - docs/api-specs/user/login_status.md Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Showing
3 changed files
with
139 additions
and
4 deletions
| ... | @@ -50,6 +50,25 @@ | ... | @@ -50,6 +50,25 @@ |
| 50 | 50 | ||
| 51 | --- | 51 | --- |
| 52 | 52 | ||
| 53 | +## [2026-02-02] - 修复 NavHeader 警告 | ||
| 54 | + | ||
| 55 | +### 修复 | ||
| 56 | +- 修复 `NavHeader` 组件 extraneous non-props attributes 警告 | ||
| 57 | + - 添加 `showBack` prop 定义 | ||
| 58 | + - 优化返回按钮显示逻辑,优先使用 prop 值 | ||
| 59 | + - 影响文件:src/components/NavHeader.vue | ||
| 60 | + | ||
| 61 | +--- | ||
| 62 | + | ||
| 63 | +**详细信息**: | ||
| 64 | +- **影响文件**: src/components/NavHeader.vue | ||
| 65 | +- **技术栈**: Vue 3, Taro | ||
| 66 | +- **测试状态**: ✅ 已通过 (代码逻辑验证) | ||
| 67 | +- **备注**: | ||
| 68 | + - 解决了在 Login 页面调用 NavHeader 时控制台报出的 Vue 警告 | ||
| 69 | + | ||
| 70 | +--- | ||
| 71 | + | ||
| 53 | ## [2026-02-02] - 修复 Apifox 响应解析 | 72 | ## [2026-02-02] - 修复 Apifox 响应解析 |
| 54 | 73 | ||
| 55 | ### 修复 | 74 | ### 修复 | ... | ... |
docs/api-specs/user/login_status.md
0 → 100644
| 1 | +# 查询登录状态 | ||
| 2 | + | ||
| 3 | +## OpenAPI Specification | ||
| 4 | + | ||
| 5 | +```yaml | ||
| 6 | +openapi: 3.0.1 | ||
| 7 | +info: | ||
| 8 | + title: '' | ||
| 9 | + version: 1.0.0 | ||
| 10 | +paths: | ||
| 11 | + /srv/: | ||
| 12 | + get: | ||
| 13 | + summary: 查询登录状态 | ||
| 14 | + deprecated: false | ||
| 15 | + description: '' | ||
| 16 | + tags: | ||
| 17 | + - 用户 | ||
| 18 | + parameters: | ||
| 19 | + - name: f | ||
| 20 | + in: query | ||
| 21 | + description: '' | ||
| 22 | + required: true | ||
| 23 | + example: manulife | ||
| 24 | + schema: | ||
| 25 | + type: string | ||
| 26 | + - name: a | ||
| 27 | + in: query | ||
| 28 | + description: '' | ||
| 29 | + required: true | ||
| 30 | + example: user | ||
| 31 | + schema: | ||
| 32 | + type: string | ||
| 33 | + - name: t | ||
| 34 | + in: query | ||
| 35 | + description: '' | ||
| 36 | + required: true | ||
| 37 | + example: login_status | ||
| 38 | + schema: | ||
| 39 | + type: string | ||
| 40 | + responses: | ||
| 41 | + '200': | ||
| 42 | + description: '' | ||
| 43 | + content: | ||
| 44 | + application/json: | ||
| 45 | + schema: | ||
| 46 | + type: object | ||
| 47 | + properties: | ||
| 48 | + code: | ||
| 49 | + type: integer | ||
| 50 | + title: 状态 | ||
| 51 | + description: 0=失败,1=成功 | ||
| 52 | + msg: | ||
| 53 | + type: string | ||
| 54 | + title: 错误信息 | ||
| 55 | + data: | ||
| 56 | + type: object | ||
| 57 | + properties: | ||
| 58 | + is_login: | ||
| 59 | + type: boolean | ||
| 60 | + title: 是否已经登录 | ||
| 61 | + description: true=登录,false=未登录 | ||
| 62 | + is_openid: | ||
| 63 | + type: boolean | ||
| 64 | + title: 是否已授权 | ||
| 65 | + description: true=已授权,false=未授权 | ||
| 66 | + x-apifox-orders: | ||
| 67 | + - is_openid | ||
| 68 | + - is_login | ||
| 69 | + required: | ||
| 70 | + - is_login | ||
| 71 | + - is_openid | ||
| 72 | + x-apifox-orders: | ||
| 73 | + - code | ||
| 74 | + - msg | ||
| 75 | + - data | ||
| 76 | + required: | ||
| 77 | + - code | ||
| 78 | + - msg | ||
| 79 | + - data | ||
| 80 | + headers: {} | ||
| 81 | + x-apifox-name: 成功 | ||
| 82 | + x-apifox-ordering: 0 | ||
| 83 | + security: [] | ||
| 84 | + x-apifox-folder: 用户 | ||
| 85 | + x-apifox-status: testing | ||
| 86 | + x-run-in-apifox: https://app.apifox.com/web/project/7792797/apis/api-414166128-run | ||
| 87 | +components: | ||
| 88 | + schemas: {} | ||
| 89 | + responses: {} | ||
| 90 | + securitySchemes: {} | ||
| 91 | +servers: [] | ||
| 92 | +security: [] | ||
| 93 | + | ||
| 94 | +``` |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2026-01-29 21:09:28 | 2 | * @Date: 2026-01-29 21:09:28 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2026-01-30 20:18:20 | 4 | + * @LastEditTime: 2026-02-02 18:25:30 |
| 5 | * @FilePath: /manulife-weapp/src/components/NavHeader.vue | 5 | * @FilePath: /manulife-weapp/src/components/NavHeader.vue |
| 6 | * @Description: 通用导航头组件,用于页面顶部固定导航栏,展示页面标题。 | 6 | * @Description: 通用导航头组件,用于页面顶部固定导航栏,展示页面标题。 |
| 7 | + * @Usage: | ||
| 8 | + * <NavHeader title="首页" /> | ||
| 9 | + * <NavHeader title="详情" :show-back="true" /> | ||
| 7 | --> | 10 | --> |
| 8 | <template> | 11 | <template> |
| 9 | <!-- Placeholder to prevent content from being hidden behind fixed header --> | 12 | <!-- Placeholder to prevent content from being hidden behind fixed header --> |
| ... | @@ -24,20 +27,39 @@ import { ref, onMounted } from 'vue' | ... | @@ -24,20 +27,39 @@ import { ref, onMounted } from 'vue' |
| 24 | import Taro from '@tarojs/taro' | 27 | import Taro from '@tarojs/taro' |
| 25 | import IconFont from '@/components/IconFont.vue' | 28 | import IconFont from '@/components/IconFont.vue' |
| 26 | 29 | ||
| 27 | -defineProps({ | 30 | +/** |
| 31 | + * Props definition | ||
| 32 | + * @property {String} title - Page title | ||
| 33 | + * @property {Boolean} [showBack] - Whether to show back button. If undefined, auto-detects based on page stack. | ||
| 34 | + */ | ||
| 35 | +const props = defineProps({ | ||
| 28 | title: { | 36 | title: { |
| 29 | type: String, | 37 | type: String, |
| 30 | required: true | 38 | required: true |
| 39 | + }, | ||
| 40 | + showBack: { | ||
| 41 | + type: Boolean, | ||
| 42 | + default: undefined | ||
| 31 | } | 43 | } |
| 32 | }) | 44 | }) |
| 33 | 45 | ||
| 34 | const canGoBack = ref(false) | 46 | const canGoBack = ref(false) |
| 35 | 47 | ||
| 48 | +/** | ||
| 49 | + * Initialize back button state | ||
| 50 | + */ | ||
| 36 | onMounted(() => { | 51 | onMounted(() => { |
| 37 | - const pages = Taro.getCurrentPages() | 52 | + if (props.showBack !== undefined) { |
| 38 | - canGoBack.value = pages.length > 1 | 53 | + canGoBack.value = props.showBack |
| 54 | + } else { | ||
| 55 | + const pages = Taro.getCurrentPages() | ||
| 56 | + canGoBack.value = pages.length > 1 | ||
| 57 | + } | ||
| 39 | }) | 58 | }) |
| 40 | 59 | ||
| 60 | +/** | ||
| 61 | + * Handle back navigation | ||
| 62 | + */ | ||
| 41 | const goBack = () => { | 63 | const goBack = () => { |
| 42 | Taro.navigateBack() | 64 | Taro.navigateBack() |
| 43 | } | 65 | } | ... | ... |
-
Please register or login to post a comment