[Electron] Use vue-electron+electron-store to create a project, and NSIS is packaged as an exe installable file

[Electron Configuration Documentation] https://www.electronjs.org/docs/api/browser-window

1、electron-vue

vue init simulatedgreg/electron-vue my-project

// 安装依赖请使用npm,yarn会出现未知的错误,可以改为cnpm或改为淘宝镜像
npm install cnpm -g --registry=http://registry.npm.taobao.org

You can have a vue-loader's webpack, electron-packager or electron-builder, and some of the most commonly used plug-ins, such as vue-router, vuex and other scaffolding.

2. Electron data storage electron-store

npm install [email protected]
or
yarn add [email protected]
// 注意,高版本会有问题


// 使用方式
const Store = require('electron-store');

const store = new Store();
//如果需要加密存储 就用下面的
store.set('unicorn', {
   test: {
        test001: '8888',
        test001A: {
          test002: '6565656',
        },
      },
});
console.log(store.get('unicorn')); //=> '这是需要存储的内容'

// Use dot-notation to access nested properties
store.set('foo.bar', true);
console.log(store.get('foo')); //=> {bar: true}

// store.delete('unicorn');
console.log(store.get('unicorn'));

File storage path: C:\Users\mi\AppData\Roaming\__proNane__\config.json
( __proNane__ project name)

3. Use NSIS to package as an installable exe file, refer to the link below

https://blog.csdn.net/yu17310133443/article/details/79496499

Note: You may encounter many uncertain problems during the project start-up process. Baidu, it is basically OK, record it

 

 

Guess you like

Origin blog.csdn.net/qq_23334071/article/details/115044772