feat(week-date): ✨ 新增 WeekDate 周日期选择组件#1438
feat(week-date): ✨ 新增 WeekDate 周日期选择组件#1438North-al wants to merge 10 commits intoMoonofweisheng:masterfrom
Conversation
|
@North-al is attempting to deploy a commit to the weisheng's projects Team on Vercel. A member of the Team first needs to authorize it. |
✅ Deploy Preview for wot-design-uni ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Walkthrough新增 WeekDate 周日期选择器:包含 Vue SFC 组件、类型与导出、样式与主题变量、演示子页面、路由与导航项、本地化词条及中英文文档与示例页面(无现有 API 签名变更)。 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI Agents
In @src/uni_modules/wot-design-uni/components/wd-week-date/wd-week-date.vue:
- Line 71: WEEK_LABELS is hardcoded to Chinese and breaks i18n; replace the
constant with a locale-aware source by reading week day labels from your i18n
system or dayjs locale inside the wd-week-date component (e.g., derive labels
where WEEK_LABELS is used), e.g., create a computed/getter (used in the
template) that fetches localized weekday names from your i18n API or
dayjs.localeData().weekdaysMin() and use that instead of the static WEEK_LABELS
constant.
🧹 Nitpick comments (3)
docs/component/week-date.md (1)
45-88: 建议改进文档示例的变量命名三个禁用日期的示例都使用了相同的变量名
value4,这可能让读者感到困惑。建议使用不同的变量名以提高文档清晰度。另外,示例中使用了dayjs但未展示导入语句。💡 建议的改进方案
在第一个示例之前添加 dayjs 导入说明:
import dayjs from 'dayjs'并为不同示例使用不同的变量名:
- 禁用之前的日期:使用
value4- 禁用之后的日期:使用
value5或valueAfter- 禁用星期三和星期五:使用
value6或valueWeekdayssrc/uni_modules/wot-design-uni/components/wd-week-date/types.ts (1)
2-2: 移除未使用的导入。
makeNumberProp和numericProp已导入但未使用,建议移除以保持代码整洁。🔎 建议修改
-import { baseProps, makeNumberProp, makeNumericProp, makeRequiredProp, makeStringProp, numericProp } from '../common/props' +import { baseProps, makeNumericProp, makeRequiredProp, makeStringProp } from '../common/props'src/subPages/weekDate/Index.vue (1)
91-101: Toast 消息使用了硬编码的中文字符串。事件处理函数中的 Toast 消息(如
切换日期:、日期:、类型:)使用了硬编码的中文文本,与 demo-block 标题使用$t()进行国际化的方式不一致。此外,第 100 行的as string类型断言是多余的,因为WeekChangeEvent.date已经是string类型。🔎 建议修改
const handleSelect5 = (date: WeekDateItem) => { - success(`切换日期:${date.fullDate}`) + success(`${t('qie-huan-ri-qi')}:${date.fullDate}`) } const handleChange6 = (date: WeekChangeEvent) => { - success(`日期:${date.date},类型:${date.type}`) + success(`${t('ri-qi')}:${date.date},${t('lei-xing')}:${date.type}`) } const handleChange7 = (date: WeekChangeEvent) => { - success(`日期:${date.date},类型:${date.type}`) - value7.value = date.date as string + success(`${t('ri-qi')}:${date.date},${t('lei-xing')}:${date.type}`) + value7.value = date.date }
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (15)
docs/.vitepress/locales/en-US.tsdocs/.vitepress/locales/zh-CN.tsdocs/component/week-date.mddocs/en-US/component/week-date.mdsrc/locale/en-US.jsonsrc/locale/zh-CN.jsonsrc/pages.jsonsrc/pages/index/Index.vuesrc/subPages/weekDate/Index.vuesrc/uni_modules/wot-design-uni/components/common/abstracts/variable.scsssrc/uni_modules/wot-design-uni/components/wd-config-provider/types.tssrc/uni_modules/wot-design-uni/components/wd-week-date/index.scsssrc/uni_modules/wot-design-uni/components/wd-week-date/index.tssrc/uni_modules/wot-design-uni/components/wd-week-date/types.tssrc/uni_modules/wot-design-uni/components/wd-week-date/wd-week-date.vue
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-11-26T02:35:53.123Z
Learnt from: Moonofweisheng
Repo: Moonofweisheng/wot-design-uni PR: 737
File: src/uni_modules/wot-design-uni/components/wd-divider/wd-divider.vue:25-25
Timestamp: 2024-11-26T02:35:53.123Z
Learning: 在 `wd-divider.vue` 文件(路径:`src/uni_modules/wot-design-uni/components/wd-divider/wd-divider.vue`)中,`props.customStyle` 是字符串类型,用于传递自定义的样式字符串。
Applied to files:
docs/component/week-date.mdsrc/uni_modules/wot-design-uni/components/wd-week-date/wd-week-date.vuesrc/uni_modules/wot-design-uni/components/common/abstracts/variable.scsssrc/subPages/weekDate/Index.vue
📚 Learning: 2024-11-24T06:12:44.418Z
Learnt from: Moonofweisheng
Repo: Moonofweisheng/wot-design-uni PR: 733
File: src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue:327-327
Timestamp: 2024-11-24T06:12:44.418Z
Learning: 在 `src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue` 中,由于 `title` 可能会发生变化,涉及到 `title` 的优化不太容易实现,需谨慎处理。
Applied to files:
src/uni_modules/wot-design-uni/components/wd-week-date/wd-week-date.vuesrc/subPages/weekDate/Index.vue
🪛 Biome (2.1.2)
src/pages.json
[error] 821-822: Expected a property but instead found '// #ifdef MP'.
Expected a property here.
(parse)
[error] 821-822: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 822-823: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 823-823: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 823-823: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 823-826: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 826-826: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 826-826: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 826-827: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 827-829: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Generate Test Summary
🔇 Additional comments (21)
docs/.vitepress/locales/en-US.ts (1)
263-265: LGTM!WeekDate 导航项添加正确,位置合理,与其他组件条目保持一致。
src/uni_modules/wot-design-uni/components/wd-config-provider/types.ts (2)
1056-1067: LGTM!weekDateThemeVars 类型定义完整,命名规范与其他组件主题变量保持一致,所有属性都正确设置为可选类型。
1137-1138: LGTM!weekDateThemeVars 已正确集成到 ConfigProviderThemeVars 联合类型中,使得 WeekDate 组件可以通过 ConfigProvider 进行主题定制。
docs/.vitepress/locales/zh-CN.ts (1)
267-270: LGTM!中文导航项添加正确,文案清晰,位置与英文版保持一致。
src/pages.json (1)
818-832: LGTM!WeekDate 页面配置完整,遵循项目规范。静态分析工具报告的错误是误报,uni-app 的条件编译注释语法在 pages.json 中是合法的。
docs/component/week-date.md (4)
90-108: LGTM!选择回调示例完整,展示了类型导入和事件处理的正确用法。
110-149: LGTM!切换周事件的两个示例都很清晰,第二个示例特别好地展示了如何实现日期跟随切换的效果,并且提醒了不建议与
disabled-date搭配使用的注意事项。
151-164: LGTM!插槽使用示例清晰,展示了如何自定义左右切换按钮的图标。
166-211: LGTM!API 文档完整且格式规范,属性表、事件表和类型定义都清晰易懂。外部样式类的定义符合项目规范。
src/uni_modules/wot-design-uni/components/wd-week-date/index.ts (1)
1-1: LGTM!类型导出结构清晰,遵循了组件库的标准导出模式,方便消费者从模块入口直接导入所需类型。
src/pages/index/Index.vue (1)
167-170: LGTM!新增的 weekDate 页面入口位置合理,与日历相关组件(calendar、calendarView)分组在一起,遵循了现有的列表结构模式。
src/uni_modules/wot-design-uni/components/wd-week-date/index.scss (1)
1-89: LGTM!样式实现遵循了组件库的 BEM 命名规范和 mixin 使用模式。设计令牌(CSS 变量)的使用保证了主题一致性,过渡动画使状态切换更平滑。
docs/en-US/component/week-date.md (1)
1-215: LGTM!文档结构完整,涵盖了组件的所有功能点。代码示例清晰易懂,API 表格详尽。特别是第 132 行关于
disabled-date与日期跟随功能配合使用的警告说明很有价值。src/uni_modules/wot-design-uni/components/wd-week-date/types.ts (1)
4-54: LGTM!类型定义清晰完整,JSDoc 注释有助于开发者理解各属性的用途。
WeekStart、WeekDateItem、WeekChangeEvent的类型设计合理,与文档描述一致。src/subPages/weekDate/Index.vue (1)
1-57: LGTM!演示页面全面展示了 WeekDate 组件的各项功能,包括基础用法、周起始日配置、形状定制、多种禁用日期场景、事件处理和自定义插槽。结构清晰,便于开发者参考。
src/locale/zh-CN.json (1)
1664-1677: LGTM!新增的 WeekDate 相关本地化键值完整,命名风格与现有条目保持一致。涵盖了组件导航、演示页面所需的所有文本。
src/uni_modules/wot-design-uni/components/wd-week-date/wd-week-date.vue (3)
1-39: 模板结构清晰合理组件模板设计良好,包含上一周/下一周按钮、周列表展示,并提供了插槽支持自定义图标。状态类绑定(active、disabled、circle)逻辑清晰。
127-155: 事件处理和资源清理实现良好
onSelect方法正确地防止了禁用日期的选择prevWeek/nextWeek导航功能实现合理- 在
onBeforeUnmount中显式停止 watch 是良好的实践,虽然 Vue 3 会自动清理,但显式清理提高了代码的可维护性
87-92: 周起始日期计算逻辑验证完成,代码实现正确周起始日期的计算公式
(day - weekStart + 7) % 7经过验证所有场景都正确运行,无需修改。代码已正确处理以下情况:
- 跨年/跨月边界:dayjs 的
subtract()方法内部正确处理日期边界转换- 夏令时:组件在日期精度(非小时/分钟)下操作,不受 DST 影响
- 时区:代码使用本地时间,无 UTC 转换需求
实现可以按现状保留。
src/locale/en-US.json (1)
1664-1676: 国际化资源添加完整为 WeekDate 组件添加了完整的英文本地化资源,包括标题、属性说明和功能描述。翻译内容准确清晰,与现有的本地化资源风格保持一致。
src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss (1)
1026-1036: 样式变量定义规范WeekDate 组件的样式变量定义完整且规范:
- 遵循项目现有的命名约定
$-week-date-*- 正确使用 CSS 自定义属性支持主题定制
- 默认值合理引用了共享的主题颜色变量(如
$-color-theme、$-color-gray-5等)- 变量覆盖了组件所需的所有视觉元素
src/uni_modules/wot-design-uni/components/wd-week-date/wd-week-date.vue
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI Agents
In @src/locale/en-US.json:
- Around line 1665-1678: There are duplicate localization keys mapping to the
same value: remove the redundant key (either "week-date-title" or
"weekdate-zhou-ri-qi-xuan-ze") after confirming which one the codebase actually
references; search usages of both keys and keep the one that is used, deleting
the unused key from en-US.json. Also trim the trailing space in the
"qie-huan-ri-qi" value (change "Selected date: " to "Selected date:" unless the
space is intentionally required by downstream formatting) and run a quick
grep/IDE search to ensure no code depends on the trailing space.
In @src/locale/zh-CN.json:
- Around line 1665-1666: The two i18n keys use inconsistent prefixes:
"week-date-title" (with hyphen) and "weekdate-zhou-ri-qi-xuan-ze" (without
hyphen); rename the latter to "week-date-zhou-ri-qi-xuan-ze" to match the
"week-date-" prefix and update any code references that access
"weekdate-zhou-ri-qi-xuan-ze" (search for usages of that key) so all lookups use
the unified "week-date-" prefixed key.
🧹 Nitpick comments (1)
src/locale/zh-CN.json (1)
1668-1668: WeekDate 组件的命名需改进一致性,但不存在键冲突风险。审查发现
"xing-zhuang"和"lei-xing"这两个键在整个代码库中仅出现于 WeekDate 组件的本地化文件中,不存在与其他组件的键冲突。然而,WeekDate 组件内部的命名存在不一致性:某些键使用week-date-或weekdate-前缀(如"week-date-title"和"weekdate-zhou-ri-qi-xuan-ze"),而其他键则没有前缀。为了提高代码的可维护性和一致性,建议为所有组件特定的键添加统一的前缀。
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
docs/component/week-date.mddocs/en-US/component/week-date.mdsrc/locale/en-US.jsonsrc/locale/zh-CN.jsonsrc/subPages/weekDate/Index.vuesrc/uni_modules/wot-design-uni/components/wd-week-date/types.tssrc/uni_modules/wot-design-uni/components/wd-week-date/wd-week-date.vue
🚧 Files skipped from review as they are similar to previous changes (5)
- src/uni_modules/wot-design-uni/components/wd-week-date/types.ts
- docs/component/week-date.md
- docs/en-US/component/week-date.md
- src/uni_modules/wot-design-uni/components/wd-week-date/wd-week-date.vue
- src/subPages/weekDate/Index.vue
🔇 Additional comments (1)
src/locale/en-US.json (1)
1664-1664: 格式修改正确在 "zuo-zhong" 条目后添加尾部逗号是必要的,因为后续添加了新的 WeekDate 本地化条目。JSON 语法正确。
| "week-date-title": "WeekDate", | ||
| "weekdate-zhou-ri-qi-xuan-ze": "WeekDate", | ||
| "qi-shi-zhou-qi-zhou-ri": "Start of Week (Sunday)", | ||
| "xing-zhuang": "Shape", | ||
| "jin-yong-ri-qi": "Disabled Date", | ||
| "jin-yong-zhi-qian-de-ri-qi": "Disable Dates Before Today", | ||
| "jin-yong-zhi-hou-de-ri-qi": "Disable Dates After Today", | ||
| "jin-yong-xing-qi-san-he-xing-qi-wu": "Disable Wednesday and Friday", | ||
| "xuan-ze-hui-diao": "Select Callback", | ||
| "qie-huan-zhou-shi-jian": "Week Change Event", | ||
| "qie-huan-zhou-ri-qi-gen-sui": "Week Change Date Follow", | ||
| "zi-ding-yi-tu-biao-cha-zhi": "Custom Icons (Slots)", | ||
| "qie-huan-ri-qi": "Selected date: ", | ||
| "lei-xing": "Type" |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify duplicate keys and check the specific keys mentioned in the review
echo "=== Checking if src/locale/en-US.json exists ==="
if [ ! -f "src/locale/en-US.json" ]; then
echo "File not found"
exit 1
fi
echo "=== Extracting lines 1665-1678 to verify content ==="
sed -n '1665,1678p' src/locale/en-US.json
echo ""
echo "=== Checking for duplicate keys in entire JSON file ==="
jq -r 'keys[]' src/locale/en-US.json | sort | uniq -d
echo ""
echo "=== Searching for 'lei-xing' key in the entire file ==="
grep -n '"lei-xing"' src/locale/en-US.json
echo ""
echo "=== Searching for 'xing-zhuang' key in the entire file ==="
grep -n '"xing-zhuang"' src/locale/en-US.json
echo ""
echo "=== Checking values for 'week-date-title' and 'weekdate-zhou-ri-qi-xuan-ze' ==="
jq '.["week-date-title"], .["weekdate-zhou-ri-qi-xuan-ze"]' src/locale/en-US.json
echo ""
echo "=== Checking for trailing spaces in 'qie-huan-ri-qi' value ==="
jq '.["qie-huan-ri-qi"]' src/locale/en-US.json | od -c | head -20Repository: Moonofweisheng/wot-design-uni
Length of output: 1286
🏁 Script executed:
#!/bin/bash
echo "=== Checking exact value of 'qie-huan-ri-qi' ==="
jq -r '.["qie-huan-ri-qi"]' src/locale/en-US.json | sed 's/$/[END]/' | cat -A
echo ""
echo "=== Checking exact value length ==="
jq -r '.["qie-huan-ri-qi"]' src/locale/en-US.json | wc -c
echo ""
echo "=== Double-checking all new keys to see if any others have trailing/leading spaces ==="
jq '.["week-date-title"], .["weekdate-zhou-ri-qi-xuan-ze"], .["qi-shi-zhou-qi-zhou-ri"], .["xing-zhuang"], .["jin-yong-ri-qi"], .["jin-yong-zhi-qian-de-ri-qi"], .["jin-yong-zhi-hou-de-ri-qi"], .["jin-yong-xing-qi-san-he-xing-qi-wu"], .["xuan-ze-hui-diao"], .["qie-huan-zhou-shi-jian"], .["qie-huan-zhou-ri-qi-gen-sui"], .["zi-ding-yi-tu-biao-cha-zhi"], .["qie-huan-ri-qi"], .["lei-xing"]' src/locale/en-US.json | cat -ARepository: Moonofweisheng/wot-design-uni
Length of output: 556
移除重复的本地化键
发现两个键映射到相同值:"week-date-title" 和 "weekdate-zhou-ri-qi-xuan-ze" 都为 "WeekDate"。建议检查是否存在冗余,如确实重复,应删除其中一个。
此外,"qie-huan-ri-qi" 的值末尾包含空格("Selected date: "),请确认是否为必要。
🤖 Prompt for AI Agents
In @src/locale/en-US.json around lines 1665 - 1678, There are duplicate
localization keys mapping to the same value: remove the redundant key (either
"week-date-title" or "weekdate-zhou-ri-qi-xuan-ze") after confirming which one
the codebase actually references; search usages of both keys and keep the one
that is used, deleting the unused key from en-US.json. Also trim the trailing
space in the "qie-huan-ri-qi" value (change "Selected date: " to "Selected
date:" unless the space is intentionally required by downstream formatting) and
run a quick grep/IDE search to ensure no code depends on the trailing space.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/locale/zh-CN.json (1)
1667-1678: WeekDate 本地化键命名不一致,建议统一添加组件前缀。部分 WeekDate 相关的键使用了
week-date-前缀(如week-date-title、week-date-xing-zhuang),但包括qi-shi-zhou-qi-zhou-ri、jin-yong-ri-qi、lei-xing等在内的 11 个键缺少该前缀。建议为所有 WeekDate 组件相关的本地化键统一添加week-date-前缀,确保命名风格一致。需要更新的位置:
src/locale/zh-CN.json和src/locale/en-US.json中的键名src/subPages/weekDate/Index.vue中对应的$t()调用🔎 建议的修复方案
-"qi-shi-zhou-qi-zhou-ri": "起始周期(周日)", +"week-date-qi-shi-zhou-qi-zhou-ri": "起始周期(周日)", "week-date-xing-zhuang": "WeekDate 形状", -"jin-yong-ri-qi": "禁用日期", -"jin-yong-zhi-qian-de-ri-qi": "禁用之前的日期", -"jin-yong-zhi-hou-de-ri-qi": "禁用之后的日期", -"jin-yong-xing-qi-san-he-xing-qi-wu": "禁用星期三和星期五", -"xuan-ze-hui-diao": "选择回调", -"qie-huan-zhou-shi-jian": "切换周事件", -"qie-huan-zhou-ri-qi-gen-sui": "切换周日期跟随", -"zi-ding-yi-tu-biao-cha-zhi": "自定义图标(插槽)", -"qie-huan-ri-qi": "切换日期:", -"lei-xing": "类型" +"week-date-jin-yong-ri-qi": "禁用日期", +"week-date-jin-yong-zhi-qian-de-ri-qi": "禁用之前的日期", +"week-date-jin-yong-zhi-hou-de-ri-qi": "禁用之后的日期", +"week-date-jin-yong-xing-qi-san-he-xing-qi-wu": "禁用星期三和星期五", +"week-date-xuan-ze-hui-diao": "选择回调", +"week-date-qie-huan-zhou-shi-jian": "切换周事件", +"week-date-qie-huan-zhou-ri-qi-gen-sui": "切换周日期跟随", +"week-date-zi-ding-yi-tu-biao-cha-zhi": "自定义图标(插槽)", +"week-date-qie-huan-ri-qi": "切换日期:", +"week-date-lei-xing": "类型"同步更新
src/subPages/weekDate/Index.vue中的$t()调用和en-US.json中对应的键名。
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/locale/en-US.jsonsrc/locale/zh-CN.jsonsrc/pages/index/Index.vuesrc/subPages/weekDate/Index.vue
🚧 Files skipped from review as they are similar to previous changes (3)
- src/pages/index/Index.vue
- src/subPages/weekDate/Index.vue
- src/locale/en-US.json
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-11-24T06:12:44.418Z
Learnt from: Moonofweisheng
Repo: Moonofweisheng/wot-design-uni PR: 733
File: src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue:327-327
Timestamp: 2024-11-24T06:12:44.418Z
Learning: 在 `src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue` 中,由于 `title` 可能会发生变化,涉及到 `title` 的优化不太容易实现,需谨慎处理。
Applied to files:
src/locale/zh-CN.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: ESLint Check
🔇 Additional comments (1)
src/locale/zh-CN.json (1)
1665-1666: 命名前缀已修复 ✓之前评审指出的前缀不一致问题已得到解决,Line 1666 的键名已从
weekdate-zhou-ri-qi-xuan-ze更正为week-date-zhou-ri-qi-xuan-ze,与week-date-title保持了一致的连字符格式。
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/uni_modules/wot-design-uni/components/wd-week-date/types.ts (1)
48-48: 建议验证 weekStart 的运行时校验。weekStart 的 TypeScript 类型已限定为 0 或 1,但 makeNumericProp 在运行时可能接受任意数字。建议在组件内部添加运行时校验,确保只接受 0(周日)或 1(周一)。
可通过以下脚本检查是否已有相关校验:
#!/bin/bash # 描述:检查 weekStart 的运行时校验逻辑 # 搜索组件中对 weekStart 的使用和校验 rg -n -C5 'weekStart' --type=vue --type=ts -g '**/wd-week-date/**'
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/uni_modules/wot-design-uni/components/wd-week-date/types.tssrc/uni_modules/wot-design-uni/components/wd-week-date/wd-week-date.vue
🚧 Files skipped from review as they are similar to previous changes (1)
- src/uni_modules/wot-design-uni/components/wd-week-date/wd-week-date.vue
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Test Components (wd-config-provider)
- GitHub Check: Redirect rules - wot-design-uni
- GitHub Check: Header rules - wot-design-uni
- GitHub Check: Pages changed - wot-design-uni
🔇 Additional comments (2)
src/uni_modules/wot-design-uni/components/wd-week-date/types.ts (2)
13-33: 类型定义清晰完善!WeekStart、WeekDateItem 和 WeekChangeEvent 三个类型定义结构合理,字段注释详尽,完全符合周日期选择器的业务场景需求。
40-40: 无需修改,modelValue 类型处理已正确实现。组件在
normalizeDate函数中(wd-week-date.vue 第 68-81 行)已完整处理了所有三种类型:
- 通过
dayjs(value)正确转换 Number(时间戳)、String(日期字符串)和 Date 对象- 使用
isValid()验证日期有效性- 提供 console.warn 警告机制处理无效日期
- 返回规范化的日期对象或 null 作为安全降级
🤔 这个 PR 的性质是?(至少选择一个)
🔗 相关 Issue
💡 需求背景和解决方案
组件场景
☑️ 请求合并前的自查清单
Summary by CodeRabbit
发行说明
新特性
文档
Chores
✏️ Tip: You can customize this high-level summary in your review settings.