20260820223837

This commit is contained in:
oneao committed 2026-08-20 22:38:37 +08:00
1 parent 68ac5db038
commit 45854b0570
48 files changed
+7545 -650

No files matched your search

@@ -0,0 +1,50 @@
import { chromium } from 'playwright-core'
const BASE = 'http://localhost:5082'
const browser = await chromium.launch({
headless: true,
executablePath: `${process.env.LOCALAPPDATA}\\ms-playwright\\chromium-1232\\chrome-win64\\chrome.exe`,
})
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } })
await page.addInitScript(() => {
sessionStorage.setItem('fms-login', JSON.stringify({ loginInfo: { token: 'dev-token', user: { id: 1, name: 'dev', account: 'g3soft' } } }))
localStorage.setItem('fms-user', JSON.stringify({ userInfo: { orgId: 'G3HD', account: 'g3soft' } }))
})
await page.route('**/api/**', (route) => route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ code: 0, data: null }) }))
await page.goto(`${BASE}/file-demo`, { waitUntil: 'networkidle', timeout: 30000 })
await page.waitForTimeout(3000)
// Walk all component instances and dump those whose subTree contains .fms-splitter-panel
const result = await page.evaluate(() => {
const out = []
const seen = new Set()
function walk(instance, depth) {
if (!instance || seen.has(instance)) return
seen.add(instance)
const typeName = instance.type?.__name || instance.type?.name || '(anon)'
const sub = instance.subTree
let hasPanel = false
let propsCopy = null
const visit = (v) => {
if (!v) return
if (typeof v.type === 'object' && v.type?.__name === 'SplitterPanel') hasPanel = true
if (Array.isArray(v.children)) v.children.forEach(visit)
else if (v.children && typeof v.children === 'object' && !v.component) visit(v.children)
if (v.component) walk(v.component, depth + 1)
}
if (sub) visit(sub)
// capture all refs to splitter panel instances
if (hasPanel) {
propsCopy = instance.props ? { ...instance.props } : null
out.push({ typeName, depth, props: propsCopy, keys: instance.props ? Object.keys(instance.props) : [] })
}
}
const app = document.querySelector('#app')?.__vue_app__
walk(app?._instance, 0)
return out
})
console.log(JSON.stringify(result, null, 2))
await browser.close()