-
-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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: Statistic.Countdown pause and start api #26229
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit cdbe286:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feature branch
Codecov Report
@@ Coverage Diff @@
## feature #26229 +/- ##
========================================
Coverage 99.54% 99.54%
========================================
Files 373 373
Lines 7315 7318 +3
Branches 2033 2041 +8
========================================
+ Hits 7282 7285 +3
Misses 33 33
Continue to review full report at Codecov.
|
rebase featrue 后 |
另外建议改用 hooks |
rebase 到 featrue 发现 CI 有点问题,改用 hooks 是改成函数式组件吗? |
嗯,Statistic 已经改了,可以把 Countdown 也改一下 |
为啥需要 |
这样设计 |
components/statistic/Countdown.tsx
Outdated
const [countdownId, setCountdownId] = React.useState<number>(); | ||
const [pauseTime, setPauseTime] = React.useState<number>(); | ||
const [totalPauseTime, setTotalPauseTime] = React.useState<number>(0); | ||
const [, forceUpdate] = React.useState({}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forceUpdate 可以等一下 #26270 结果
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
换成全局的 useForceUpdate 了
| Name | Description | Version | | ||
| ------- | --------------- | ------- | | ||
| start() | Start countdown | | | ||
| pause() | Pause countdown | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不要提供方法出来,会让 value
非受控。提供一个 disabled
属性,设置后停止计时器,让用户恢复时重新提供一个新的 value
。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
paused 如何?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
paused 感觉 更符合 这个操作一些
有冲突,rebase 下最新的 |
Closing for no further progress, feel free to open new pull request: #26229 (comment) |
🤔 This is a ...
🔗 Related issue link
close #26182
💡 Background and solution
📝 Changelog
☑️ Self Check before Merge
View rendered components/statistic/index.en-US.md
View rendered components/statistic/index.zh-CN.md