fix: 策略表重建滚动兜底(触发渲染前存scrollY,重建后恢复)+MutationObserver去抖防自激——解决刷新滚动/展开还原
This commit is contained in:
@@ -2250,6 +2250,7 @@ function saveBtPeriod() {
|
||||
}
|
||||
|
||||
async function loadStrategyList() {
|
||||
window._stratScrollY = window.scrollY || 0; // 2026-08-18 触发渲染前保存滚动位置
|
||||
const listEl = document.getElementById('strategyList');
|
||||
try {
|
||||
const ptMap = {'1m':'1m','6m':'6m','1y':'1y','2y':'2y','5y':'5y','10y':'10y'};
|
||||
@@ -2467,6 +2468,8 @@ async function batchAvail(rg, available) {
|
||||
|
||||
function renderStrategyTable(strategies) {
|
||||
const el = document.getElementById('strategyList');
|
||||
// 2026-08-18 滚动兜底:重建前保存整页滚动位置
|
||||
if (window._stratScrollY == null) window._stratScrollY = window.scrollY || 0;
|
||||
if (!strategies.length) { el.innerHTML = '<div class="text-slate-500">暂无策略版本</div>'; return; }
|
||||
// 先算综合分(排序要用),再排序
|
||||
for (const s of strategies) {
|
||||
@@ -2921,6 +2924,8 @@ const renderRegimeRow = (s, rg, bkKey) => {
|
||||
}
|
||||
html += '<div class="text-xs text-slate-600 mt-2">总收益/最终资产 = 100万本金·最多10等分仓位·24个月组合模拟 · ⚠️样本<40笔 · 绿色=该列最优 · 悬停名称查看改进假设</div>';
|
||||
el.innerHTML = html;
|
||||
// 2026-08-18 恢复整页滚动位置(解决重建后滚动归零,老莫反馈)
|
||||
if (window._stratScrollY != null) { window.scrollTo(0, window._stratScrollY); window._stratScrollY = null; }
|
||||
}
|
||||
|
||||
async function runStrategyBacktest(version) {
|
||||
|
||||
Reference in New Issue
Block a user