Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datetime-picker添加年选择器 #241

Merged
merged 7 commits into from
Apr 13, 2024

Conversation

RJQingHuan
Copy link
Collaborator

@RJQingHuan RJQingHuan commented Apr 12, 2024

🤔 这个 PR 的性质是?(至少选择一个)

  • 日常 bug 修复
  • 新特性提交
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • CI/CD 改进
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 代码重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

resolve #125

💡 需求背景和解决方案

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充

Copy link

vercel bot commented Apr 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
wot-design-uni ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 13, 2024 9:05am

Copy link

netlify bot commented Apr 12, 2024

Deploy Preview for wot-design-uni ready!

Name Link
🔨 Latest commit 99dcc6d
🔍 Latest deploy log https://app.netlify.com/sites/wot-design-uni/deploys/661a4a81904e1600089bca5c
😎 Deploy Preview https://deploy-preview-241--wot-design-uni.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@RJQingHuan RJQingHuan changed the title Year picker datetime-picker添加年选择器 Apr 12, 2024
Copy link
Owner

@Moonofweisheng Moonofweisheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

非常感谢你的PR,很有帮助,这里有2点需要调整后才方便合并:

  • year类型时picker-viewgetValuesgetSelects的返回值并非数组类型,之前的逻辑中对其类型断言为数组类型,在year类型下就不适用了(as xx[] 可以移除),所以希望在使用其返回值时做个类型判断,如果不是数组则将其作为第一项放在数组中,用于兼容updateInnerValue和defaultDisplayFormat要求入参是数组类型的问题。
  • 有一段打印代码提交上来了,也希望移除(console.log('items.length', items.length))

Copy link
Owner

@Moonofweisheng Moonofweisheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

首先再次感谢,这里有个再次调整的建议:
updateInnerValue方法这一行const year = type === 'year' ? values : values[0] && parseInt(values[0])中values始终为数组类型,而year则要求不为数组,这里可以仍然使用原来的逻辑对year赋值const year = values[0] && parseInt(values[0])。而对数组类型的判断可以使用util中提供的isArray方法,它可以实现类型推导。

@Moonofweisheng Moonofweisheng merged commit 0073b32 into Moonofweisheng:master Apr 13, 2024
6 checks passed
@RJQingHuan RJQingHuan deleted the year-picker branch May 17, 2024 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

日期选择希望新增年选择
2 participants