()
| 10 | * 挂载选词翻译组件 |
| 11 | */ |
| 12 | export function mountSelectionTranslator() { |
| 13 | // 如果已存在实例或配置禁用了此功能,则不创建 |
| 14 | if (selectionTranslatorInstance || config.disableSelectionTranslator || config.selectionTranslatorMode === 'disabled') { |
| 15 | return; |
| 16 | } |
| 17 | |
| 18 | // 创建容器元素 |
| 19 | const container = document.createElement('div'); |
| 20 | container.id = 'fluent-read-selection-translator-container'; |
| 21 | document.body.appendChild(container); |
| 22 | |
| 23 | // 创建Vue应用实例 |
| 24 | app = createApp(SelectionTranslator); |
| 25 | |
| 26 | // 挂载应用 |
| 27 | selectionTranslatorInstance = app.mount(container); |
| 28 | |
| 29 | return selectionTranslatorInstance; |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * 卸载选词翻译组件 |
no outgoing calls
no test coverage detected