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: 优化支付宝小程序下的countdown倒计时性能,减少setData数据量(去除无用的data)。 #437

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/rax-countdown/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Changelog
## v1.2.1

- Feat decrease setData data size for promote performance

## v1.2.0

Expand Down
2 changes: 1 addition & 1 deletion packages/rax-countdown/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rax-countdown",
"version": "1.2.0",
"version": "1.2.1",
"description": "Countdown component for Rax.",
"license": "BSD-3-Clause",
"main": "lib/index.js",
Expand Down
13 changes: 8 additions & 5 deletions packages/rax-countdown/src/miniapp-native/ali-miniapp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,14 @@ Component({
case 'm':
case 's':
if (index % 2 === 0) {
// insert plain text before current matched item
return {
value: tpl.slice(lastPlaintextIndex, val),
style: textStyle
};
const value = tpl.slice(lastPlaintextIndex, val);
if (value || textStyle) {
// insert plain text before current matched item
return {
value,
style: textStyle
};
}
} else {
// replace current matched item to realtime string
lastPlaintextIndex = val + 3;
Expand Down