Data configuration method, system and electronic device
By automatically initializing the state during the loading process of vuex component and automatically configuring components using data configuration policies, the problem of low development and maintenance efficiency caused by code coupling in the existing technology is solved, and the automated configuration and decoupling of components are achieved.
Patent Information
- Application Number
- CN202410834518.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-06-26
AI Technical Summary
During the data sharing process of vuex components, vuex data needs to be manually initialized and code written repeatedly in multiple business components, resulting in inefficient development cycles and maintenance.
Decouple data management code and business management code by automatically initializing vuex state during the loading process of vuex component and automatically configuring vuex components using data configuration policies during the life cycle.
It realizes the automated configuration of vuex components, reduces code duplication, and improves development and maintenance efficiency.
Smart Images

Figure CN118708257B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a data configuration method, system and electronic equipment. Background Art
[0002] In the process of data sharing of vuex components, many business components are involved. It is necessary to manually initialize the vuex data in the business components, and then couple the corresponding business components together according to business needs. When multiple business components need to use the same set of data at the same time, repeated code writing is required in each business component, which increases the development cycle and time cost; in subsequent maintenance, the logic involved in each business component needs to be reconstructed, which is relatively inefficient. Summary of the invention
[0003] In view of this, the purpose of the present invention is to provide a data configuration method, system and electronic device, which can automatically initialize the state of vuex during the loading process of the vuex component, and use the data configuration strategy generated by it to automatically configure the vuex component during the life cycle of the vuex component, thereby decoupling the data management code and the business management code, solving the problem of low development and maintenance efficiency caused by code coupling in the prior art.
[0004] In a first aspect, an embodiment of the present invention provides a data configuration method, which is used in a loading configuration process of a vuex component, and the method includes:
[0005] Generate configuration instructions corresponding to the vuex component based on the data configuration request of the vuex component;
[0006] Determine the loading page corresponding to the vuex component, and use configuration instructions to control the vuex component to load into the loading page;
[0007] Get the configuration items corresponding to the vuex component, and initialize the global mixin object corresponding to the vuex component based on the configuration items;
[0008] During the life cycle of the vuex component, use the global mixin object to obtain the corresponding calculated properties of the vuex component;
[0009] Generate a data configuration strategy based on the relationship between the calculated properties and the corresponding targets of the configuration items, and use the data configuration strategy to configure data loading for the Vuex component.
[0010] In one embodiment, the step of generating a configuration instruction corresponding to the vuex component based on the data configuration request of the vuex component includes:
[0011] Use the loading configuration environment corresponding to the vuex component to obtain the data configuration request corresponding to the vuex component;
[0012] Based on the data configuration request, declare the configuration instructions in the vuex warehouse container corresponding to the vuex component.
[0013] In one embodiment, determining a loading page corresponding to a vuex component and using configuration instructions to control the steps of loading the vuex component into the loading page include:
[0014] According to the loading configuration environment corresponding to the vuex component, determine the loading page corresponding to the vuex component;
[0015] Obtain the startup status parameters corresponding to the loading page in real time, and use the startup status parameters to detect whether the loading page is started;
[0016] When the loading page is detected to be started, the vuex component is controlled to be loaded into the loading page based on the configuration instructions.
[0017] In one embodiment, the steps of obtaining the configuration item corresponding to the vuex component and initializing the global mixin object corresponding to the vuex component based on the configuration item include:
[0018] Get the module contained in the vuex warehouse container corresponding to the vuex component, and determine the configuration items contained in the module;
[0019] Use the attribute data corresponding to the configuration item to initialize the global mixin object corresponding to the vuex component.
[0020] In one embodiment, the steps of obtaining a module contained in a vuex warehouse container corresponding to a vuex component and determining a configuration item contained in the module include:
[0021] Determine the vuex warehouse container corresponding to the vuex component, and obtain the modules contained in the vuex warehouse container;
[0022] Traverse the sub-modules contained in all nodes in the modules module and determine the configuration items corresponding to the sub-modules.
[0023] In one embodiment, during the life cycle of a vuex component, the step of using a global mixin object to obtain a calculated property corresponding to the vuex component includes:
[0024] Get the life cycle parameters of the vuex component;
[0025] Determine the lifecycle of the vuex component based on the lifecycle parameters;
[0026] During the life cycle, the computed properties contained in the vuex component are intercepted through the global mixin object.
[0027] In one embodiment, the steps of generating a data configuration strategy according to the relationship between the calculated attribute and the target corresponding to the configuration item, and using the data configuration strategy to configure data loading for the vuex component include:
[0028] Get the declared target of the configuration items contained in the vuex warehouse container corresponding to the vuex component;
[0029] Generate the data configuration strategy corresponding to the vuex component based on the inclusion relationship between the calculated properties and the declared targets;
[0030] Use data configuration strategy to configure data loading for vuex components.
[0031] In one embodiment, the step of generating a data configuration strategy corresponding to a vuex component according to the inclusion relationship between a calculated property and a declared target includes:
[0032] Obtain the inclusion relationship between the calculated property and the declared target, and determine whether the calculated property contains the declared target based on the inclusion relationship;
[0033] If so, the trigger strategy corresponding to the vuex component is determined based on the declared target, and the data configuration strategy is generated according to the trigger strategy.
[0034] In a second aspect, an embodiment of the present invention provides a data configuration system, which is used for the loading configuration process of a vuex component, and the system includes:
[0035] The configuration instruction generation module is used to generate the configuration instructions corresponding to the vuex component based on the data configuration request of the vuex component;
[0036] The component loading module is used to determine the loading page corresponding to the vuex component, and use configuration instructions to control the vuex component to be loaded into the loading page;
[0037] The configuration item acquisition module is used to obtain the configuration items corresponding to the vuex component and initialize the global mixin object corresponding to the vuex component based on the configuration items;
[0038] The calculation attribute acquisition module is used to obtain the calculation attributes corresponding to the vuex component using the global mixed-in object during the life cycle of the vuex component;
[0039] The configuration strategy execution module is used to generate a data configuration strategy based on the relationship between the calculated properties and the corresponding targets of the configuration items, and use the data configuration strategy to load and configure the Vuex component.
[0040] In a third aspect, an embodiment of the present invention further provides an electronic device, including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the steps of the data configuration method provided in the first aspect.
[0041] In a fourth aspect, an embodiment of the present invention further provides a storage medium, which stores computer executable instructions. When the computer executable instructions are called and executed by a processor, the computer executable instructions prompt the processor to implement the steps of the data configuration method provided in the first aspect.
[0042] A data configuration method, system and electronic device provided by an embodiment of the present invention, in the process of loading and configuring a vuex component, the method first generates a configuration instruction corresponding to the vuex component based on the data configuration request of the vuex component; then determines the loading page corresponding to the vuex component, and uses the configuration instruction to control the vuex component to load into the loading page; then obtains the configuration item corresponding to the vuex component, and initializes the global mixed-in object corresponding to the vuex component based on the configuration item; then obtains the calculated attribute corresponding to the vuex component using the global mixed-in object within the life cycle of the vuex component; finally, generates a data configuration strategy according to the relationship between the calculated attribute and the corresponding target of the configuration item, and uses the data configuration strategy to load data configuration for the vuex component. The method can automatically initialize the state of vuex during the loading process of the vuex component, and use the data configuration strategy generated by the method to realize automatic configuration of the vuex component within the life cycle of the vuex component, so that the data management code and the business management code can be decoupled, solving the problem of low development and maintenance efficiency caused by code coupling in the prior art.
[0043] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0044] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 A flowchart of a data configuration method provided by an embodiment of the present invention;
[0047] Figure 2 A flowchart of step S101 in a data configuration method provided in an embodiment of the present invention;
[0048] Figure 3 A flowchart of step S102 in a data configuration method provided in an embodiment of the present invention;
[0049] Figure 4 A flowchart of step S103 in a data configuration method provided in an embodiment of the present invention;
[0050] Figure 5 A flowchart of step S401 in a data configuration method provided in an embodiment of the present invention;
[0051] Figure 6 A flowchart of step S104 in a data configuration method provided in an embodiment of the present invention;
[0052] Figure 7 A flowchart of step S105 in a data configuration method provided in an embodiment of the present invention;
[0053] Figure 8 A flowchart of step S702 in a data configuration method provided in an embodiment of the present invention;
[0054] Fig. 9 A schematic diagram of the structure of a data configuration system provided by an embodiment of the present invention;
[0055] Fig.10 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.
[0056] icon:
[0057] 910- configuration instruction generation module; 920- component loading module; 930- configuration item acquisition module; 940- calculation property acquisition module; 950- configuration strategy execution module;
[0058] 101 - processor; 102 - memory; 103 - bus; 104 - communication interface. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described in combination with the embodiments below. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0060] In the process of data sharing of vuex components, many business components are involved. It is necessary to manually initialize the vuex data in the business components, and then couple the corresponding business components together according to business needs. When multiple business components need to use the same set of data at the same time, repeated code writing is required in each business component, which increases the development cycle and time cost; in subsequent maintenance, the logic involved in each business component needs to be reconstructed, which is relatively inefficient.
[0061] The conventional solution is to add data management code in the business component to manually call the interface to obtain data to initialize the state in vuex, but this method will increase code coupling, increase development time, and is not conducive to later maintenance. Based on this, the present invention implements a data configuration method, system and electronic device, which can automatically initialize the state of vuex during the loading process of the vuex component, and use the data configuration strategy generated by it to realize automatic configuration of the vuex component during the life cycle of the vuex component, so that the data management code and the business management code can be decoupled, solving the problem of low development and maintenance efficiency caused by code coupling in the prior art.
[0062] To facilitate understanding of this embodiment, a data configuration method disclosed in an embodiment of the present invention is first described in detail. This method is used in the loading configuration process of the vuex component, such as Figure 1 As shown, including:
[0063] Step S101, generating configuration instructions corresponding to the vuex component based on the data configuration request of the vuex component;
[0064] Step S102, determine the loading page corresponding to the vuex component, and use the configuration instruction to control the vuex component to load into the loading page;
[0065] Step S103, obtain the configuration item corresponding to the vuex component, and initialize the global mixin object corresponding to the vuex component based on the configuration item;
[0066] Step S104, during the life cycle of the vuex component, use the global mixin object to obtain the calculated properties corresponding to the vuex component;
[0067] Step S105, generate a data configuration strategy according to the relationship between the calculated attribute and the corresponding target of the configuration item, and use the data configuration strategy to perform data loading configuration on the vuex component.
[0068] In the specific implementation process, the method first generates the configuration instructions corresponding to the vuex component based on the data configuration request of the vuex component, thereby realizing declarative configuration in vuex, and then uses the configuration instructions to load the vuex component in the loading page corresponding to the vuex component. After the Vuex plug-in is loaded, the configuration item corresponding to the vuex component is obtained, and a global component mix-in object is initialized based on the configuration item, and the global mix-in object is mounted. The corresponding calculated attributes are obtained during the life cycle of the vuex component, and the acquisition process of the calculated attributes is implemented through the global mix-in object. After the calculated attributes are obtained, the corresponding data configuration strategy is generated according to the relationship between it and the corresponding target of the configuration item, so as to use the data configuration strategy to perform the data loading configuration process of the vuex component.
[0069] In one embodiment, step S101 of generating configuration instructions corresponding to the vuex component based on the data configuration request of the vuex component is as follows: Figure 2 As shown, including:
[0070] Step S201, using the loading configuration environment corresponding to the vuex component, obtain the data configuration request corresponding to the vuex component;
[0071] Step S202, based on the data configuration request, declare the configuration instructions in the vuex warehouse container corresponding to the vuex component.
[0072] During the specific implementation process, declarative configuration is performed in the vuex warehouse container store file corresponding to the vuex component, and the data configuration request corresponding to the vuex component is obtained by utilizing the loading configuration environment corresponding to the vuex component. Then, based on the data configuration request, declarative configuration is performed in the vuex store file to obtain the corresponding declarative configuration instructions.
[0073] In one embodiment, the loading page corresponding to the vuex component is determined, and the vuex component is loaded into the loading page using configuration instructions in step S102, such as Figure 3 As shown, including:
[0074] Step S301, determining the loading page corresponding to the vuex component according to the loading configuration environment corresponding to the vuex component;
[0075] Step S302, obtaining the startup state parameter corresponding to the loading page in real time, and using the startup state parameter to detect whether the loading page is started;
[0076] Step S303, when it is detected that the loading page is started, the vuex component is controlled to be loaded into the loading page based on the configuration instructions.
[0077] When the loading page starts, the vuex component is loaded using the configuration instruction. In the specific implementation process, the corresponding loading configuration environment is used to determine the corresponding loading page. The startup status parameters corresponding to the loading page are obtained in real time to detect whether the loading page is started; when the loading page is detected to be started, the configuration instruction is used to control the vuex component to be loaded into the loading page.
[0078] In one embodiment, the configuration item corresponding to the vuex component is obtained, and step S103 of initializing the global mixin object corresponding to the vuex component based on the configuration item is performed, such as Figure 4 As shown, including:
[0079] Step S401, obtain the module contained in the vuex warehouse container corresponding to the vuex component, and determine the configuration items contained in the module;
[0080] Step S402, initialize the global mixin object corresponding to the vuex component using the attribute data corresponding to the configuration item.
[0081] In the process of obtaining the global mixed-in object, the configuration items contained in the module are first determined. In actual scenarios, this can be achieved by collecting the autoFetch objects of each module in the vuex store file. In one embodiment, the module contained in the vuex warehouse container corresponding to the vuex component is obtained, and the step S401 of determining the configuration items contained in the module is as follows: Figure 5 As shown, including:
[0082] Step S501, determine the vuex warehouse container corresponding to the vuex component, and obtain the modules contained in the vuex warehouse container;
[0083] Step S502, traverse the sub-modules contained in all nodes in the modules module, and determine the configuration items corresponding to the sub-modules.
[0084] In the specific implementation process, it can be achieved through the following methods:
[0085] const fetchActions = {}
[0086] Object.keys(store._modules.root._children).forEach(moduleName =>{
[0087] const module = store._modules.root._children[moduleName]
[0088] const rawModule = module._rawModule
[0089] if (rawModule&&rawModule.autoFetch) {
[0090] Object.keys(rawModule.autoFetch).forEach(action =>{
[0091] fetchActions[action] = rawModule.autoFetch[action]
[0092] })
[0093] }
[0094] })
[0095] In one embodiment, during the life cycle of the vuex component, step S104 of obtaining the calculated properties corresponding to the vuex component using the global mixin object is as follows: Figure 6 As shown, including:
[0096] Step S601, obtain the life cycle parameters of the vuex component;
[0097] Step S602, determining the life cycle of the vuex component based on the life cycle parameters;
[0098] Step S603, during the life cycle, intercept the computed properties contained in the vuex component through the global mixin object.
[0099] Specifically, the calculated property is the computed property of the vuex component. Its complete life cycle is determined by obtaining the life cycle parameters of the vuex component, and then the computed properties contained in the vuex component are intercepted through the global mixin object during the life cycle.
[0100] In one embodiment, a data configuration strategy is generated according to the relationship between the calculated attribute and the corresponding target of the configuration item, and the data configuration strategy is used to perform data loading configuration on the vuex component in step S105, such as Figure 7 As shown, including:
[0101] Step S701, obtain the declaration target of the configuration item contained in the vuex warehouse container corresponding to the vuex component;
[0102] Step S702, generating a data configuration strategy corresponding to the vuex component according to the inclusion relationship between the calculated attribute and the declared target;
[0103] Step S703, use the data configuration strategy to configure data loading for the vuex component.
[0104] After intercepting the computed property in the component life cycle, the target declared in the store repository corresponding to the vuex component is removed, and the data configuration strategy is determined according to the inclusion relationship between the computed property and the declared target, and the data loading configuration process of the vuex component is performed using the strategy. In one embodiment, step S702 of generating the data configuration strategy corresponding to the vuex component according to the inclusion relationship between the computed property and the declared target is as follows: Figure 8 As shown, including:
[0105] Step S801, obtaining the inclusion relationship between the calculated attribute and the declared target, and judging whether the calculated attribute contains the declared target based on the inclusion relationship;
[0106] Step S802, if yes, determine the trigger strategy corresponding to the vuex component based on the declared target, and generate a data configuration strategy according to the trigger strategy.
[0107] Specifically, the corresponding trigger strategy is determined by judging whether the calculated attribute contains a declared target. If so, the corresponding action is triggered to generate the final data configuration strategy.
[0108] The core idea of the data configuration method in the above embodiment mainly includes the following steps:
[0109] Step 1: Perform declarative configuration in the store file of the vuex component;
[0110] Step 2, load the vuex component when starting in the loading page;
[0111] Step 3: After the vuex component is loaded, it will automatically obtain all configuration items and mount a global component mixin object;
[0112] Step 4: intercept the computed property in the life cycle of the vuex component and check whether the property meets the relevant declaration standards. If it meets the standards, the subsequent automated data management process is carried out.
[0113] The above process can be achieved in the following ways:
[0114] import Vue from 'vue'
[0115] const autoFetchPlugin = (store) =>{
[0116] const fetchActions = {}
[0117] Object.keys(store._modules.root._children).forEach(moduleName=>{
[0118] const module = store._modules.root._children[moduleName]
[0119] const rawModule = module._rawModule
[0120] if (rawModule&&rawModule.autoFetch) {
[0121] Object.keys(rawModule.autoFetch).forEach(action =>{
[0122] fetchActions[action] = rawModule.autoFetch[action]
[0123] })
[0124] }
[0125] })
[0126] Vue.mixin({
[0127] beforeCreate () {
[0128] const computed = this.$options.computed
[0129] if (computed) {
[0130] Object.keys(fetchActions).forEach(actionKey =>{
[0131] if (Object.hasOwnProperty.call(computed, actionKey)) {
[0132] store.dispatch(fetchActions[actionKey])
[0133] }
[0134] })
[0135] }
[0136] }
[0137] })
[0138] }
[0139] export default autoFetchPlugin
[0140] Specifically, autoFetchPlugin is the component corresponding to vuex. It first collects the autoFetch objects defined by each module in the store, and then adds a global mixin object mixin. Before each component is loaded, it searches the computed attribute to see if it contains the target declared in autofetch. If so, it triggers the corresponding action to realize the automated data management process.
[0141] It can be seen from the data configuration method in the above embodiment that the method can automatically initialize the state of vuex during the loading process of the vuex component, and use the data configuration strategy generated by it to automatically configure the vuex component during the life cycle of the vuex component, thereby decoupling the data management code and the business management code, solving the problem of low development and maintenance efficiency caused by code coupling in the prior art.
[0142] For the data configuration method provided in the above embodiment, an embodiment of the present invention provides a data configuration system, which is used in the loading configuration process of the vuex component, such as Fig. 9 As shown, the system includes:
[0143] Configuration instruction generation module 910, used to generate configuration instructions corresponding to the vuex component based on the data configuration request of the vuex component;
[0144] The component loading module 920 is used to determine the loading page corresponding to the vuex component and use the configuration instructions to control the vuex component to be loaded into the loading page;
[0145] The configuration item acquisition module 930 is used to obtain the configuration items corresponding to the vuex component and initialize the global mixin object corresponding to the vuex component based on the configuration items;
[0146] The calculation attribute acquisition module 940 is used to obtain the calculation attribute corresponding to the vuex component by using the global mixed-in object during the life cycle of the vuex component;
[0147] The configuration strategy execution module 950 is used to generate a data configuration strategy according to the relationship between the calculated attributes and the corresponding targets of the configuration items, and use the data configuration strategy to load and configure the vuex component.
[0148] From the data configuration system mentioned in the above embodiment, it can be seen that the system can automatically initialize the state of vuex during the loading process of the vuex component, and use the data configuration strategy generated by it to automatically configure the vuex component during the life cycle of the vuex component, thereby decoupling the data management code and the business management code, solving the problem of low development and maintenance efficiency caused by code coupling in the prior art.
[0149] The data configuration system provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned data configuration method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned data configuration method embodiment.
[0150] This embodiment also provides an electronic device. The structural diagram of the electronic device is as follows: Fig.10 As shown, the device includes a processor 101 and a memory 102; wherein the memory 102 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor to implement the steps of the above data configuration method.
[0151] Fig.10 The electronic device shown further includes a bus 103 and a communication interface 104 , and the processor 101 , the communication interface 104 and the memory 102 are connected via the bus 103 .
[0152] The memory 102 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The bus 103 may be an ISA bus, a PCI bus, or an EISA bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.10 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0153] The communication interface 104 is used to connect to at least one user terminal and other network units through a network interface, and send the encapsulated IPv4 message or IPv4 message to the user terminal through the network interface.
[0154] The processor 101 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 101. The above processor 101 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 102, and the processor 101 reads the information in the memory 102 and completes the steps of the method of the above embodiment in combination with its hardware.
[0155] An embodiment of the present invention further provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the data configuration method in the above embodiment are executed.
[0156] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0157] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0158] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0159] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that can be executed by a processor. Based on this understanding, the technical solution of the present invention can essentially or in other words, the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0160] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A data configuration method, characterized in that: The method is used for the loading configuration process of the vuex component, and the method includes: Generate configuration instructions corresponding to the vuex component based on the data configuration request of the vuex component; Determine the loading page corresponding to the vuex component, and use the configuration instruction to control the vuex component to be loaded into the loading page; Get the configuration item corresponding to the vuex component, and initialize the global mixin object corresponding to the vuex component based on the configuration item; During the life cycle of the vuex component, the global mixin object is used to obtain the calculated properties corresponding to the vuex component; Generate a data configuration strategy according to the relationship between the calculated attribute and the target corresponding to the configuration item, and use the data configuration strategy to perform data loading configuration on the vuex component; The step of using the global mixin object to obtain the calculated properties corresponding to the vuex component during the life cycle of the vuex component includes: Get the life cycle parameters of the vuex component; Determine the life cycle of the vuex component based on the life cycle parameters; During the life cycle, the computed properties contained in the vuex component are intercepted by the global mixin object; The step of generating a data configuration strategy according to the relationship between the calculated attribute and the target corresponding to the configuration item, and using the data configuration strategy to perform data loading configuration on the vuex component includes: Get the declared target of the configuration item contained in the vuex warehouse container corresponding to the vuex component; Generate a data configuration strategy corresponding to the vuex component according to the inclusion relationship between the calculated attribute and the declared target; The data configuration strategy is used to configure data loading for the vuex component.
2. The data configuration method according to claim 1, characterized in that: The step of generating a configuration instruction corresponding to the vuex component based on the data configuration request of the vuex component comprises: Utilize the loading configuration environment corresponding to the vuex component to obtain the data configuration request corresponding to the vuex component; Based on the data configuration request, the configuration instruction is declared in the vuex warehouse container corresponding to the vuex component.
3. The data configuration method according to claim 1, characterized in that: The step of determining the loading page corresponding to the vuex component and using the configuration instruction to control the vuex component to be loaded into the loading page includes: Determine the loading page corresponding to the vuex component according to the loading configuration environment corresponding to the vuex component; Acquire the startup state parameter corresponding to the loading page in real time, and use the startup state parameter to detect whether the loading page is started; When it is detected that the loading page is started, the vuex component is controlled to be loaded into the loading page based on the configuration instruction.
4. The data configuration method according to claim 1, characterized in that: The step of obtaining the configuration item corresponding to the vuex component and initializing the global mixin object corresponding to the vuex component based on the configuration item includes: Get the module contained in the vuex warehouse container corresponding to the vuex component, and determine the configuration items contained in the module; Initialize the global mixin object corresponding to the vuex component using the attribute data corresponding to the configuration item.
5. The data configuration method according to claim 4, characterized in that: The step of obtaining the module contained in the vuex warehouse container corresponding to the vuex component and determining the configuration items contained in the module includes: Determine the vuex warehouse container corresponding to the vuex component, and obtain the modules contained in the vuex warehouse container; Traverse the sub-modules contained in all nodes in the modules module, and determine the configuration items corresponding to the sub-modules.
6. The data configuration method according to claim 1, characterized in that: The step of generating a data configuration strategy corresponding to the vuex component according to the inclusion relationship between the calculated property and the declared target includes: Acquire an inclusion relationship between the calculated attribute and the declared target, and determine whether the calculated attribute contains the declared target based on the inclusion relationship; If so, the trigger strategy corresponding to the vuex component is determined based on the declared target, and the data configuration strategy is generated according to the trigger strategy.
7. A data configuration system, characterized in that: The system is used for the loading configuration process of the vuex component, and the system includes: A configuration instruction generation module, used to generate configuration instructions corresponding to the vuex component based on the data configuration request of the vuex component; A component loading module, used to further determine a loading page corresponding to the vuex component, and use the configuration instruction to control the vuex component to be loaded into the loading page; A configuration item acquisition module is used to obtain the configuration items corresponding to the vuex component, and initialize the global mixin object corresponding to the vuex component based on the configuration items; A calculation property acquisition module is used to obtain the calculation property corresponding to the vuex component by using the global mixin object during the life cycle of the vuex component; A configuration strategy execution module is used to generate a data configuration strategy according to the relationship between the calculated attribute and the target corresponding to the configuration item, and use the data configuration strategy to load and configure the vuex component; The calculated property acquisition module is also used to: obtain the life cycle parameters of the vuex component; determine the life cycle of the vuex component based on the life cycle parameters; and intercept the computed properties contained in the vuex component through the global mixin object during the life cycle; The configuration strategy execution module is also used to: obtain the declared target of the configuration item contained in the vuex warehouse container corresponding to the vuex component; generate the data configuration strategy corresponding to the vuex component according to the inclusion relationship between the calculated attribute and the declared target; and use the data configuration strategy to perform data loading configuration on the vuex component.
8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the steps of the data configuration method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and system for loading external service component package on aPaaS platform
CN115269033A
Vuex data management optimization method and device, electronic equipment and readable storage medium
CN116610315A