Files
Neo-ZQYY/_DEL/pixel-audit/POWER.md
2026-03-15 10:15:02 +08:00

44 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: "pixel-audit"
displayName: "H5→MP 像素测量与 rpx 换算"
description: "H5 页面结构化拆解、逐级元素测量、px→rpx 换算、偏差审计方法论。用于迁移前 H5 审计和迁移后双端对比。"
keywords: ["rpx", "间距测量", "measure", "像素", "pixel", "px", "换算", "Tailwind", "wxss", "间距", "gap", "spacing", "审计", "拆解", "映射表", "偏差"]
author: "NeoZQYY"
---
# H5→MP 像素测量与 rpx 换算
精确测量 H5 页面元素尺寸与间距,换算为小程序 rpx 值。
提供结构化拆解→逐级测量→偏差审计的完整方法论,指导 H5→MP 迁移和双端对比。
核心工具:
- `scripts/ops/measure_gaps.py`Playwright headless 测量)
- Playwright MCP `browser_evaluate`(等效 JS 测量)
## rpx 速查
```
精确公式rpx = ceil(px × 1.7442 / 2) × 2
简化心算rpx ≈ px × 2 × 0.875 取偶6px/14px 处有 2rpx 偏差)
圆角border-radius = px × 2
2→4 4→8 6→12 8→14 10→18 12→22
14→26 16→28 20→36 24→42 28→50 32→56
```
## 偏差判定标准
| rpx 偏差 | 级别 | 处理 |
|----------|------|------|
| ≤ 2rpx | 通过 | 无需修正 |
| > 2rpx 且 ≤ 4rpx | 警告P4-P7 | 像素级精调 |
| > 4rpx | 不通过P0-P3 | 必须修正 |
## Steering
| 文件 | 内容 |
|------|------|
| `measure.md` | 结构化拆解方法论、H5 审计映射表、逐级测量流程、偏差审计规则、rpx 换算公式与速查表、measure_gaps.py 用法、MP 反向验证 |
加载:激活 Power → `readSteering("measure.md")`