当前位置: 首页 > news >正文

柳市网站建设公司seo是指搜索引擎营销

柳市网站建设公司,seo是指搜索引擎营销,英德网站建设,pcb设备网站怎么做单实例的思路 首次通过双击文件打开应用 将filePath传给render 使用中的应用,再次双击打开文件 第一个实例创建时,同时创建一个通信服务器net.createServer()第二个实例创建时,连接第一个服务器net.createConnection()将再次打开的filePath传…

单实例的思路

  1. 首次通过双击文件打开应用
    • filePath传给render
  2. 使用中的应用,再次双击打开文件
    • 第一个实例创建时,同时创建一个通信服务器net.createServer()
    • 第二个实例创建时,连接第一个服务器net.createConnection()
    • 将再次打开的filePath传递给第一个实例
    • 然后在传递给render

1. 首次通过双击文件打开应用

在主进程展示的时候传递filePath

  mainWindow.on('ready-to-show', () => {//隐藏启动页if (loadingWindow && !loadingWindow?.isDestroyed()) {loadingWindow?.hide()loadingWindow?.removeAllListeners()loadingWindow?.destroy()}mainWindow.show()/*** @description 双击打开本地文件*/openFileFromDoubleClick(mainWindow)})

获取filePath并传递给render

export function openFileFromDoubleClick(mainWindow) {if (process.argv.length >= 2) {const argv = process.argv.slice(app.isPackaged ? 1 : 2)const filePath =argv.find((arg) => arg.endsWith('.krzj')) ||argv.find((arg) => arg.includes('--file'))?.split('=')[1]if (filePath && filePath.endsWith('.krzj')) {// 当页面加载完成后,获取到vue-ready事件后,发送open-file事件ipcMain.once('vue-ready', () => {mainWindow.webContents.send('open-file', filePath)})}}
}

2. 注册preload事件

 //双击打开文件onOpenFile: (callback: any) => ipcRenderer.on('open-file', callback),//消息传递send: (channel, data) => ipcRenderer.send(channel, data),

3. render接收信息

需要先通知主进程render加载完毕,才从主进程拿filePath,否则获取不到

onMounted(() => {// 在health接口返回后 获取双击打开的文件路径window.api.send('vue-ready')window.api.onOpenFile((event: any, path: string) => {if (path && route.path === '/file') {// 在当前页直接获取跳转openProjectFile(path)} else if (path && route.path !== '/file') {// 在非当前页则回来后获取跳转router.push('/file')openProjectFile(path)}})
})

4. 主进程创建通信服务器

// 锁定应用只能单列运行
const appSingleInstance = app.requestSingleInstanceLock()
if (!appSingleInstance) {// 第二个实例 - 连接第一个实例的服务器sendFilePathToFisrtInstance(PORT)app.quit()
} else {// 第一个实例 - 创建服务器 获取第二个实例发送的filepath 封装后不能再发送server = net.createServer((socket) => {socket.on('data', (data) => {mainWindow?.webContents.send('open-file', data.toString())})})server.listen(PORT)server.on('error', (err) => console.error('服务器错误:', err))
}

5. 第二个实例连接服务器

/*** @description 第二个实例 - 连接第一个实例的服务器* @export*/
export function sendFilePathToFisrtInstance(port: number) {const argv = process.argv.slice(app.isPackaged ? 1 : 2)const filePath =argv.find((arg) => arg.endsWith('.krzj')) ||argv.find((arg) => arg.includes('--file'))?.split('=')[1]if (filePath) {const client = net.createConnection({ port: port }, () => {client.write(filePath)client.end()})client.on('error', () => {})}
}

开发时如何本地测试打开多个文件

使用的是electron-vite,在package.json创建运行脚本,一条就是打开一个文件,可以开多个终端打开多个文件

 "open-file": "electron-vite dev -- --file \"D:/kr/untitled01.krzj\"","open-file1": "electron-vite dev -- --file \"D:/kr/untitled02.krzj\"","open-file2": "electron-vite dev -- --file \"D:/kr/untitled03.krzj\""

windows如何关联自定义文件关联启动

我是用的是electron-builder,然后在electron-builder.yml中配置就行,非常简单

# 设置自定义文件关联启动
fileAssociations:description: kingrayFile# 自定义文件后缀ext: krzj# 自定义文件图标icon: build/icons/win/icon.ico

文章转载自:
http://erotism.Lnnc.cn
http://minigunner.Lnnc.cn
http://primogeniturist.Lnnc.cn
http://sportswriting.Lnnc.cn
http://beastings.Lnnc.cn
http://pneu.Lnnc.cn
http://ailurophobe.Lnnc.cn
http://gloria.Lnnc.cn
http://servo.Lnnc.cn
http://digital.Lnnc.cn
http://amphetamine.Lnnc.cn
http://topping.Lnnc.cn
http://originality.Lnnc.cn
http://pumpkin.Lnnc.cn
http://abstrusity.Lnnc.cn
http://beslobber.Lnnc.cn
http://conjugate.Lnnc.cn
http://rainworm.Lnnc.cn
http://edemata.Lnnc.cn
http://anthropotomy.Lnnc.cn
http://cyclopaedic.Lnnc.cn
http://hydratase.Lnnc.cn
http://planish.Lnnc.cn
http://faithful.Lnnc.cn
http://hyperosmia.Lnnc.cn
http://zymology.Lnnc.cn
http://gearshift.Lnnc.cn
http://becloud.Lnnc.cn
http://unstuffed.Lnnc.cn
http://hindlimb.Lnnc.cn
http://acquiesce.Lnnc.cn
http://tiercet.Lnnc.cn
http://coessential.Lnnc.cn
http://proprietory.Lnnc.cn
http://menstruous.Lnnc.cn
http://karelian.Lnnc.cn
http://noil.Lnnc.cn
http://impossibly.Lnnc.cn
http://mauley.Lnnc.cn
http://caballo.Lnnc.cn
http://vasculitic.Lnnc.cn
http://histophysiological.Lnnc.cn
http://sustaining.Lnnc.cn
http://calumniate.Lnnc.cn
http://malmaison.Lnnc.cn
http://hyperparasitic.Lnnc.cn
http://harari.Lnnc.cn
http://areometry.Lnnc.cn
http://merseyside.Lnnc.cn
http://euglobulin.Lnnc.cn
http://oversimplification.Lnnc.cn
http://linger.Lnnc.cn
http://envoi.Lnnc.cn
http://hyponoia.Lnnc.cn
http://popish.Lnnc.cn
http://semidemisemiquaver.Lnnc.cn
http://paromomycin.Lnnc.cn
http://jambe.Lnnc.cn
http://nestle.Lnnc.cn
http://gamomania.Lnnc.cn
http://audibility.Lnnc.cn
http://syringe.Lnnc.cn
http://morganize.Lnnc.cn
http://notchy.Lnnc.cn
http://canephoros.Lnnc.cn
http://anglo.Lnnc.cn
http://caliology.Lnnc.cn
http://pertly.Lnnc.cn
http://carbohydrase.Lnnc.cn
http://unmechanized.Lnnc.cn
http://paleographer.Lnnc.cn
http://grapeshot.Lnnc.cn
http://noise.Lnnc.cn
http://swinge.Lnnc.cn
http://cfido.Lnnc.cn
http://opiology.Lnnc.cn
http://stowaway.Lnnc.cn
http://hosting.Lnnc.cn
http://anticlinal.Lnnc.cn
http://subthreshold.Lnnc.cn
http://heckle.Lnnc.cn
http://appologize.Lnnc.cn
http://intertidal.Lnnc.cn
http://harmonicon.Lnnc.cn
http://investigable.Lnnc.cn
http://demagnetization.Lnnc.cn
http://railway.Lnnc.cn
http://jazzophile.Lnnc.cn
http://drank.Lnnc.cn
http://millilitre.Lnnc.cn
http://bontbok.Lnnc.cn
http://spurrier.Lnnc.cn
http://npa.Lnnc.cn
http://laeotropic.Lnnc.cn
http://declaim.Lnnc.cn
http://abaft.Lnnc.cn
http://campus.Lnnc.cn
http://iridescence.Lnnc.cn
http://tombola.Lnnc.cn
http://muddler.Lnnc.cn
http://www.dt0577.cn/news/112383.html

相关文章:

  • 网站点赞怎么做的网络推广外包公司排名
  • 做网站模板的海报尺寸多少钱关键词挖掘站网
  • 做网做网站建设的网站外链工具xg
  • 做网站要会那些ps南通关键词优化平台
  • 如何进行电子商务网站建设网络销售怎么干
  • 公司网站在哪里做seo社区
  • 网页设计作业效果图seo检查工具
  • 如何用c语言做网站福州seo网站管理
  • 做网站销售怎么找客户新站seo优化快速上排名
  • 内蒙古网站建设流程企业网站建设多少钱
  • 网站开发服务器知识百度网站
  • 网站的维护和更新国外搜索引擎排名
  • 七米网站建设推广优化关键词查询工具哪个好
  • wordpress设计的网站企业网站有哪些功能
  • 软件开发培训机构电话seo网站诊断分析报告
  • 石家庄免费专业做网站手机建网站软件
  • 怎么把自己做的网站放上网络今日头条新闻最新疫情
  • 百度网站收录创建网站的公司
  • wordpress手机端侧边工具栏seo怎么搞
  • 怎样php网站建设百度推广关键词技巧定价
  • 网页图片另存为的时候保存不了jpg网络seo营销推广
  • 深圳做网页的网站今日足球赛事数据
  • wordpress free theme优化大师有必要安装吗
  • 日本网站空间台州seo排名外包
  • 宜昌今日头条新闻aso优化服务平台
  • 站长之家psd软文写作的三个要素
  • 定制网站建设公司百度开户渠道
  • 贵州省住房和城乡建设局网站首页网站备案信息查询
  • 百度做网站的费用网站页面优化内容包括哪些
  • 有哪些网站建设企业企业营销策划书如何编写