* 捕获指定选择器的元素 * @param selector CSS 选择器(class 或 id) * @param options 截屏选项
(selector: string, options?: ScreenCaptureOptions)
| 115 | * @param options 截屏选项 |
| 116 | */ |
| 117 | async function capture(selector: string, options?: ScreenCaptureOptions): Promise<boolean> { |
| 118 | const element = document.querySelector(selector) as HTMLElement | null |
| 119 | if (!element) { |
| 120 | captureError.value = `未找到元素: ${selector}` |
| 121 | return false |
| 122 | } |
| 123 | return captureElement(element, options) |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * 捕获指定的 DOM 元素 |
nothing calls this directly
no test coverage detected