CN111858314B - Method, system, equipment and medium for state management of vue - Google Patents

Method, system, equipment and medium for state management of vue Download PDF

Info

Publication number
CN111858314B
CN111858314B CN202010594869.9A CN202010594869A CN111858314B CN 111858314 B CN111858314 B CN 111858314B CN 202010594869 A CN202010594869 A CN 202010594869A CN 111858314 B CN111858314 B CN 111858314B
Authority
CN
China
Prior art keywords
state management
local
local state
management file
global
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010594869.9A
Other languages
Chinese (zh)
Other versions
CN111858314A (en
Inventor
安立斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202010594869.9A priority Critical patent/CN111858314B/en
Publication of CN111858314A publication Critical patent/CN111858314A/en
Application granted granted Critical
Publication of CN111858314B publication Critical patent/CN111858314B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3636Software debugging by tracing the execution of the program
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3628Software debugging of optimised code

Abstract

The invention discloses a method, a system, equipment and a storage medium for state management of vue, wherein the method comprises the following steps: creating a global state management file and a plurality of local state management files, and judging whether the current state is global state management or local state management based on the service type; responding to the fact that the current state is the global state management, starting a global state management file and judging whether a local state management file needs to be added or not; responding to the local state management file needing to be added, matching the corresponding local state management file through a regular expression, and adding the name of the corresponding local state management file into the global state management file; and monitoring the state value, responding to the change of the state value, and correspondingly changing the page in vue based on the current state and the state value.

Description

Method, system, equipment and medium for state management of vue
Technical Field
The present invention relates to the field of state management, and more particularly, to a method, a system, a computer device, and a readable medium for state management of vue.
Background
Today, vue frames have become the front-end preferred frame for most companies. Vuex, as an official Vue framework state management plug-in, has undoubtedly become the first choice for many companies and independent developers. Vuex, while helping us to achieve state management, also increases the cost of development and project complexity. Moreover, the state related information of all the service modules is closed, the global environment of the system is polluted, the project operation loading burden is increased, the page loading speed is reduced, and the file size (aiming at SPA) after the project is packed is increased. If a very large amount of state information exists in a project, we need to maintain it. Certainly Vuex may be your preferred solution. As it can be installed ready for use. There may be only a few status data in many projects that need to be maintained or that are extremely aggressive in pursuit of system performance. At this time, if Vuex is to be used, the problem cannot be solved, but is aggravated, and the project complexity is increased.
Disclosure of Invention
In view of this, an object of the embodiments of the present invention is to provide a method, a system, a computer device, and a computer readable storage medium for state management of vue, where the state management of Vue is implemented by data monitoring, which not only reduces development cost and project complexity, but also avoids global environment pollution caused by all states of all service modules being thrown to the global, reduces loading burden, increases loading speed, and reduces file size after project packing; moreover, each service module is reasonably separated by codes, and the state management of each service module is under its own role without mutual interference; meanwhile, the horizontal expansion capability of state management is enhanced, and repeated modification on codes due to increase and decrease of service modules is not needed. Finally, the separation of state management, the automation of loading, the reduction of the file volume after the project packaging and the optimization of rendering and loading are realized.
In view of the above, an aspect of the embodiments of the present invention provides a method for state management of vue, including the following steps: creating a global state management file and a plurality of local state management files, and judging whether the current state is global state management or local state management based on the service type; responding to the fact that the current state is the global state management, starting the global state management file and judging whether a local state management file needs to be added or not; responding to the need of adding the local state management file, matching the corresponding local state management file through a regular expression, and adding the name of the corresponding local state management file into the global state management file; and monitoring the state value, responding to the change of the state value, and correspondingly changing the page in vue based on the current state and the state value.
In some embodiments, the creating the global state management file and the local state management file comprises: and naming the global state management file and the local state management file respectively by adopting different naming rules.
In some embodiments, further comprising: and in response to the fact that the local state management file does not need to be added, mounting the global state management file to a global object, and acquiring global state management data through the global object.
In some embodiments, further comprising: and in response to the current state being local state management, starting the local state management file and judging whether other local state management files need to be added.
In some embodiments, further comprising: and acquiring the local state management data in response to no need of adding other local state management files.
In some embodiments, further comprising: and responding to the requirement of adding other local state management files, and matching the corresponding other local state management files according to the regular expression.
In some embodiments, further comprising: judging whether the local state management file and the other local state management files can be mutually called or not; and in response to the local state management file and the other local state management files being able to be mutually invoked, merging the local state management file and the other local state management files.
In another aspect of the embodiments of the present invention, a system for performing state management on vue is further provided, including: the creating module is configured to create a global state management file and a plurality of local state management files and judge whether the current state is global state management or local state management based on the service type; the global module is configured to respond to the fact that the current state is global state management, start the global state management file and judge whether a local state management file needs to be added or not; the execution module is configured to respond to the local state management file needing to be added, match the corresponding local state management file through a regular expression and add the name of the corresponding local state management file into the global state management file; and the monitoring module is configured to monitor the state value, respond to the change of the state value, and correspondingly change the page in vue based on the current state and the state value.
In another aspect of the embodiments of the present invention, there is also provided a computer device, including: at least one processor; and a memory storing computer instructions executable on the processor, the instructions when executed by the processor implementing the steps of the method as above.
In a further aspect of the embodiments of the present invention, a computer-readable storage medium is also provided, in which a computer program for implementing the above method steps is stored when the computer program is executed by a processor.
The invention has the following beneficial technical effects: the Vue state management is realized through data monitoring, so that the development cost and the project complexity are reduced, the pollution of the global environment caused by the fact that the states of all service modules are all thrown to the global environment is avoided, the loading burden is reduced, the loading speed is increased, and the size of a file after the project is packaged is reduced; moreover, each service module is reasonably separated by codes, and the state management of each service module is under its own role without mutual interference; meanwhile, the horizontal expansion capability of state management is enhanced, and repeated modification on codes due to increase and decrease of service modules is not needed. Finally, the separation of state management, the automation of loading, the reduction of the file volume after the project packaging and the optimization of rendering and loading are realized.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other embodiments can be obtained by using the drawings without creative efforts.
FIG. 1 is a diagram of an embodiment of a method for state management of vue in accordance with the present invention;
fig. 2 is a schematic diagram of a hardware structure of an embodiment of the computer device for state management vue provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention are described in further detail with reference to the accompanying drawings.
It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are used for distinguishing two entities with the same name but different names or different parameters, and it should be noted that "first" and "second" are merely for convenience of description and should not be construed as limitations of the embodiments of the present invention, and they are not described in any more detail in the following embodiments.
Vue is the current market mainstream MVVM front end framework, vuex is a state management model developed specifically for vue. The object of the invention is to manage the state of Vue without using Vuex.
In view of the above objects, a first aspect of an embodiment of the present invention proposes an embodiment of a method for state management of vue. Fig. 1 is a schematic diagram illustrating an embodiment of a method for state management of vue provided by the present invention. As shown in fig. 1, the embodiment of the present invention includes the following steps:
s1, creating a global state management file and a plurality of local state management files, and judging whether the current state is global state management or local state management based on the service type;
s2, responding to the fact that the current state is the global state management, starting a global state management file and judging whether a local state management file needs to be added or not;
s3, responding to the local state management file needing to be added, matching the corresponding local state management file through a regular expression, and adding the name of the corresponding local state management file into the global state management file; and
s4, monitoring the state value, responding to the change of the state value, and correspondingly changing the page in vue based on the current state and the state value.
And creating a global state management file and a local state management file, and judging whether the current state is global state management or local state management based on the service type. Creating a global state management file in the main module for storing the related content of the global state management; a local state management file is created in a service module and used for storing related contents of local state management.
In some embodiments, the creating the global state management file and the local state management file comprises: and naming the global state management file and the local state management file respectively by adopting different naming rules. A folder is created under the main project module and a js file for storing global state management data, such as global state management file name with global. A folder is created under the business module directory and a js file for storing local state management data is created under the folder, for example, the local state management file name is named suffix. In order to distinguish the global state management file from the local state management file when the local state management data is automatically introduced, different naming rules can be adopted to name the global state management file and the local state management file.
Depending on the type of service, the states can be roughly classified into the following four categories: direct use of global state management, direct use of local state management, use of global state management with the introduction of local state management, use of local state management with the introduction of other local state management. Since there may be some differences in the way of managing states in different states, it is necessary to determine the state corresponding to the current situation.
And in response to the current state being the global state management, enabling the global state management file and judging whether the local state management file needs to be added.
And responding to the need of adding the local state management file, matching the corresponding local state management file through the regular expression, and adding the name of the corresponding local state management file into the global state management file. In the master module's state management folder, a file is created to scan for loading local state management functions, such as: js; creating a function in the file that matches the regular expression rules of the local state management file name through a property scan of the packaging tool when the item is run or packaged, such as: js files are scanned using webpack for files suffixed with module. Traversing the scanned file content, combining the data into an object according to the self-defined local name in the scanned file, and returning the finally generated object; and when the main module is initialized, the created scanning loading function is called, and the object returned by the scanning loading function is utilized for page display.
In some embodiments, further comprising: and in response to the fact that a local state management file does not need to be added, mounting the global state management file under a global object, and acquiring global state management data through the global object. When a page is initialized, mounting the global state management file under a global object, such as a Window object carried by a browser or a prototype chain object of Vue; and acquiring global state management data through a global object in any display page under the project and applying the data to the specified position of the page.
In some embodiments, further comprising: and in response to the current state being local state management, enabling the local state management file and judging whether other local state management files need to be added.
In some embodiments, further comprising: and acquiring the local state management data in response to no need of adding other local state management files.
In some embodiments, further comprising: and responding to the need of adding other local state management files, and matching the corresponding other local state management files according to the regular expression. In the state management folder of a business module, a file is created for scanning the loaded local state management functions, for example: js; defining a function for receiving an array parameter in a file, wherein the function only acquires a file matched with a character string spliced by elements in an array and a local state management suffix; when the business module page is initialized, the created scanning function is called and the prefix names of other state management files needing to be loaded are transmitted. And acquiring needed data from the returned object and displaying the data in a page.
And monitoring the state value, responding to the change of the state value, and correspondingly changing the page in vue based on the current state and the state value.
In some embodiments, further comprising: judging whether the local state management file and the other local state management files can be mutually called or not; and combining the local state management file with the other local state management files in response to the local state management file and the other local state management files being able to be mutually invoked.
The invention does not use the Vuex plug-in provided by the official, but monitors the state value through data monitoring, and realizes the automatic introduction of state management through scanning. The state management of Vue is wholly divided into a global state and a local state, and the basic function of state management is realized through data monitoring; and scanning the state management file by creating a scanning function to realize state management introduction. Finally, the function of state management of Vue is realized by data monitoring and automatic loading without using a Vuex plug-in. The invention not only reduces the development cost and the project complexity, but also avoids the pollution of the global environment caused by the fact that the states of all the service modules are all thrown to the global state, reduces the loading burden, improves the loading speed and reduces the file size after the project is packed. Moreover, each service module is reasonably separated by codes, and the state management of each service module plays its own roles without mutual interference; meanwhile, the horizontal expansion capability of state management is enhanced, and repeated modification on codes due to increase and decrease of service modules is not needed; finally, the separation of state management, the automation of loading, the reduction of the file volume after the project packaging and the optimization of rendering and loading are realized.
It should be particularly noted that, the steps in the embodiments of the method for state management vue described above can be intersected, replaced, added, or deleted, so that these reasonable permutation and combination transformations for the method for state management vue also belong to the scope of the present invention, and should not limit the scope of the present invention to the embodiments.
In view of the above object, a second aspect of the embodiments of the present invention provides a system for state management of vue, including: the creating module is configured to create a global state management file and a plurality of local state management files and judge whether the current state is global state management or local state management based on the service type; the global module is configured to respond to the fact that the current state is global state management, start the global state management file and judge whether a local state management file needs to be added or not; the execution module is configured to respond to the local state management file needing to be added, match the corresponding local state management file through a regular expression, and add the name of the corresponding local state management file into the global state management file; and the monitoring module is configured to monitor the state value, respond to the change of the state value, and correspondingly change the page in vue based on the current state and the state value.
In some embodiments, the creation module is further configured to: and naming the global state management file and the local state management file respectively by adopting different naming rules.
In some embodiments, further comprising: and the global data module is configured to respond to the situation that a local state management file does not need to be added, mount the global state management file under a global object, and acquire global state management data through the global object.
In some embodiments, further comprising: and the local module is configured to respond to the local state management of the current state, start the local state management file and judge whether other local state management files need to be added.
In some embodiments, further comprising: and the local data module is configured to respond to the situation that other local state management files do not need to be added, and acquire the local state management data.
In some embodiments, further comprising: and the matching module is configured to respond to the need of adding other local state management files and match the corresponding other local state management files according to the regular expression.
In some embodiments, further comprising: the merging module is configured to judge whether the local state management file and the other local state management files can be mutually called; and combining the local state management file with the other local state management files in response to the local state management file and the other local state management files being able to be mutually invoked.
In view of the above object, a third aspect of an embodiment of the present invention provides a computer device, including: at least one processor; and a memory storing computer instructions executable on the processor, the instructions being executable by the processor to perform the steps of: s1, creating a global state management file and a plurality of local state management files, and judging whether the current state is global state management or local state management based on the service type; s2, responding to the fact that the current state is the global state management, starting a global state management file and judging whether a local state management file needs to be added or not; s3, responding to the local state management file needing to be added, matching the corresponding local state management file through a regular expression, and adding the name of the corresponding local state management file into the global state management file; and S4, monitoring the state value, responding to the change of the state value, and correspondingly changing the page in vue based on the current state and the state value.
In some embodiments, the creating the global state management file and the local state management file comprises: and naming the global state management file and the local state management file respectively by adopting different naming rules.
In some embodiments, further comprising: and in response to the fact that a local state management file does not need to be added, mounting the global state management file under a global object, and acquiring global state management data through the global object.
In some embodiments, further comprising: and in response to the current state being local state management, starting the local state management file and judging whether other local state management files need to be added.
In some embodiments, further comprising: and acquiring the local state management data in response to no need of adding other local state management files.
In some embodiments, further comprising: and responding to the requirement of adding other local state management files, and matching the corresponding other local state management files according to the regular expression.
In some embodiments, further comprising: judging whether the local state management file and the other local state management files can be mutually called or not; and combining the local state management file with the other local state management files in response to the local state management file and the other local state management files being able to be mutually invoked.
Fig. 2 is a schematic diagram of a hardware structure of an embodiment of the computer device for state management of vue according to the present invention.
Taking the apparatus shown in fig. 2 as an example, the apparatus includes a processor 301 and a memory 302, and may further include: an input device 303 and an output device 304.
The processor 301, the memory 302, the input device 303 and the output device 304 may be connected by a bus or other means, and fig. 2 illustrates the connection by a bus as an example.
The memory 302, which is a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions/modules corresponding to the method for state management vue in this embodiment of the present application. The processor 301 executes various functional applications and data processing of the server by running the nonvolatile software program, instructions and modules stored in the memory 302, that is, implements the method of state management for vue of the above-described method embodiment.
The memory 302 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the method of state management for vue, and the like. Further, the memory 302 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 302 optionally includes memory located remotely from processor 301, which may be connected to a local module via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 303 may receive information such as a user name and a password that are input. The output means 304 may comprise a display device such as a display screen.
One or more program instructions/modules corresponding to the method for state management vue are stored in memory 302 and, when executed by processor 301, perform the method for state management vue in any of the above-described method embodiments.
Any embodiment of a computer apparatus that performs the method for state management of vue described above may achieve the same or similar effects as any of the method embodiments described above that correspond thereto.
The invention also provides a computer readable storage medium storing a computer program which, when executed by a processor, performs the method as above.
Finally, it should be noted that, as one of ordinary skill in the art can appreciate that all or part of the processes in the methods of the embodiments described above can be implemented by instructing relevant hardware through a computer program, a program of the method for state management of vue can be stored in a computer readable storage medium, and the program can include the processes of the embodiments of the methods described above when executed. The storage medium of the program may be a magnetic disk, an optical disk, a read-only memory (ROM), or a Random Access Memory (RAM). The embodiments of the computer program may achieve the same or similar effects as any of the above-described method embodiments.
Furthermore, the methods disclosed according to embodiments of the present invention may also be implemented as a computer program executed by a processor, which may be stored in a computer-readable storage medium. Which when executed by a processor performs the above-described functions as defined in the method disclosed by an embodiment of the invention.
Further, the above method steps and system elements may also be implemented using a controller and a computer readable storage medium for storing a computer program for causing the controller to implement the functions of the above steps or elements.
Further, it should be appreciated that the computer-readable storage media (e.g., memory) herein can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. By way of example, and not limitation, nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which can act as external cache memory. By way of example and not limitation, RAM may be available in a variety of forms such as synchronous RAM (DRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The storage devices of the disclosed aspects are intended to comprise, without being limited to, these and other suitable types of memory.
Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as software or hardware depends upon the particular application and design constraints imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the disclosed embodiments of the present invention.
The various illustrative logical blocks, modules, and circuits described in connection with the disclosure herein may be implemented or performed with the following components designed to perform the functions herein: a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP, and/or any other such configuration.
The steps of a method or algorithm described in connection with the disclosure herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In the alternative, the processor and the storage medium may reside as discrete components in a user terminal.
In one or more exemplary designs, the functions may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer. By way of example, and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a general-purpose or special-purpose computer, or a general-purpose or special-purpose processor. Also, any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital Subscriber Line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc, as used herein, includes Compact Disc (CD), laser disc, optical disc, digital Versatile Disc (DVD), floppy disk, blu-ray disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.
The foregoing is an exemplary embodiment of the present disclosure, but it should be noted that various changes and modifications could be made herein without departing from the scope of the present disclosure as defined by the appended claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. Furthermore, although elements of the embodiments of the invention may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated.
It should be understood that, as used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly supports the exception. It should also be understood that "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items.
The numbers of the embodiments disclosed in the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, of embodiments of the invention is limited to these examples; within the idea of an embodiment of the invention, also technical features in the above embodiment or in different embodiments may be combined and there are many other variations of the different aspects of the embodiments of the invention as described above, which are not provided in detail for the sake of brevity. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of the embodiments of the present invention are intended to be included within the scope of the embodiments of the present invention.

Claims (6)

1. A method of state management for vue comprising the steps of:
creating a global state management file and a plurality of local state management files, and judging whether the current state is global state management or local state management based on the service type;
responding to the fact that the current state is the global state management, starting the global state management file and judging whether a local state management file needs to be added or not;
responding to the need of adding the local state management file, matching the corresponding local state management file through a regular expression, and adding the name of the corresponding local state management file into the global state management file; and
listening for a state value, in response to a change in the state value, making a corresponding change to a page in vue based on the current state and state value,
wherein, the method further comprises:
responding to the local state management of the current state, starting the local state management file and judging whether other local state management files need to be added or not;
responding to the situation that other local state management files do not need to be added, and acquiring the local state management data;
responding to the need of adding other local state management files, and matching the corresponding other local state management files according to the regular expression;
judging whether the local state management file and the other local state management files can be mutually called or not; and
and in response to that the local state management file and the other local state management files can be mutually called, merging the local state management file and the other local state management files.
2. The method of claim 1, wherein creating the global state management file and the local state management file comprises:
and naming the global state management file and the local state management file respectively by adopting different naming rules.
3. The method of claim 1, further comprising:
and in response to the fact that a local state management file does not need to be added, mounting the global state management file under a global object, and acquiring global state management data through the global object.
4. A system for state management of vue, comprising:
the creating module is configured to create a global state management file and a plurality of local state management files and judge whether the current state is global state management or local state management based on the service type;
the global module is configured to respond to the fact that the current state is global state management, start the global state management file and judge whether a local state management file needs to be added or not;
the execution module is configured to respond to the local state management file needing to be added, match the corresponding local state management file through a regular expression, and add the name of the corresponding local state management file into the global state management file; and
a monitoring module configured to monitor the state value, respond to the change of the state value, and perform corresponding change to the page in vue based on the current state and the state value,
the system further comprises: the local module is configured to respond to the local state management of the current state, start the local state management file and judge whether other local state management files need to be added or not;
the local data module is configured to respond to the situation that other local state management files do not need to be added, and obtain the local state management data;
the matching module is configured to respond to the need of adding other local state management files and match the corresponding other local state management files according to the regular expression;
the merging module is configured to judge whether the local state management file and the other local state management files can be mutually called; and combining the local state management file with the other local state management files in response to the local state management file and the other local state management files being able to be mutually invoked.
5. A computer device, comprising:
at least one processor; and
a memory storing computer instructions executable on the processor, the instructions when executed by the processor implementing the steps of the method of any one of claims 1 to 3.
6. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 3.
CN202010594869.9A 2020-06-28 2020-06-28 Method, system, equipment and medium for state management of vue Active CN111858314B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010594869.9A CN111858314B (en) 2020-06-28 2020-06-28 Method, system, equipment and medium for state management of vue

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010594869.9A CN111858314B (en) 2020-06-28 2020-06-28 Method, system, equipment and medium for state management of vue

Publications (2)

Publication Number Publication Date
CN111858314A CN111858314A (en) 2020-10-30
CN111858314B true CN111858314B (en) 2022-11-11

Family

ID=72989065

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010594869.9A Active CN111858314B (en) 2020-06-28 2020-06-28 Method, system, equipment and medium for state management of vue

Country Status (1)

Country Link
CN (1) CN111858314B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112364039A (en) * 2020-11-23 2021-02-12 北京明略软件系统有限公司 Web application data real-time synchronization method, system, storage medium and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120144179A1 (en) * 2010-12-06 2012-06-07 Microsoft Corporation Fast computer startup
CN110727534A (en) * 2019-09-27 2020-01-24 苏州浪潮智能科技有限公司 Method, equipment and storage medium for repairing file system
CN111291007A (en) * 2020-02-29 2020-06-16 苏州浪潮智能科技有限公司 File aggregation method, system, device and medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120144179A1 (en) * 2010-12-06 2012-06-07 Microsoft Corporation Fast computer startup
CN110727534A (en) * 2019-09-27 2020-01-24 苏州浪潮智能科技有限公司 Method, equipment and storage medium for repairing file system
CN111291007A (en) * 2020-02-29 2020-06-16 苏州浪潮智能科技有限公司 File aggregation method, system, device and medium

Also Published As

Publication number Publication date
CN111858314A (en) 2020-10-30

Similar Documents

Publication Publication Date Title
CN110427342B (en) Method, equipment and readable medium for creating mirror library
CN111177043B (en) Method, system, device and medium for accelerating reading of field replaceable unit information
US20140149965A1 (en) Lightweight framework for web applications
CN109614147B (en) PHY register read-write method and device
US11281438B2 (en) Platform for web services development and method therefor
CN110764748B (en) Code calling method, device, terminal and storage medium
CN110968477B (en) Method, device and medium for acquiring backup BMC version information
CN107330028A (en) Expansion application methods and system of a kind of Apache NiFi in terms of source data input database
CN111176717A (en) Method and device for generating installation package and electronic equipment
CN112395253A (en) Index file generation method, terminal device, electronic device and medium
CN111858314B (en) Method, system, equipment and medium for state management of vue
CN111857747B (en) Method, system, device and medium for installing database based on OpenStack cloud host
CN108021564A (en) A kind of method and apparatus of page reorientation
CN111371885B (en) Method, device, equipment and medium for transmitting file to VMWare virtual machine
CN111309264B (en) Method, system, device and medium for making directory quota compatible with snapshot
CN104954363A (en) Method and device for generating interface document
CN111090453A (en) Equipment configuration method, equipment and storage medium
CN111176666B (en) BIOS + ME mirror image refreshing method, system, equipment and readable medium
CN111857963A (en) Container arrangement implementation method, device, equipment and medium for Proxmox VE
CN113253999A (en) Plug-in data access method, data source management system and interface access method
CN107391178B (en) Terminal installation package deployment and implementation method and device
CN110659035A (en) Method and device for batch mounting of mirror images based on BMC
CN108073401B (en) Method and device for executing business logic and electronic equipment
CN110442353A (en) A kind of method, apparatus and electronic equipment of installation kit management
CN116208676A (en) Data back-source method, device, computer equipment, storage medium and program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant