[electron Vue] – management of global variables

Time:2020-8-16

Using electron Vue as a project involves three levels of global variables:

[1] Global variables of electron
[2] Global variables of HTML
[3] Global variable vuex of Vue

How to distinguish the definitions of these three levels of variables? For example, if you have a new global variable to be defined, where is the definition?

Regardless of business logic, you need to distinguish between the three global variablesScope

[electron Vue] - management of global variables

Therefore, the use principle is as follows:

1. Considering the minimum pollution range of the scope, if there is no communication between the main process and the rendering process, it should not be defined as the global variable of electron;

2. If you want to use the bidirectional binding function of data, of course, only vuex can choose;