* 捕获当前页面的主内容区域 * 优先查找 .main-content 标记的实际内容区域 * @param options 截屏选项
(options?: ScreenCaptureOptions)
| 495 | * @param options 截屏选项 |
| 496 | */ |
| 497 | async function capturePage(options?: ScreenCaptureOptions): Promise<boolean> { |
| 498 | // 优先查找标记了 .main-content 的实际内容区域 |
| 499 | // 这是页面截屏的标准约定,详见 .docs/rules.md |
| 500 | const mainContent = |
| 501 | document.querySelector('.main-content') || |
| 502 | document.querySelector('main .overflow-y-auto') || |
| 503 | document.querySelector('main') |
| 504 | |
| 505 | if (!mainContent) { |
| 506 | captureError.value = '未找到可截屏的页面区域' |
| 507 | return false |
| 508 | } |
| 509 | |
| 510 | return captureElement(mainContent as HTMLElement, options) |
| 511 | } |
| 512 | |
| 513 | return { |
| 514 | /** 是否正在截屏 */ |
nothing calls this directly
no test coverage detected