-
Notifications
You must be signed in to change notification settings - Fork 104
Update plugin ZTools 提供商 v1.0.1 #308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <!doctype html> | ||
| <html lang="zh-CN"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>截图识别结果</title> | ||
| </head> | ||
| <body> | ||
| <div id="app"></div> | ||
| <script type="module" src="/src/screenOcrResult.ts"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { createApp } from 'vue' | ||
| import ZToolsUI from 'ztools-ui' | ||
| import 'ztools-ui/style' | ||
| import { useZtoolsTheme } from 'ztools-ui' | ||
| import './main.css' | ||
| import ScreenOcrResult from './views/ScreenOcrResult.vue' | ||
|
|
||
| // 结果展示窗口入口(由 ztools.createBrowserWindow 打开)。 | ||
| // | ||
| // 与主窗口的区别:该窗口由 createBrowserWindow 创建,**不带 preload**, | ||
| // 也没有可靠的 window.ztools API(子窗口未必注入)。因此窗口只做展示—— | ||
| // 主窗口在外层完成「截图 + OCR 识别」后,通过 webContents.executeJavaScript | ||
| // 把识别结果(imageSrc + lines + isDark)注入到本窗口。 | ||
| // | ||
| // 注入方式:主窗口调用 executeJavaScript('window.__loadScreenOcrResult({...})')。 | ||
| // 本入口在挂载后挂载 window.__loadScreenOcrResult,并把数据交给组件渲染。 | ||
|
|
||
| // useZtoolsTheme 在无 window.ztools 时会优雅降级(不报错),主题以注入的 isDark 为准。 | ||
| useZtoolsTheme() | ||
|
|
||
| const app = createApp(ScreenOcrResult) | ||
| app.use(ZToolsUI) | ||
| app.mount('#app') |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
每次调用
pluginLogoDataUrl都会进行同步文件读取 (fs.readFileSync),而每次调用pluginLogoNativeImage都会重新创建NativeImage对象。由于插件图标在运行期间不会改变,建议对这两个方法的结果进行缓存,以避免不必要的磁盘 I/O 和内存开销。