feat ui设计稿bug修复
This commit is contained in:
36
tabs.js
Normal file
36
tabs.js
Normal file
@@ -0,0 +1,36 @@
|
||||
// @ts-nocheck
|
||||
// 逐页签量测:node tabs.js 生成一段 JS,在页面内点第 N 个页签后量测
|
||||
const TAB = Number(process.argv[2] || 0)
|
||||
const SELS = process.argv[3]
|
||||
? process.argv[3].split(',')
|
||||
: [
|
||||
'.project-detail__tabs',
|
||||
'.project-files__list',
|
||||
'.project-files__item',
|
||||
'.project-finance__title',
|
||||
'.project-finance__plans',
|
||||
'.project-finance__plan',
|
||||
'.project-finance__files',
|
||||
'.project-finance__file',
|
||||
'.project-after-sales__banner',
|
||||
'.project-after-sales__title',
|
||||
'.project-after-sales__field',
|
||||
'.project-after-sales__readonly',
|
||||
'.project-after-sales__actions',
|
||||
'.project-after-sales__btn',
|
||||
]
|
||||
|
||||
const js = `(async function(){
|
||||
const tabs = document.querySelectorAll(".project-detail__tab");
|
||||
if (${TAB} > 0 && tabs[${TAB} - 1]) { tabs[${TAB} - 1].click(); await new Promise(r => setTimeout(r, 900)); }
|
||||
const o = {};
|
||||
for (const s of ${JSON.stringify(SELS)}) {
|
||||
const list = document.querySelectorAll(s);
|
||||
o[s] = list.length === 0 ? null : Array.from(list).slice(0, 3).map(e => {
|
||||
const r = e.getBoundingClientRect();
|
||||
return [+r.x.toFixed(1), +r.y.toFixed(1), +r.width.toFixed(1), +r.height.toFixed(1)];
|
||||
});
|
||||
}
|
||||
return JSON.stringify(o);
|
||||
})()`
|
||||
console.log(js)
|
||||
Reference in New Issue
Block a user