代码拉取完成,页面将自动刷新
/**
* This file is loaded via the <script> tag in the index.html file and will
* be executed in the renderer process for that window. No Node.js APIs are
* available in this process because `nodeIntegration` is turned off and
* `contextIsolation` is turned on. Use the contextBridge API in `preload.js`
* to expose Node.js functionality from the main process.
*/
const ipcRenderer = require('electron').ipcRenderer;
ipcRenderer.on('cs-ready', (e, msg) => {
console.log("ChildProcess isOpen: " + msg);
// alert("ChildProcess isOpen: " + msg)
document.getElementById('recivemsg').value = msg
})
document.getElementById("open").addEventListener("click",() =>{
console.log("open");
ChildProcess(true)
});
document.getElementById("close").addEventListener("click", () => {
console.log("open");
ChildProcess(false)
});
document.getElementById("open").onclick = () => {
console.log("open");
ChildProcess(true)
};
function ChildProcess(isOpen) {
//发消息,有html的按钮调用,给主进程发消息,回调中关闭进程
console.log("ChildProcess isOpen: " + isOpen);
// alert("ChildProcess isOpen: " + isOpen)
var appname = "";
if (isOpen) {
appname = document.getElementById('txt_exe').value;
ipcRenderer.send('open-child-now', appname)
console.log("open-called-now");
} else {
ipcRenderer.send('kill-child-now', appname)
console.log("close");
}
}
const btn = document.getElementById('btn')
const filePathElement = document.getElementById('filePath')
btn.addEventListener('click', async () => {
console.log("打开");
console.log(123);
alert('dianji')
const filePath = await window.electronAPI.openFile()
filePathElement.innerText = filePath
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。