Issue#6·B2fix: 发送趋势图 resize 死循环根修——chart.js responsive 必须有确定尺寸父级,原 style=height 直接挂 canvas 组件致 canvas↔父容器互相撑开无限 resize(症状:曲线持续拉升+页面卡死);修复=固定高度 238px relative 包裹容器 + animation:false(轮询期避免动画叠加);Chrome 20s 三采样实证:canvas 238px 恒定/页高 2054 恒定/主线程响应 3ms

This commit is contained in:
2026-11-18 10:58:18 +08:00
parent 74e785c91e
commit a020c8b3a3
+6 -1
View File
@@ -133,7 +133,11 @@
</div>
</div>
<div class="p-4">
<Line :data="chartData" :options="chartOptions" style="height: 238px" />
<!-- 固定高度包裹容器:chart.js responsive 必须有确定尺寸的父级,
否则 canvas↔父容器互相撑开形成 resize 死循环(曲线持续拉升+页面卡死) -->
<div class="relative" style="height: 238px">
<Line :data="chartData" :options="chartOptions" />
</div>
<div class="mt-2 flex items-center gap-4 px-2 text-xs text-gray-500">
<span class="flex items-center gap-1.5"><i class="inline-block h-1 w-4 rounded bg-primary-500"></i>提交</span>
<span class="flex items-center gap-1.5"><i class="inline-block h-1 w-4 rounded bg-sky-500"></i>成功</span>
@@ -490,6 +494,7 @@ function protoLabel(c: Channel): string {
const chartOptions: ChartOptions<'line'> = {
responsive: true, maintainAspectRatio: false,
animation: false, // 轮询期间避免动画叠加;趋势切换即时呈现
interaction: { mode: 'index', intersect: false },
plugins: { legend: { display: false } },
scales: {