# preload.js
window.exports = {
"main": {
mode: "none",
args: {
enter: () => {
const ubWindow = utools.createBrowserWindow(
"index.html",
{
show: false,
title: "测试窗口",
webPreferences: {
preload: "preload.js",
},
},
() => {
// 显示
ubWindow.show();
}
);
},
},
},
"list": {
mode: "list",
args: {
enter: (action, callbackSetList) => {
callbackSetList([
{
title: "这是标题",
description: "这是描述",
},
])
},
search: (action, searchWord, callbackSetList) => {
callbackSetList([
{
title: "这是标题",
description: "这是描述",
},
])
},
select: (action, itemData, callbackSetList) => {
window.utools.hideMainWindow()
const url = itemData.url
require('electron').shell.openExternal(url)
window.utools.outPlugin()
},
// 子输入框为空时的占位符,默认为字符串"搜索"
placeholder: "搜索",
},
},
};
我尝试过使用 utools.createBrowserWindow
. 这个会额外新开一个窗口,不是我想要的。