ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
本部分内容为慕课网课程[《Electron + React + 七牛云...》](https://coding.imooc.com/learn/list/384.html)学习笔记,相关参考文献地址如下: - [Electron 官网](https://www.electronjs.org/) - [concurrently ](https://www.npmjs.com/package/concurrently) - [wait-on](https://www.npmjs.com/package/wait-on) - [react-fontawesome](https://github.com/FortAwesome/react-fontawesome) - [Bootstrap](https://www.bootcss.com/) - [classNames](https://github.com/JedWatson/classnames) - [uuid](https://github.com/uuidjs/uuid) - [easy-markdown](https://github.com/RIP21/react-simplemde-editor) ## 要点记录 1、调试 Windows 快捷键:ctrl+shift+i Mac 快捷键:command+option+i <br/> 2、使用 node.js 原生模块(create-react-app),将 require 改成 window.require [https://github.com/electron/electron/issues/7300](https://github.com/electron/electron/issues/7300) <br/> 3、node.js 10+ 支持 API 的 Promise 化, ```js const fs = require('fs').promises // node10+ const path = require('path') const fileHelper = { readFile: (path) => { return fs.readFile(path, { encoding: 'utf8' }) }, writeFile: (path, content) => { return fs.writeFile(path, content, { encoding: 'utf8' }) } } fileHelper.readFile(testPath).then(data => { console.log(data) }) fileHelper.writeFile(testWritePath, '## hello world').then(() => { console.log('写入成功') }) ``` <br/> 4、持久化解决方案 - electron-store [https://github.com/sindresorhus/electron-store](https://github.com/sindresorhus/electron-store)