| 1234567891011121314151617 |
- /**
- * SSR 入口(只用于**对拍**,不是交付页面):给定与现网同一个 `/api/fleet` 数据,
- * 把工作台某页签渲染成 HTML 字符串,供 `tools/render_parity.mjs` 与重构前页面逐项比对。
- *
- * 为什么用 SSR 对拍:命令行里没有浏览器;SSR 走的正是同一套 Vue 组件与同一批渲染口径函数,
- * 能把"呈现一致"变成可自动判定的事实(文案/数值/类名序列/台号序列)。
- */
- import { createSSRApp } from 'vue'
- import { renderToString } from 'vue/server-renderer'
- import Workbench from './views/Workbench.vue'
- export async function renderTab(d: any, tab = 'overview', sub?: string | null, cms?: any, curves?: any, apis?: any): Promise<string> {
- // sub:页签内的**子视图**(如 vibration 的 matrix/loop/units/events/cms),对拍时两侧要给同一个
- // cms:cms 子视图按需异步取的数据(对拍时由对拍脚本提供,保证两侧同源)
- const app = createSSRApp(Workbench, { d, tab, sub: sub ?? null, cms: cms ?? null, curves: curves ?? null, apis: apis ?? null })
- return await renderToString(app)
- }
|