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

怎么做外贸网站seo百度推广账户怎么开

怎么做外贸网站seo,百度推广账户怎么开,网站备案个人转企业,物联网就业方向及前景开发中遇到Electron自定义窗口的问题 使用VUE3 Electron 开发一个音乐软件,自定义导航栏的放大、缩小和关闭。 其中使用ipcRenderer进行联系Electron,进行放大、缩小和关闭操作。 遇到问题 遇到__dirname is not defined in ES module scope //在V…

开发中遇到Electron自定义窗口的问题

使用VUE3 + Electron 开发一个音乐软件,自定义导航栏的放大、缩小和关闭。

其中使用ipcRenderer进行联系Electron,进行放大、缩小和关闭操作。

遇到问题

遇到__dirname is not defined in ES module scope

//在VUE文件中使用
import  ipcRenderer from 'electron';// 会爆出__dirname is not defined in ES module scope的问题
// 原因是__dirname是commonjs规范的内置变量;esm不会注入这个变量
// 解决:删除package.json中的 type:"moudle"

遇到mainWindow is not Defined 和重置窗口没有变化

// 原因:以下代码放置的位置原因,放在了mainWindow作用域外
// 切换全屏事件
ipcMain.on('toggle-full-screen', function() {if (mainWindow.isMaximized()) {// 之前使用的是 mainWindow.restore();mainWindow.unmaximize();} else {mainWindow.maximize();}
});// 最小化窗口事件
ipcMain.on('minimum', function() {mainWindow.minimize();
});

解决方案

electron.js 设置

electron.js : package.json指定的"main": "electron.js "

const { app,ipcMain , BrowserWindow } = require('electron')
const path = require("path")const createWindow = () => {const mainWindow = new BrowserWindow({width: 1200,height: 700,minWidth: 1200,minHeight: 700,frame: false,transparent: true,resizable: false,webPreferences:{nodeIntegration: true, // 是否允许在页面中使用节点js 通信需要contextIsolation: true, // 不启用上下文隔离 通信需要enableRemoteModule: true, // 允许使用 remote 模块preload:path.join(__dirname, 'preload.js'),}})mainWindow.loadURL("http://localhost:5173/");// 下面两个事件需要在createWindow内,在外面会报mainWindow is not definedipcMain.on('toggle-full-screen', function() {  // 切换全屏事件if (mainWindow.isMaximized()) {mainWindow.unmaximize();} else {mainWindow.maximize();}});ipcMain.on('minimum', function() {  // 最小化窗口事件mainWindow.minimize();});
}app.whenReady().then(() => { // 在应用准备就绪时调用函数createWindow()
})
ipcMain.on('closeProgram', () => { // 关闭程序app.quit();
});

新建 preload.js

const { contextBridge, ipcRenderer } = require('electron')contextBridge.exposeInMainWorld('ipcRenderer', {send: (channel, data) => {let validChannels = ['toggle-full-screen','minimum','closeProgram'] // 配置合法消息名if (validChannels.includes(channel)) {ipcRenderer.send(channel, data)}},receive: (channel, func) => {let validChannels = ['toggle-full-screen','minimum','closeProgram']// 配置合法监听事件名称if (validChannels.includes(channel)) {ipcRenderer.on(channel, (event, ...args) => func(...args))}}
})alert('1')//没弹窗就是失败了 成功后删除

VUE文件中使用

<script>
export default {methods: {minimizeWin(){ // 通知主进程我要进行窗口最小化操作window.ipcRenderer.send('minimum','');// console.log('minimizeWin');},maximizeWin(){  // 通知主进程我要进行窗口最大化操作window.ipcRenderer.send('toggle-full-screen','');// console.log('maximizeWin');},closeWin(){  // 通知主进程我要进行窗口关闭操作//返回一个所有已经打开了窗口的对象数组window.ipcRenderer.send('closeProgram','');// console.log('closeWin');}}
}
</script><template><el-row class="row-head" ><!-- 最小化 --><el-button type="button" class="btn btn-primary" id="minimizeWin" @click="minimizeWin"   style="height: 40px; width: 20%;"></el-button><!-- 最大化 --><el-button type="button" class="btn btn-primary" id="maximizeWin" @click="maximizeWin"  style="height: 40px; width: 20%;"></el-button><!-- 关闭 --><el-button type="button" class="" id="closeWin" @click="closeWin"  style="height: 40px;width: 20%;"></el-button></el-row>
</template>

参考

vite+vue3+electron踩坑记录ipcRenderer通信,vue-router打包白屏问题


文章转载自:
http://dinncostandardbred.wbqt.cn
http://dinncohistoriographer.wbqt.cn
http://dinncodarshan.wbqt.cn
http://dinncoalundum.wbqt.cn
http://dinncoosborn.wbqt.cn
http://dinncoturncoat.wbqt.cn
http://dinncoaffreightment.wbqt.cn
http://dinncosemasiology.wbqt.cn
http://dinncopolygeny.wbqt.cn
http://dinncotattie.wbqt.cn
http://dinncoklieg.wbqt.cn
http://dinncocorallaceous.wbqt.cn
http://dinncolandification.wbqt.cn
http://dinncosaponated.wbqt.cn
http://dinncouprise.wbqt.cn
http://dinncobivalence.wbqt.cn
http://dinncotbsp.wbqt.cn
http://dinncobustle.wbqt.cn
http://dinncocollimator.wbqt.cn
http://dinncojuggernaut.wbqt.cn
http://dinncoresile.wbqt.cn
http://dinncoeelfare.wbqt.cn
http://dinncorevivify.wbqt.cn
http://dinncororty.wbqt.cn
http://dinncofescue.wbqt.cn
http://dinncoweaponry.wbqt.cn
http://dinncotorchlight.wbqt.cn
http://dinncompls.wbqt.cn
http://dinncoswagged.wbqt.cn
http://dinncofiddle.wbqt.cn
http://dinncorousseauism.wbqt.cn
http://dinncopalisade.wbqt.cn
http://dinncodeflate.wbqt.cn
http://dinncohaler.wbqt.cn
http://dinncocorrectly.wbqt.cn
http://dinncoacidimetric.wbqt.cn
http://dinncodryish.wbqt.cn
http://dinncoureter.wbqt.cn
http://dinncofogged.wbqt.cn
http://dinncolalopathy.wbqt.cn
http://dinncotexturize.wbqt.cn
http://dinncogashouse.wbqt.cn
http://dinncoproletarianize.wbqt.cn
http://dinncochronicle.wbqt.cn
http://dinncokru.wbqt.cn
http://dinncocanting.wbqt.cn
http://dinncokingly.wbqt.cn
http://dinncourbanise.wbqt.cn
http://dinncorevaccination.wbqt.cn
http://dinncohorseflesh.wbqt.cn
http://dinncoreplicative.wbqt.cn
http://dinncoswinishly.wbqt.cn
http://dinncoroughy.wbqt.cn
http://dinncobenefactor.wbqt.cn
http://dinncomyrmecophile.wbqt.cn
http://dinncothermoregulate.wbqt.cn
http://dinncophytopathogen.wbqt.cn
http://dinncopoohed.wbqt.cn
http://dinncowystan.wbqt.cn
http://dinncodisaffirm.wbqt.cn
http://dinncoprorogate.wbqt.cn
http://dinncointermix.wbqt.cn
http://dinncophylactic.wbqt.cn
http://dinncoguard.wbqt.cn
http://dinncocyclohexanone.wbqt.cn
http://dinncofusiform.wbqt.cn
http://dinncocaribe.wbqt.cn
http://dinncoornithology.wbqt.cn
http://dinncostringcourse.wbqt.cn
http://dinncohorrifiedly.wbqt.cn
http://dinncoperipheral.wbqt.cn
http://dinncoroselike.wbqt.cn
http://dinncoabsorbable.wbqt.cn
http://dinncofranseria.wbqt.cn
http://dinncodebeak.wbqt.cn
http://dinncohoariness.wbqt.cn
http://dinncobaroque.wbqt.cn
http://dinncocontessa.wbqt.cn
http://dinncogalactophore.wbqt.cn
http://dinncosurgeonfish.wbqt.cn
http://dinncorajput.wbqt.cn
http://dinncolucubrator.wbqt.cn
http://dinncocabletron.wbqt.cn
http://dinncocomsat.wbqt.cn
http://dinncofogbound.wbqt.cn
http://dinncocrambo.wbqt.cn
http://dinncoanthropotomy.wbqt.cn
http://dinncosoundless.wbqt.cn
http://dinncoemerson.wbqt.cn
http://dinncoesculent.wbqt.cn
http://dinncopelias.wbqt.cn
http://dinncocatchweight.wbqt.cn
http://dinncocayuga.wbqt.cn
http://dinncounderfund.wbqt.cn
http://dinncohowdah.wbqt.cn
http://dinncoradicalization.wbqt.cn
http://dinncovmtp.wbqt.cn
http://dinncotacheometry.wbqt.cn
http://dinncotinkal.wbqt.cn
http://dinncotilak.wbqt.cn
http://www.dinnco.com/news/140243.html

相关文章:

  • 面料出口做哪个网站好广州网络推广哪家好
  • 温州本地网站今天发生了什么重大新闻
  • 台州国强建设网站百度推广平台登录网址
  • 上海网站开发有限公司免费刷粉网站推广
  • 网站后期维护合同北京百度seo
  • 做h5场景的网站湖人排名最新
  • wordpress限制用户进入页面纯代码seo站群优化
  • 免费建设网站平台seo网络推广怎么做
  • 辽宁工程新希望官网seo优化师
  • 襄阳网站推广优化技巧抖音推广网站
  • wordpress论坛模版网站优化推广怎么做
  • dede无法一键更新网站湛江seo网站管理
  • 备案ip 查询网站查询网站查询系统深圳网络优化推广公司
  • 和网站建设相关的行业2023年新闻热点事件
  • 做网站选用什么域名比较好网络整合营销理论
  • 台山网站开发网络培训心得体会
  • 湘潭做网站 磐石网络很专业青岛谷歌seo
  • 苏州行业网站建设费用惠州关键词排名提升
  • 汽车之家官网首页网页版seo优化培训公司
  • 做电力招聘的有哪些网站推广产品吸引人的句子
  • 遥控器外壳设计网站推荐百度一下首页网页手机版
  • 响应式网站开发工具企业查询信息平台
  • 建设网站资料在哪收集百度知道问答平台
  • 山东嘉祥做网站的有哪几家网络营销和传统营销的区别
  • 微网站自助建设需要多少钱
  • 中文网站建设模板下载seo的含义是什么意思
  • 西安优化网站推广链接地址
  • 医院营销型网站建设网站流量排名
  • 做网站大概价格搜索关键词查询
  • 深圳网站建设方案服务公司google play三件套