(
url: string,
options: OpenInNewWindowOptions = {}
)
| 28 | * @param url 新窗口地址 |
| 29 | */ |
| 30 | export function openInNewWindow( |
| 31 | url: string, |
| 32 | options: OpenInNewWindowOptions = {} |
| 33 | ) { |
| 34 | const width = options.width ?? 414; |
| 35 | const height = options.height ?? 736; |
| 36 | const top = options.top ?? (window.screen.height - height) / 2; |
| 37 | const left = options.left ?? (window.screen.width - width) / 2; |
| 38 | |
| 39 | // 打开窗口 |
| 40 | const win = window.open( |
| 41 | url, |
| 42 | `tailwindow#${windowIndex++}`, |
| 43 | buildWindowFeatures({ |
| 44 | top, |
| 45 | left, |
| 46 | width, |
| 47 | height, |
| 48 | menubar: false, |
| 49 | toolbar: false, |
| 50 | location: false, |
| 51 | status: false, |
| 52 | resizable: true, |
| 53 | }) |
| 54 | ); |
| 55 | |
| 56 | return win; |
| 57 | } |
| 58 | |
| 59 | class PanelWindowManager { |
| 60 | private openedPanelWindows: Record<string, Window> = {}; |
no test coverage detected