refactor: optimize video & upper rank page
This commit is contained in:
1 parent
cb547e3ced
commit
1b76fdeda1
4 files changed
+132
-125
No files matched your search
@@ -36,9 +36,11 @@ export function videoCard(item, {
|
||||
} = {}) {
|
||||
const metrics = item.metrics || {};
|
||||
const hasMetric = Object.prototype.hasOwnProperty.call(metrics, primary);
|
||||
const primaryValue = primaryText !== null
|
||||
const raw = primaryText !== null
|
||||
? primaryText
|
||||
: (hasMetric ? metrics[primary] : item[primary]);
|
||||
// 指标排序直接返回原始计数,统一走 formatCount,避免同一列混排 “36375” 与 “1.1万”。
|
||||
const primaryValue = typeof raw === "number" ? formatCount(raw) : raw;
|
||||
const label = primaryLabel || metricLabel(primary);
|
||||
const growth = item.growth;
|
||||
const delta = growth?.available ? growth.delta : null;
|
||||
@@ -69,7 +71,6 @@ export function videoCard(item, {
|
||||
<span class="secondary-stat">互动 ${formatPercent(item.interaction_rate)}</span>
|
||||
</div>
|
||||
</div>
|
||||
<span class="card-arrow" aria-hidden="true">›</span>
|
||||
</a>`;
|
||||
}
|
||||
|
||||
@@ -100,7 +101,6 @@ export function upCard(item, {
|
||||
<span class="secondary-stat">${escapeHtml(secondaryLabel)} ${escapeHtml(secondary)}</span>
|
||||
</div>
|
||||
</div>
|
||||
<span class="card-arrow" aria-hidden="true">›</span>
|
||||
</a>`;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user