UI调整优化

This commit is contained in:
24kycj
2025-12-08 12:53:59 +08:00
parent bcd5a1bd5e
commit da96181efa
25 changed files with 44894 additions and 13693 deletions
+19 -2
View File
@@ -1,5 +1,6 @@
// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
const { ipcRenderer } = require('electron')
// 1. 显示版本号逻辑 (保持不变)
window.addEventListener('DOMContentLoaded', () => {
const replaceText = (selector, text) => {
const element = document.getElementById(selector)
@@ -10,3 +11,19 @@ window.addEventListener('DOMContentLoaded', () => {
replaceText(`${type}-version`, process.versions[type])
}
})
// 2. 修正:直接挂载到 window 对象
// 因为你的 main.js 中 contextIsolation: false,所以直接赋值即可
window.sysAPI = {
// 读取历史记录
readHistory: () => ipcRenderer.invoke('history:read'),
// 写入历史记录
writeHistory: (data) => ipcRenderer.invoke('history:write', data),
// 读取任意 JSON 文件
readJsonFile: (filePath) => ipcRenderer.invoke('file:read-json', filePath),
//获取软件版本
getAppVersion: () => ipcRenderer.invoke('app:get-version')
};