01 2022 档案
摘要:const Store = require('electron-store') const { v4: uuidv4 } = require('uuid'); const path = require('path') class DataStore extends Store { construct
阅读全文
摘要:exports.$ = (id) => { return document.getElementById(id) } exports.convertDuration = (time) => { // 计算分钟 02 020 const minutes = "0" + Math.floor(time/
阅读全文
摘要:封装公共窗口 class AppWindow extends BrowserWindow { constructor(config,fileLocation){ const baseConfig = { width: 800, height: 600, webPreferences: { nodeI
阅读全文
摘要:// 自动打开调试窗口 mainWindow.webContents.openDevTools()
阅读全文
摘要:npm i nodemon --save-dev 修改启动命令 "scripts": { "start": " nodemon --watch main.js --exec electron ." },
阅读全文
摘要:// 打开外部跳转链接 var { shell } = require('electron') var aHref = this.document.querySelector('#aHref') aHref.onclick = function(e){ e.preventDefault() var
阅读全文
摘要:const {remote} = require('electron') var rightTemplate = [ { label:"粘贴" , accelerator:'ctrl+c', // 增加快捷键 }, { label:"复制", accelerator:'ctrl+v', // 增加快
阅读全文
摘要:底部通知消息 <body> <button id="notifyBtn">通知消息</button> </body> <script> var notifyBtn = document.getElementById('notifyBtn') var option = { title:'小二,来订单了
阅读全文
摘要:// 绑定全局快捷键 globalShortcut.register('ctrl+e',()=>{ mainWindow.loadURL('http://baidu.com/') }) // 判断是否绑定快捷键 let isRegister = globalShortcut.isRegistered
阅读全文
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="wi
阅读全文
摘要:const dbRequest = indexedDB.open('Eric') dbRequest.onerror = function(err){ console.log('打开数据库失败~'); } let db = null dbRequest.onsuccess = function(ev
阅读全文
摘要:class EricCache{ constructor(isLocal = true){ this.stroage = isLocal ? localStorage : sessionStorage } setItem(key,value){ if(value){ this.stroage.set
阅读全文
摘要:// 1 写入 cookie // document.cookie = 'username=zs' // document.cookie = 'age=18' // 读取cookie (读取的是全部的cookie) // console.log(document.cookie); // userna
阅读全文

浙公网安备 33010602011771号