移除对已删演示卡元素的引用(calNext/kickTodayHome) 修复初始化空指针 (v26090720)

This commit is contained in:
2026-09-08 01:44:03 +08:00
parent 90f28b8ec9
commit 2af6def2fd
2 changed files with 8 additions and 8 deletions

View File

@@ -455,7 +455,8 @@
state.kickQuick++; state.kickToday++; state.todayCount++;
const a = $('#kickCount'), b = $('#kickTodayHome'), c = $('#todayCount');
a.textContent = state.kickQuick; bump(a.parentElement);
b.textContent = state.kickToday; bump(b.parentElement);
/* #kickTodayHome 原在首页数胎动演示卡上(已换成应用宫格),守卫判空 */
if (b) { b.textContent = state.kickToday; bump(b.parentElement); }
c.textContent = state.todayCount;
toast('胎动 +1,今天已记录 ' + state.kickQuick + ' 次');
haptic();
@@ -1854,7 +1855,7 @@
n.textContent = n.dataset.wk === 'cn' ? '孕 ' + state.week + ' 周' : state.week;
});
const next = CHECKUPS.find(w => w * 7 > gaNow);
$('#calNext').textContent = mdTxt(next ? gaToDate(next * 7) : state.due);
/* #calNext 原在首页孕检日历卡上 —— 那批演示卡已换成应用宫格,元素没了,别再写 */
const t = new Date();
$('#noteWhen').textContent = mdTxt(t) + ' ' + WEEKDAY[t.getDay()] + ' · ' + gaTxt(gaNow);
}
@@ -1899,7 +1900,6 @@
不保留 HTML 里的演示默认值(孕27周/9月15日…) */
$$('[data-ga]').forEach(n => { n.textContent = '--'; });
$$('[data-wk]').forEach(n => { n.textContent = '--'; });
$('#calNext').textContent = '--';
const _t = new Date();
$('#noteWhen').textContent = mdTxt(_t);
syncBabyWords();