fix(runtime): onGenerateRoute pathElements 越界 RangeError

- buy-service/renew-minioffice 加长度检查 (pathElements.length >= 4/3)
- 根因: Flutter web 深链接渐进式路径解析, onGenerateRoute 被调用多次,
  pathElements 递增 ([,buy-service] -> [,buy-service,1] -> 完整),
  前几次路径短但 pathElements[1]已匹配 -> int.parse([2])/[3] 越界
- 直接访问/刷新 /buy-service/x/y, /renew-minioffice/x 时崩溃
- 恢复 buy_service 实验代码 (data 校验 + mounted 保留)
This commit is contained in:
2026-08-02 00:13:33 +08:00
parent af8934fe7f
commit 901e42a41b
13 changed files with 192 additions and 5 deletions

13
tools/e2e/diag_deep.js Normal file
View File

@@ -0,0 +1,13 @@
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch({ headless: true });
const page = await (await browser.newContext({viewport:{width:1280,height:900}})).newPage();
const logs = [];
page.on('console', m => logs.push(m.text()));
await page.goto('http://127.0.0.1:8099/buy-service/1/ministore', { waitUntil: 'load' }).catch(()=>{});
await page.waitForTimeout(7000);
const ctx = logs.filter(l => l.startsWith('CK_CTX'));
if (ctx.length) console.log(ctx[0].slice(0, 600));
else console.log('无 CK_CTX');
await browser.close();
})();