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

feat(Calendar): Calendar 组件添加仅显示有效时间组功能 #527

Merged
merged 2 commits into from Apr 18, 2019

Conversation

zhgqthomas
Copy link
Contributor

通过给 Calendar 传入 validDates 属性,使日历仅显示有效时间组的日期,其余时间全部置灰且无法点击。fix #526

@koppthe koppthe requested a review from SzHeJason April 14, 2019 03:13
Copy link
Collaborator

@SzHeJason SzHeJason left a comment

Choose a reason for hiding this comment

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

为啥要将 dist 提交上来呢?

@zhgqthomas
Copy link
Contributor Author

@SzHeJason 不好意思 我是因为自己项目 package.json 直接引用了 自己仓库的分支为了使用新添加的这个功能 忘记了这个分支已经提 PR 了 我回滚一下

@zhgqthomas zhgqthomas force-pushed the feature_compoent_calendar_validdates branch from 71b77b9 to da46998 Compare April 15, 2019 01:51
@zhgqthomas
Copy link
Contributor Author

@SzHeJason 已回滚


if (!_isEmpty(validDates)) {
let isInclude = false;
_forEach(validDates, date => { // 判断当前日期是否在有效时间组内
Copy link
Collaborator

Choose a reason for hiding this comment

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

这块逻辑可以优化一下 如果你追求性能 那么 isInclude 为 true 的时候 剩下的还需要判断吗? 如果你追求代码的简洁性 那用 Array.some 会不会更好呢?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

代码已经改用 Array.some 来提高代码简洁性,因并不是经常使用 JS,所以不知道有 Array.some 这个方法,学习了,感谢~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants