Method and device for obtaining dynamic data, and computer-readable storage medium
By traversing the type values of component configurations in the low-code platform, determining and collecting dynamic data sources, and utilizing responsive programming and data source configuration models, the problems of inflexible data source configuration and multiple calls are solved, thereby improving the flexibility of dynamic data processing and front-end performance.
Patent Information
- Application Number
- CN202111599962.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-24
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2041-12-24
AI Technical Summary
Existing low-code platforms have problems with inflexible data source parameter configuration and multiple calls to the same data source in dynamic data processing, resulting in poor front-end performance.
By traversing the type values of page component configurations, determining the dynamic data source, using responsive programming and data source configuration models, collecting target dynamic data sources, updating data, and reducing the number of calls to the same data source.
Improved the flexibility of dynamic data source configuration, reduced the number of calls to the same data source, and improved front-end performance.
Smart Images

Figure CN114329264B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technology, and in particular to a method and device for obtaining dynamic data, and a computer-readable storage medium. Background Art
[0002] With the continuous development of the Internet, web pages are becoming more and more important. In the continuous development of the front-end, the communities corresponding to various technology stacks are becoming more and more prosperous. In order to reduce the work of developers, the industry has developed many low-code platforms, which greatly improved the work efficiency of front-end developers.
[0003] However, these platforms currently have certain shortcomings in dynamic data processing. On the one hand, data source parameter configuration is not flexible and does not support dynamic parameter configuration. On the other hand, there are problems such as multiple calls to the same data source during the page rendering phase. Summary of the Invention
[0004] The embodiments of the present invention provide a method and apparatus for acquiring dynamic data, and a computer-readable storage medium, which improve the flexibility of dynamic data source configuration and reduce the number of calls to the same data source.
[0005] The technical solution of the present invention is achieved as follows:
[0006] An embodiment of the present invention provides a method for acquiring dynamic data, the method comprising:
[0007] Traverse the type values of all data passed from parent to child in the component configuration of the page;
[0008] determining, according to the type value, a target dynamic data source having dynamic parameter configuration among the multiple dynamic data sources, and collecting data from the target dynamic data source;
[0009] The dynamic data of the page is updated by utilizing the collected data of the target dynamic data source.
[0010] In the above solution, determining a target dynamic data source having dynamic parameter configuration among multiple dynamic data sources according to the type value, and collecting the target dynamic data source includes:
[0011] According to the type value, determining the multiple dynamic data sources with dynamic data source configuration from a data source library; the multiple dynamic data sources respectively correspond to their own unique identifiers;
[0012] Obtaining parameter configurations of each of the multiple dynamic data sources, and determining multiple parameter configuration types corresponding to the multiple dynamic data sources one by one by traversing the parameter configurations of each of the multiple dynamic data sources;
[0013] Determining the target dynamic data source based on the multiple dynamic data sources according to the multiple parameter configuration types;
[0014] Data from the target dynamic data source is collected.
[0015] In the above solution, determining the target dynamic data source according to the multiple parameter configuration types and based on the multiple dynamic data sources includes:
[0016] If a responsive data configuration type exists among the multiple parameter configuration types, a dynamic data source corresponding to the responsive data configuration type among the multiple dynamic data sources is determined as the target dynamic data source.
[0017] In the above solution, determining the target dynamic data source according to the multiple parameter configuration types and based on the multiple dynamic data sources includes:
[0018] If a child dynamic data source configuration type exists in the multiple parameter configuration types, the sub-parameter configurations of the child dynamic data sources corresponding to the child dynamic data source configuration type in the multiple parent dynamic data sources are traversed, and based on the sub-parameter configuration types of the sub-parameter configurations, the parameter configuration type judgment is continued until the parent dynamic data source corresponding to the sub-parameter configuration type with a responsive data configuration type is determined; the parent dynamic data source and the child dynamic data source corresponding to the child dynamic data source configuration type in the parent dynamic data source are both used as the target dynamic data source; the multiple parent dynamic data sources are the data sources corresponding to the child dynamic data source configuration type in the multiple dynamic data sources.
[0019] In the above solution, the collecting of data from the target dynamic data source includes:
[0020] Saving the target dynamic data source and the parameter identifier of the target dynamic data source to a preset responsive parameter data source mapping table;
[0021] Package the data of the target dynamic data source in the responsive parameter data source mapping table to determine the observable object;
[0022] Encapsulate the listening function of the component corresponding to the target dynamic data source into the observable object, and determine the encapsulated observable object;
[0023] The encapsulated observable object is saved in a preset component data source mapping table to complete the collection.
[0024] In the above solution, the child dynamic data source corresponding to the child parameter configuration type in the parent dynamic data source carries its own unique identifier and the unique identifier of the parent dynamic data source itself;
[0025] The collecting of data from the target dynamic data source includes:
[0026] Using the carried unique identifier of the parent dynamic data source itself and matching it with the respective unique identifiers of the plurality of dynamic data sources, the parent dynamic data source of the child dynamic data source is determined;
[0027] The unique identifier of the child dynamic data source is stored in the data under the parent dynamic data source to obtain the stored parent dynamic data source;
[0028] Saving the stored parent dynamic data source, the stored parameter identifier of the parent dynamic data source, and the child dynamic data source, the parameter identifier of the child dynamic data source to the preset responsive parameter data source mapping table;
[0029] Packaging the data of the target dynamic data source stored in the responsive parameter data source mapping table to determine the observable object;
[0030] Encapsulating the listening function of the component corresponding to the stored target dynamic data source into the observable object, and determining the encapsulated observable object;
[0031] The encapsulated observable object is saved in a preset component data source mapping table to complete the collection.
[0032] In the above solution, the updating of the dynamic data of the page by using the collected data of the target dynamic data source includes:
[0033] Serializing the data of the plurality of target dynamic data sources in the preset component data source mapping table to obtain a plurality of corresponding character strings;
[0034] De-duplication is performed by comparing the multiple character strings to determine the multiple target dynamic data sources after de-duplication;
[0035] Sorting the plurality of target dynamic data sources after deduplication using a preset algorithm to determine a sorted result;
[0036] According to the sorted results, the dynamic data of the page is updated.
[0037] In the above solution, the updating of dynamic data of the page according to the sorted result includes:
[0038] According to the sorted result and in combination with the request for the data required on the page, assigning a value to the observable object and determining an assignment result;
[0039] If the observable object includes the monitoring function, the assignment result is used to update the dynamic data of the page.
[0040] An embodiment of the present invention provides a device for acquiring dynamic data, the device comprising a traversal unit, a collection unit, and an update unit; wherein,
[0041] The traversal unit is used to traverse the type values of all data passed from the parent to the child in the component configuration of the page;
[0042] The collecting unit is configured to determine, according to the type value, a target dynamic data source having dynamic parameter configuration among the multiple dynamic data sources, and collect data from the target dynamic data source;
[0043] The updating unit is used to update the dynamic data of the page by using the collected data of the target dynamic data source.
[0044] An embodiment of the present invention provides a device for acquiring dynamic data, the device comprising:
[0045] a memory for storing executable instructions;
[0046] The processor is configured to execute the executable instructions stored in the memory. When the executable instructions are executed, the processor executes the method for acquiring dynamic data.
[0047] An embodiment of the present invention provides a storage medium storing executable instructions. When the executable instructions are executed by one or more processors, the processors execute the method for obtaining dynamic data.
[0048] Embodiments of the present invention provide a method and apparatus for acquiring dynamic data. This method traverses the type values of all data transmitted from a parent to a child component configuration on a page; based on the type values, it identifies a target dynamic data source with dynamic parameter configurations among multiple dynamic data sources, collects data from the target dynamic data source, and uses the collected data from the target dynamic data source to update the page's dynamic data. This approach improves the flexibility of dynamic data source configuration and reduces the number of calls to the same data source. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 A schematic diagram of a method for obtaining dynamic data provided by an embodiment of the present invention Figure 1 ;
[0050] Figure 2 A schematic diagram of a method for obtaining dynamic data provided by an embodiment of the present invention Figure 2 ;
[0051] Figure 3A schematic diagram of a method for obtaining dynamic data provided by an embodiment of the present invention Figure 3 ;
[0052] Figure 4 A schematic diagram of a method for obtaining dynamic data provided by an embodiment of the present invention Figure 4 ;
[0053] Figure 5 A schematic diagram of a method for obtaining dynamic data provided by an embodiment of the present invention Figure 5 ;
[0054] Figure 6 A schematic diagram of a method for obtaining dynamic data provided by an embodiment of the present invention Figure 6 ;
[0055] Figure 7 A schematic diagram of a method for obtaining dynamic data provided by an embodiment of the present invention Figure 7 ;
[0056] Figure 8 A schematic diagram of a device for acquiring dynamic data provided by an embodiment of the present invention Figure 1 ;
[0057] Figure 9 A schematic diagram of a device for acquiring dynamic data provided by an embodiment of the present invention Figure 2 . DETAILED DESCRIPTION
[0058] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.
[0059] In order to enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific implementation methods. Figure 1 A schematic diagram of a method for obtaining dynamic data provided by an embodiment of the present invention Figure 1 , will combine Figure 1 The steps shown are explained.
[0060] S101. Traverse the type values of all data passed from the parent to the child in the component configuration of the page.
[0061] In the embodiment of the present invention, the type values of all data transmitted from the parent to the child in the component configuration of the page are traversed, and subsequent operations are performed based on the obtained type values.
[0062] In an embodiment of the present invention, the parent in a component needs to pass data or parameters to the child in a forward direction. After receiving the data or parameters, the child renders different page content or performs operations based on the different data passed. This process of forward data transmission is achieved through props. The child uses props to declare the data that needs to be received from the parent.
[0063] S102: Determine, according to the type value, a target dynamic data source having dynamic parameter configuration among multiple dynamic data sources, and collect data from the target dynamic data source.
[0064] In an embodiment of the present invention, after the type value is obtained, target dynamic data sources with dynamic parameter configurations are determined among multiple dynamic data sources according to the obtained type value, and the target dynamic data sources with dynamic parameter configurations are collected.
[0065] In this embodiment of the present invention, a DataSource, as the name implies, is the source of data, the device or raw media that provides the required data. A DataSource stores all the information needed to establish a database connection. Just as you can find a file in a file system by specifying its name, you can find the corresponding database connection by providing the correct DataSource name.
[0066] In the embodiment of the present invention, the dynamic data source generally refers to a Spring dynamically configured multi-data source, in which dynamic parameters or static parameters can be configured.
[0067] In an embodiment of the present invention, the data source model can be standardized through JSON-Scheam. For example, the basic information of the data source can be configured through the Config field, param supports nested configuration, the interface return field is standardized through the data field, and the type field is used to identify whether it is a dynamic data source configuration. The basic information of the configured data source can be used to determine whether the corresponding data source is a dynamic data source. Props type types include: String, Number, Boolean, Array, and Object.
[0068] S103: Update the dynamic data of the page using the collected data from the target dynamic data source.
[0069] In the embodiment of the present invention, after the target dynamic data source is collected, the dynamic data of the page is updated using the data of the target dynamic data source.
[0070] It is understood that in this embodiment of the present invention, by traversing the type values of all data transmitted from the parent to the child in the component configuration, it is determined whether there is a dynamic parameter configuration in the dynamic data source. If so, the dynamic data source is collected and used to update the dynamic data of the page. This makes the configuration of the dynamic data source more flexible and reduces the number of calls to the same data source.
[0071] In some embodiments of the present invention, see Figure 2 , Figure 2 This is a flow diagram of a method for obtaining dynamic data provided by an embodiment of the present invention. Figure 2 , Figure 2 The S102 shown can be implemented by S1021 to S1024, which will be combined Figure 2 The steps shown are explained.
[0072] S1021. Determine, from a data source library, multiple dynamic data sources with dynamic data source configurations based on the type value; each of the multiple dynamic data sources corresponds to its own unique identifier.
[0073] In some embodiments of the present invention, after traversing all props of the component configuration, the dynamic data source configuration is identified from the data source library according to the type value, and a unique identifier is assigned to each of the identified multiple dynamic data sources.
[0074] In some embodiments of the present invention, the data source library includes dynamic data sources and static data sources, and the identifiers allocated to the multiple dynamic data sources may be IDs, which is not limited by the present invention.
[0075] S1022: Obtain parameter configurations of each of the multiple dynamic data sources, and determine multiple parameter configuration types corresponding to the multiple dynamic data sources one by one by traversing the parameter configurations of each of the multiple dynamic data sources.
[0076] In some embodiments of the present invention, after multiple dynamic data sources are found in the data source library, parameter configuration information of each of the multiple dynamic data sources is obtained, and the parameter configuration type corresponding to each of the multiple dynamic data sources is determined based on the parameter configuration information.
[0077] In some embodiments of the present invention, static parameters or dynamic parameters may be configured in the dynamic data source.
[0078] S1023. Determine a target dynamic data source according to multiple parameter configuration types and based on multiple dynamic data sources.
[0079] In some embodiments of the present invention, a target dynamic data source is determined from among the multiple dynamic data sources according to parameter configuration types of the multiple dynamic data sources.
[0080] In some embodiments of the present invention, the parameter configuration of the dynamic data source may be a dynamic parameter configuration or a static parameter configuration, and the parameters of the determined target dynamic data source are dynamic parameter configurations.
[0081] S1024. Collect data from the target dynamic data source.
[0082] In some embodiments of the present invention, after a target dynamic data source is determined among multiple dynamic data sources, the obtained target dynamic data source is collected.
[0083] In some embodiments of the present invention, the updated dynamic data source of the page is completed using the collected target dynamic data source.
[0084] It can be understood that in some embodiments of the present invention, after obtaining multiple dynamic data sources from the data source library based on the type value, a unique identifier is assigned to the obtained dynamic data source, and based on the parameter configuration of the dynamic data source, the required target dynamic data source is obtained from the multiple dynamic data sources, so that the dynamic data source can support dynamic parameter configuration, thereby improving the flexibility of configuration.
[0085] In some embodiments of the present invention, S1023 can be implemented through S1023a, which will be described in conjunction with the steps.
[0086] S1023a: If a responsive data configuration type exists among the multiple parameter configuration types, a dynamic data source corresponding to the responsive data configuration type among the multiple dynamic data sources is determined as a target dynamic data source.
[0087] In some implementations of the present invention, the parameter configuration types of multiple dynamic data sources are traversed. If there is a dynamic data source whose parameter configuration type is a responsive data configuration type, then the dynamic data source corresponding to the responsive data configuration type is determined as the target dynamic data source.
[0088] In some embodiments of the present invention, S1023 can be implemented through S1023b, which will be described in conjunction with the steps.
[0089] 1023b. If a sub-dynamic data source configuration type exists in multiple parameter configuration types, then traverse the sub-parameter configurations of the sub-dynamic data sources corresponding to the sub-dynamic data source configuration type in the multiple parent dynamic data sources, and continue to judge the parameter configuration type based on the sub-parameter configuration types of the sub-parameter configurations until the parent dynamic data source corresponding to the sub-parameter configuration type with the responsive data configuration type is determined; the parent dynamic data source and the sub-dynamic data source corresponding to the sub-dynamic data source configuration type in the parent dynamic data source are both used as target dynamic data sources; multiple parent dynamic data sources are data sources corresponding to the sub-dynamic data source configuration type in the multiple dynamic data sources.
[0090] In some embodiments of the present invention, the parameter configuration types of multiple dynamic data sources are traversed. If there is a dynamic data source whose parameter configuration type is a sub-dynamic data source configuration type, then the sub-parameter configuration of the sub-dynamic data source corresponding to the sub-dynamic data source configuration type is traversed. According to the sub-parameter configuration type of the sub-parameter configuration, the parameter configuration type judgment is continued until the parent dynamic data source corresponding to the sub-parameter configuration type with a responsive data configuration type is found. Then, the parent dynamic data source and the sub-dynamic data source corresponding to the sub-dynamic data source configuration type in the parent dynamic data source are both used as target dynamic data sources.
[0091] In some embodiments of the present invention, if there are dynamic data sources a and dynamic data sources b, and the parameter configuration type of dynamic data source b is a sub-dynamic data source configuration type, then continue to traverse the sub-parameter configuration type of the sub-dynamic data source c corresponding to the sub-dynamic data source configuration type. If the parameter configuration type of the sub-dynamic data source c is a responsive data configuration type, then both the sub-dynamic data source c and the parent dynamic data source b of the sub-dynamic data source c are used as target dynamic data sources. If the parameter configuration type of the sub-dynamic data source c is still a dynamic data source type, based on the parameter configuration type of the dynamic data source, continue to judge the parameter configuration type until the parent dynamic data source corresponding to the sub-parameter configuration type with a responsive data configuration type is determined, and then both the parent dynamic data source and the sub-dynamic data source corresponding to the sub-dynamic data source configuration type in the parent dynamic data source are used as target dynamic data sources.
[0092] In some embodiments of the present invention, see Figure 3 , Figure 3 This is a flow diagram of a method for obtaining dynamic data provided by an embodiment of the present invention. Figure 3 , Figure 3 The S1024 shown can be implemented by S1024a to S1024d, which will be combined Figure 3 The steps shown are explained.
[0093] S1024a: Save the target dynamic data source and the parameter identifier of the target dynamic data source to a preset responsive parameter data source mapping table.
[0094] In some embodiments of the present invention, after the target dynamic data source is acquired, the target dynamic data source and the parameter identifier of the target dynamic data source are saved in an initial responsive parameter data source mapping table (ObserverSourceMap).
[0095] In some embodiments of the present invention, the parameter identifier may be the name of the parameter.
[0096] S1024b. Package the data of the target dynamic data source in the responsive parameter data source mapping table to determine the observable object.
[0097] In some embodiments of the present invention, the data of the target dynamic data source stored in the responsive parameter data source mapping table is packaged to determine the observable object.
[0098] In some embodiments of the present invention, the data of the target dynamic data source is packaged into an object. For example, if the data is 1 and 2, the data is packaged into an object such as {a:1, b:2}, and then this object can become an observer object.
[0099] S1024c. Encapsulate the monitoring function of the component corresponding to the target dynamic data source into an observable object, and determine the encapsulated observable object.
[0100] In some embodiments of the present invention, the listening function of the update component forceupdate corresponding to the target dynamic data source is encapsulated into an observable object, and the encapsulated observable object is obtained.
[0101] In some embodiments of the present invention, after the monitoring function of the update component forceupdate is encapsulated into an observable object, the object is {a:1, b:2, function: forceupdate}.
[0102] S1024d. Save the encapsulated observable object to the preset component data source mapping table to complete the collection.
[0103] In some embodiments of the present invention, the encapsulated observable object is saved in the initial component data source mapping table (DataSourceMap) until all dynamic data sources configured in the component props are processed and the collection is completed.
[0104] In some embodiments of the present invention, the structure of the component data source mapping table (DataSourceMap) may be {map1:{a:1,b:2,function:forceupdate},…mapn}.
[0105] It is understood that in some embodiments of the present invention, the target dynamic data source and its parameter identifiers are saved to a preset responsive parameter data source mapping and then packaged to determine an observable object; the listener function of the component corresponding to the target dynamic data source is encapsulated into the observable object to determine the encapsulated observable object; and finally, the data is saved to a preset component data source mapping table to complete the collection. This makes dynamic data source configuration more flexible, supports dynamic parameter configuration, and thus enables the updating of dynamic data on the page.
[0106] In some embodiments of the present invention, see Figure 4 , Figure 4 This is a flow diagram of a method for obtaining dynamic data provided by an embodiment of the present invention. Figure 4 , Figure 4 The S1024 shown can be implemented by S1024e to S1024j, which will be combined Figure 4 The steps shown are explained.
[0107] S1024e. Determine the parent dynamic data source of the child dynamic data source by matching the unique identifier of the parent dynamic data source with the unique identifiers of the multiple dynamic data sources, wherein the child dynamic data source corresponding to the child parameter configuration type in the parent dynamic data source carries its own unique identifier and the unique identifier of the parent dynamic data source.
[0108] In some embodiments of the present invention, because the child dynamic data source corresponding to the child parameter configuration type in the parent dynamic data source carries not only its own unique identifier, but also carries the unique identifier of the parent dynamic data source itself, the parent dynamic data source corresponding to the child dynamic data source can be found by matching the unique identifier of the parent dynamic data source itself with the respective identifiers of multiple dynamic data sources.
[0109] S1024f. Store the unique identifier of the child dynamic data source in the data under the parent dynamic data source to obtain the stored parent dynamic data source.
[0110] In some embodiments of the present invention, after the corresponding parent dynamic data source is determined, the unique identifier of the child dynamic data source itself is stored in an array under the parent dynamic data source.
[0111] In some embodiments of the present invention, the parent dynamic data source defines a childDatasource array variable, and then stores the unique identifier of the child dynamic data source itself in the array.
[0112] S1024g: Save the stored parent dynamic data source, the stored parameter identifier of the parent dynamic data source, the child dynamic data source, and the parameter identifier of the child dynamic data source to a preset responsive parameter data source mapping table.
[0113] In some embodiments of the present invention, if the parameter configuration type of a dynamic data source is a sub-dynamic data source configuration type, according to S1023b, the parent dynamic data source corresponding to the sub-parameter configuration type with the responsive data configuration type is finally determined, and then the sub-dynamic data source corresponding to the sub-dynamic data source configuration type in the parent dynamic data source is found, and the stored parent dynamic data source and sub-dynamic data source are both used as target dynamic data sources. Finally, the stored parent dynamic data source, the stored parameter identifiers of the parent dynamic data source, and the sub-dynamic data source and sub-dynamic data source parameter identifiers are saved in the responsive parameter data source mapping table (ObserverSourceMap).
[0114] S1024h: Package the data of the target dynamic data source stored in the responsive parameter data source mapping table to determine an observable object.
[0115] In some embodiments of the present invention, the data of the target dynamic data source in the responsive parameter data source mapping table is packaged to determine the observable object.
[0116] In some embodiments of the present invention, this step is similar to S1024b and will not be described again here.
[0117] S1024i. Encapsulate the listening function of the component corresponding to the stored target dynamic data source into an observable object, and determine the encapsulated observable object.
[0118] In some embodiments of the present invention, the listening function of the update component forceupdate corresponding to the target dynamic data source is encapsulated into an observable object, and the encapsulated observable object is obtained.
[0119] In some embodiments of the present invention, this step is similar to S1024c and will not be described again here.
[0120] S1024j. Save the encapsulated observable object to the preset component data source mapping table to complete the collection.
[0121] In some embodiments of the present invention, the encapsulated observable object is saved in the initial component data source mapping table (DataSourceMap) until all dynamic data sources configured in the component props are processed and the collection is completed.
[0122] In some embodiments of the present invention, this step is similar to S1024d and will not be described again here.
[0123] In some embodiments of the present invention, see Figure 5 , Figure 5 This is a flow diagram of a method for obtaining dynamic data provided by an embodiment of the present invention. Figure 5, Figure 5 The S103 shown can be implemented by S1031 to S1034, which will be combined Figure 5 The steps shown are explained.
[0124] S1031. Serialize the data of multiple target dynamic data sources in a preset component data source mapping table to obtain multiple corresponding character strings.
[0125] In some embodiments of the present invention, after serializing the data of multiple target dynamic data sources in the component data source mapping table, a corresponding plurality of character strings are obtained.
[0126] In some embodiments of the present invention, serialization is the process of converting an object's state information into a form that can be stored or transmitted. During serialization, an object writes its current state to a temporary or persistent storage area. The object can later be recreated by reading or deserializing the object's state from the storage area.
[0127] S1032: De-duplicate the characters by comparing the multiple character strings, and determine the multiple target dynamic data sources after de-duplicate.
[0128] In some embodiments of the present invention, after multiple corresponding character strings are obtained in S1031, the multiple character strings are compared and then deduplicated to obtain a deduplicated target dynamic data source.
[0129] S1033. Sort the multiple target dynamic data sources after deduplication using a preset algorithm to determine the sorted results.
[0130] In some embodiments of the present invention, a preset algorithm is used to sort the multiple data sources after deduplication to determine a sorted result.
[0131] In some embodiments of the present invention, the Kahn algorithm starts with a vertex with no input, deletes all edges emanating from this vertex, and repeats this process until no edges are left. The order in which the vertices are traversed is the topological sort. The Kahn algorithm can also be used to sort multiple data sources after deduplication, and this is not a limitation of the present invention.
[0132] S1034. Update the dynamic data of the page according to the sorted results.
[0133] In some embodiments of the present invention, the sorted results are used to update the dynamic data of the page.
[0134] It is understandable that in some embodiments of the present invention, after the target dynamic data source is collected, it is deduplicated and sorted, so that the number of calls to the same data source can be reduced when the page is rendered, thereby realizing the update of the dynamic data of the page.
[0135] In some embodiments of the present invention, see Figure 6 , Figure 6 This is a flow diagram of a method for obtaining dynamic data provided by an embodiment of the present invention. Figure 6 , Figure 6 The S1034 shown can be realized by S10341 to S10342, which will be combined Figure 6 The steps shown are explained.
[0136] S10341. According to the sorted results and in combination with the request for the required data on the page, the observable object is assigned a value to determine the assignment result.
[0137] In some embodiments of the present invention, based on the result of the topological sorting and in combination with the request for the required data on the page, the observable object is assigned a value to determine the assignment result.
[0138] In some embodiments of the present invention, after sorting the data in multiple dynamic data sources, network requests are sent in sequence for the data required on the page according to the sorting, and the corresponding data is requested. After the data is requested, the corresponding values are assigned one by one according to the objects just encapsulated.
[0139] S10342. If the observable object contains a listening function, the assignment result is used to update the dynamic data of the page.
[0140] In some embodiments of the present invention, if the observable object includes a listening function, the assignment result is used to implement the updating of dynamic data of the page.
[0141] In some embodiments of the present invention, if the observer object is {a:1, b:2, function: forceupdate} or {a:1, b:2, function: null}, the page will be updated if the forceupdate listener function exists, and will not be updated if the forceupdate listener function does not exist. In this way, the data on the page will be dynamically updated or not updated.
[0142] It is understandable that in the embodiments of the present invention, the current low-code platform has inflexible dynamic data source configuration when processing dynamic data, does not support dynamic parameter configuration, such as URL hash parameter passing, etc., and the dynamic data sources configured by multiple components under the page are redundant, and there are multiple calls during the page rendering phase, resulting in poor front-end performance. The present invention improves the flexibility of dynamic data source configuration and reduces the number of calls to the same data source by optimizing the data source configuration model and introducing responsive programming.
[0143] The embodiment of the present invention provides a method for obtaining dynamic data, and the specific steps are as follows:
[0144] Data source collection phase:
[0145] S1. During the component initialization phase, determine whether DataSourceMap (component data source mapping list) and ObserverSourceMap (responsive parameter data source mapping list) are passed in. If not, initialize the above two variables.
[0146] S2. Traverse all props of the component configuration, identify the dynamic data source configuration by the type value of dynimic, and assign a unique id to the identified dynamic data source.
[0147] S3. Traverse the dynamic data source Param configuration, identify the type of param configuration according to the param type, and process them separately.
[0148] S4. If the param type is a dynamically changing data type such as hash, the corresponding name and data source information are collected and saved in ObserverSourceMap.
[0149] S5. If the param type is a dynimic data source type, process the param data source configuration information according to steps 2-6.
[0150] S6. After the parameter data source analysis is completed, the data source ID of the current parameter configuration is inserted into the childDatasource field of the parent data source.
[0151] S7. After parameter processing is completed, the data field returned by the data source is packaged as an Observer (observable) object, and the ForceUpdate function of the current component is bound as a listening function, and the current data source is saved to the DataSourceMap.
[0152] S8. Loop through steps 1-8 until all dynamic data sources configured in the component props are processed.
[0153] The embodiment of the present invention provides a method for obtaining dynamic data, the optional flow chart is as follows Figure 7 The specific steps are as follows:
[0154] Data source execution phase:
[0155] S11. Initialize the page variable DataSourceMap (component data source mapping list) and ObserverSourceMap responsive parameter data source mapping list).
[0156] S12. Traverse the list of all components under the page.
[0157] S13. Inject DataSourceMap and ObserverSourceMap.
[0158] S14. Collect the current component data source list.
[0159] S15. If there are components that have not collected data sources, execute S12; otherwise, execute S16.
[0160] S16. DataSourceMap deduplicates data based on the configured JSON serialization.
[0161] S17. Use the Kahn algorithm to sort the data configured on the current page.
[0162] S18. Call all data sources in parallel in sequence and assign the Observer object after returning.
[0163] S19. Trigger component re-rendering based on Observer changes.
[0164] It is understandable that in the embodiments of the present invention, the current low-code platform has inflexible dynamic data source configuration when processing dynamic data, does not support dynamic parameter configuration, such as URL hash parameter passing, etc., and the dynamic data sources configured by multiple components under the page are redundant, and there are multiple calls during the page rendering phase, resulting in poor front-end performance. The present invention improves the flexibility of dynamic data source configuration and reduces the number of calls to the same data source by optimizing the data source configuration model and introducing responsive programming.
[0165] The embodiment of the present invention provides a schematic diagram of the structure of a device for obtaining dynamic data, such as Figure 8 As shown, the device for obtaining dynamic data includes: a traversal unit 801, a collection unit 802, and an update unit 803; wherein,
[0166] The traversal unit 801 is used to traverse the type values of all data transmitted from the parent to the child in the component configuration of the page.
[0167] The collecting unit 802 is configured to determine, according to the type value, a target dynamic data source having dynamic parameter configurations among multiple dynamic data sources, and collect data from the target dynamic data source.
[0168] The updating unit 803 is used to update the dynamic data of the page using the collected data of the target dynamic data source.
[0169] In some embodiments of the present invention, the collection unit 802 is further used to determine, from a data source library, the multiple dynamic data sources with dynamic data source configurations based on the type value; the multiple dynamic data sources correspond to their own unique identifiers respectively; and obtain the parameter configurations of each of the multiple dynamic data sources, and determine the multiple parameter configuration types corresponding one-to-one to the multiple dynamic data sources by traversing the parameter configurations of each of the multiple dynamic data sources; and determine the target dynamic data source based on the multiple dynamic data sources according to the multiple parameter configuration types; and collect data of the target dynamic data source.
[0170] In some embodiments of the present invention, the collection unit 802 is further used to determine the dynamic data source corresponding to the responsive data configuration type among the multiple dynamic data sources as the target dynamic data source if there is a responsive data configuration type among the multiple parameter configuration types.
[0171] In some embodiments of the present invention, the collection unit 802 is further used to, if a child dynamic data source configuration type exists in the multiple parameter configuration types, traverse the sub-parameter configurations of the child dynamic data sources in the multiple parent dynamic data sources corresponding to the child dynamic data source configuration type, and continue to judge the parameter configuration type based on the sub-parameter configuration types of the sub-parameter configurations until a parent dynamic data source corresponding to the sub-parameter configuration type with a responsive data configuration type is determined; the parent dynamic data source and the child dynamic data source corresponding to the child dynamic data source configuration type in the parent dynamic data source are both used as the target dynamic data source; the multiple parent dynamic data sources are the data sources corresponding to the child dynamic data source configuration type in the multiple dynamic data sources.
[0172] In some embodiments of the present invention, the collection unit 802 is further used to save the target dynamic data source and the parameter identifier of the target dynamic data source to a preset responsive parameter data source mapping table; and to package the data of the target dynamic data source in the responsive parameter data source mapping table to determine the observable object; and to encapsulate the listening function of the component corresponding to the target dynamic data source into the observable object to determine the encapsulated observable object; and to save the encapsulated observable object to a preset component data source mapping table to complete the collection.
[0173] In some embodiments of the present invention, the child dynamic data source corresponding to the child parameter configuration type in the parent dynamic data source carries its own unique identifier and the unique identifier of the parent dynamic data source itself; the collection unit 802 is further used to use the carried unique identifier of the parent dynamic data source itself to match the unique identifiers of multiple dynamic data sources to determine the parent dynamic data source of the child dynamic data source; and store the unique identifier of the child dynamic data source itself in the data under the parent dynamic data source to obtain the stored parent dynamic data source; and save the stored parent dynamic data source, the stored parent dynamic data source parameter identifiers and the child dynamic data source, the child dynamic data source parameter identifiers to the preset responsive parameter data source mapping table; and package the target dynamic data source data stored in the responsive parameter data source mapping table to determine an observable object; and encapsulate the listening function of the component corresponding to the stored target dynamic data source into the observable object to determine the encapsulated observable object; and save the encapsulated observable object to the preset component data source mapping table to complete the collection.
[0174] In some embodiments of the present invention, the update unit 803 is also used to serialize the data of the multiple target dynamic data sources in the preset component data source mapping table to obtain the corresponding multiple character strings; and to perform deduplication by comparing the multiple character strings to determine the multiple target dynamic data sources after deduplication; and to sort the multiple target dynamic data sources after deduplication by using a preset algorithm to determine the sorted results; and to update the dynamic data of the page based on the sorted results.
[0175] In some embodiments of the present invention, the update unit 803 is also used to assign a value to the observable object based on the sorted result and the request for the data required on the page to determine the assignment result; and if the observable object contains the listening function, the assignment result is used to update the dynamic data of the page.
[0176] It can be understood that in the above-mentioned device implementation scheme, by optimizing the data source configuration model and introducing responsive programming, the dynamic data source supports dynamic parameter configuration, which improves the flexibility of configuration and reduces the number of calls to the same data source during the page rendering stage.
[0177] Based on the method of the above embodiment, the embodiment of the present invention also provides a schematic diagram of the structure of a device for obtaining dynamic data, such as Figure 9As shown, the device for obtaining dynamic data includes: a processor 901 and a memory 902; the memory 902 stores one or more programs executable by the processor 901, and when one or more programs are executed, the processor 901 executes any one of the methods for obtaining dynamic data in the embodiments described above.
[0178] An embodiment of the present invention provides a computer-readable storage medium storing one or more programs. The one or more programs can be executed by one or more processors. When the programs are executed by the processors, the method for obtaining dynamic data according to the embodiment of the present invention is implemented.
[0179] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage and optical storage, etc.) containing computer-usable program code.
[0180] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0181] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0182] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0183] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention.
Claims
1. A method for obtaining dynamic data, characterized in that: include: Traverse the type values of all data passed from parent to child in the component configuration of the page; According to the type value, determining multiple dynamic data sources with dynamic data source configuration from a data source library; the multiple dynamic data sources respectively correspond to their own unique identifiers; Obtaining parameter configurations of each of the multiple dynamic data sources, and determining multiple parameter configuration types corresponding to the multiple dynamic data sources one by one by traversing the parameter configurations of each of the multiple dynamic data sources; Determining a target dynamic data source based on the multiple dynamic data sources according to the multiple parameter configuration types, and collecting data from the target dynamic data source; The dynamic data of the page is updated by utilizing the collected data of the target dynamic data source.
2. The method according to claim 1, characterized in that The determining the target dynamic data source according to the multiple parameter configuration types and based on the multiple dynamic data sources includes: If a responsive data configuration type exists among the multiple parameter configuration types, a dynamic data source corresponding to the responsive data configuration type among the multiple dynamic data sources is determined as the target dynamic data source.
3. The method according to claim 1, characterized in that The determining the target dynamic data source according to the multiple parameter configuration types and based on the multiple dynamic data sources includes: If a child dynamic data source configuration type exists in the multiple parameter configuration types, the sub-parameter configurations of the child dynamic data sources corresponding to the child dynamic data source configuration type in the multiple parent dynamic data sources are traversed, and based on the sub-parameter configuration types of the sub-parameter configurations, the parameter configuration type judgment is continued until the parent dynamic data source corresponding to the sub-parameter configuration type with a responsive data configuration type is determined; the parent dynamic data source and the child dynamic data source corresponding to the child dynamic data source configuration type in the parent dynamic data source are both used as the target dynamic data source; the multiple parent dynamic data sources are the data sources corresponding to the child dynamic data source configuration type in the multiple dynamic data sources.
4. The method according to claim 2, characterized in that The collecting of data from the target dynamic data source includes: Saving the target dynamic data source and the parameter identifier of the target dynamic data source to a preset responsive parameter data source mapping table; Package the data of the target dynamic data source in the responsive parameter data source mapping table to determine the observable object; Encapsulate the listening function of the component corresponding to the target dynamic data source into the observable object, and determine the encapsulated observable object; The encapsulated observable object is saved in a preset component data source mapping table to complete the collection.
5. The method according to claim 3, characterized in that The child dynamic data source corresponding to the child parameter configuration type in the parent dynamic data source carries its own unique identifier and the unique identifier of the parent dynamic data source itself; The collecting of data from the target dynamic data source includes: Using the carried unique identifier of the parent dynamic data source itself and matching it with the respective unique identifiers of the plurality of dynamic data sources, the parent dynamic data source of the child dynamic data source is determined; The unique identifier of the child dynamic data source is stored in the data under the parent dynamic data source to obtain the stored parent dynamic data source; Saving the stored parent dynamic data source, the stored parameter identifier of the parent dynamic data source, and the child dynamic data source, the parameter identifier of the child dynamic data source to a preset responsive parameter data source mapping table; Packaging the data of the target dynamic data source stored in the responsive parameter data source mapping table to determine the observable object; Encapsulating the listening function of the component corresponding to the stored target dynamic data source into the observable object, and determining the encapsulated observable object; The encapsulated observable object is saved in a preset component data source mapping table to complete the collection.
6. The method according to claim 1, wherein The updating of the dynamic data of the page by utilizing the collected data of the target dynamic data source includes: Serializing the data of the plurality of target dynamic data sources in the preset component data source mapping table to obtain a plurality of corresponding character strings; De-duplication is performed by comparing the multiple character strings to determine the multiple target dynamic data sources after de-duplication; Sorting the plurality of target dynamic data sources after deduplication using a preset algorithm to determine a sorted result; According to the sorted results, the dynamic data of the page is updated.
7. The method according to claim 6, characterized in that The updating of the dynamic data of the page according to the sorted result includes: According to the sorted results and in combination with the request for the data required on the page, the observable object is assigned a value to determine the assignment result; If the observable object includes a listening function, the assignment result is used to update the dynamic data of the page.
8. A device for acquiring dynamic data, characterized in that: The dynamic data acquisition device includes a traversal unit, a collection unit and an update unit; wherein, The obtained traversal unit is used to traverse the type values of all data passed from the parent to the child in the component configuration of the page; The collecting unit is configured to determine, from a data source library, a plurality of dynamic data sources having dynamic data source configurations according to the type value; the plurality of dynamic data sources respectively correspond to respective unique identifiers; obtain parameter configurations of the plurality of dynamic data sources, determine a plurality of parameter configuration types corresponding to the plurality of dynamic data sources one by one by traversing the parameter configurations of the plurality of dynamic data sources; determine a target dynamic data source based on the plurality of dynamic data sources according to the plurality of parameter configuration types, and collect data from the target dynamic data source; The updating unit is used to update the dynamic data of the page by using the collected data of the target dynamic data source.
9. A device for acquiring dynamic data, characterized in that: The dynamic data acquisition device comprises: a memory for storing executable instructions; A processor, configured to implement the method according to any one of claims 1 to 7 when executing the executable instructions stored in the memory.
10. A computer-readable storage medium, characterized in that Executable instructions are stored, which are used to cause a processor to execute and implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method for realizing table nesting form function based on element-ui
CN111832272A
Web site design system integrating dynamic layout and dynamic content
US20130219263A1