A method, apparatus, device, and storage medium for displaying pages based on UI components.
By wrapping the UI component library in the data provider layer, automatic loading and shared data sources are achieved, solving the problem of low reusability of the UI component library and improving the reusability of UI components and the rendering performance of the front-end page.
Patent Information
- Application Number
- CN202211448870.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-18
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2042-11-18
AI Technical Summary
Traditional UI component library usage suffers from low UI component reusability, forcing developers to constantly manually load and process data.
By wrapping the UI component library in the data provider layer, the data provider layer automatically loads task data into the data operation layer. The UI components then retrieve and render the data from the data operation layer, achieving automatic loading and sharing of data sources and avoiding duplicate loading.
It improves the reusability of UI components, reduces browser performance overhead, and enhances the rendering performance of front-end pages.
Smart Images

Figure CN115756644B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a page display method, apparatus, computer device, and storage medium based on UI components. Background Technology
[0002] The rendering of a user interface (UI) typically involves the execution of application logic, framework logic, and layout operations to generate user page rendering commands, which are then executed by the rendering engine to render the user page.
[0003] There is a method for using a UI component library. First, the data required by the UI component, such as user information, needs to be loaded. Second, the data is processed into the data format required by the UI component. Finally, the processed data is passed into the UI component to complete the task.
[0004] However, the applicant found that traditional UI component library usage methods are generally not intelligent. These methods require users to manually load and process the necessary data repeatedly, resulting in extremely low reusability of UI components. Therefore, it is evident that traditional UI component library usage methods suffer from low UI component reusability. Summary of the Invention
[0005] The purpose of this application is to provide a page display method, apparatus, computer device, and storage medium based on UI components, so as to solve the problem of low reusability of UI components in traditional UI component library usage methods.
[0006] To address the aforementioned technical problems, this application provides a page display method based on UI components, employing the following technical solution:
[0007] The raw task data carrying the original data type is obtained through the data providing layer. The data providing layer wraps a UI component library and defines N data types and N task data corresponding to the N data types, where N is a positive integer.
[0008] Among the N data types in the data providing layer, the data type that matches the original data type is identified as the target data type;
[0009] Load the target task data corresponding to the target data type, and store the target task data in the data operation layer;
[0010] The target task data is obtained in the data operation layer according to the data operation method of the data operation layer;
[0011] Obtain the target UI component that matches the target task data from the UI component library;
[0012] The target task data is rendered to the UI page based on the target UI component.
[0013] Furthermore, after the step of rendering the target task data to the UI page according to the target UI component, the following steps are also included:
[0014] Receive feedback data sent by the user when performing operations on the target task data being rendered;
[0015] The overloaded method provided by the data operation layer is invoked to perform data overload operation on the feedback data to obtain overloaded task data;
[0016] The target UI component is invoked to perform a data refresh operation on the data operation layer in order to obtain the reloaded task data;
[0017] The reloaded task data is rendered based on the target UI component to perform a page update operation.
[0018] Furthermore, the step of calling the overload method provided by the data operation layer to perform data reload operation on the feedback data to obtain reloaded task data specifically includes the following steps:
[0019] The configuration update interface of the data operation layer is invoked to update the configuration data of the data provision layer based on the feedback data.
[0020] The data provider layer is invoked to load data based on the updated configuration data to obtain the reloaded task data.
[0021] Furthermore, prior to the step of obtaining the raw task data carrying the original data type through the data providing layer, the following steps are also included:
[0022] Create an initial UI component library;
[0023] Multiple pre-compiled UI controls are encapsulated into corresponding UI components, wherein the target UI component is a component among the multiple UI components;
[0024] Multiple UI components are added to the initial UI component library to generate the UI component library.
[0025] Furthermore, the step of adding multiple UI components to the initial UI component library to generate the UI component library specifically includes the following steps:
[0026] Based on the layout information of each UI control and the interaction information between at least two UI controls, determine the component layout information of each UI component and the component interaction information between the UI components corresponding to at least two UI controls;
[0027] The UI component library is generated by adding multiple UI components, the component layout information of each UI component, and the component interaction information between at least two UI components to the initial UI component library.
[0028] Furthermore, prior to the step of rendering the target task data to the UI page based on the target UI component, the following steps are specifically included:
[0029] Obtain the target component layout information and the target component interaction information corresponding to the target UI component;
[0030] The UI page is generated based on the target UI component, the target component layout information, and the target component interaction information.
[0031] Furthermore, after the step of rendering the target task data to the UI page according to the target UI component, the following steps are also included:
[0032] Save the UI page;
[0033] If a next page loading request for the UI page is received and the current network is abnormal, the saved UI page will be rendered and displayed.
[0034] To address the aforementioned technical problems, this application also provides a page display device based on UI components, employing the following technical solution:
[0035] The task data acquisition module is used to acquire raw task data carrying raw data types through the data providing layer. The data providing layer includes a UI component library and defines N data types and N task data corresponding to the N data types, where N is a positive integer.
[0036] The data type confirmation module is used to confirm, among the N data types in the data providing layer, that the data type consistent with the original data type is the target data type;
[0037] The target data loading module is used to load target task data corresponding to the target data type and store the target task data in the data operation layer;
[0038] The target data acquisition module is used to acquire the target task data in the data operation layer according to the data operation method of the data operation layer;
[0039] The target component acquisition module is used to acquire target UI components that match the target task data from the UI component library.
[0040] The rendering module is used to render the target task data to the UI page based on the target UI component.
[0041] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution:
[0042] It includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps of the UI component-based page display method as described above.
[0043] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below:
[0044] The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the UI component-based page display method described above.
[0045] This application provides a page display method based on UI components, comprising: obtaining raw task data carrying raw data types through a data providing layer, wherein the data providing layer wraps a UI component library, the data providing layer defines N data types and N task data corresponding to the N data types, where N is a positive integer; identifying a data type consistent with the raw data type from the N data types in the data providing layer as a target data type; loading target task data corresponding to the target data type and storing the target task data in a data operation layer; obtaining the target task data in the data operation layer according to the data operation method of the data operation layer; obtaining a target UI component matching the target task data from the UI component library; and rendering the target task data onto a UI page according to the target UI component. Compared with existing technologies, this application wraps the UI component library in a data provision layer. The data provision layer then automatically loads task data into the data operation layer. The UI components obtain the task data from the data operation layer and use this data for rendering to satisfy user tasks such as selection. This achieves automatic data loading and injection into the UI components, freeing developers from the details of data acquisition; they only need to use the acquired data. Furthermore, since the data operation layer is a global data source, multiple UI components can share this data source, enabling multiple UI components to reuse data, avoiding repeated loading, reducing browser performance overhead, and improving the rendering performance of the front-end page. Attached Figure Description
[0046] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;
[0048] Figure 2 This is a flowchart illustrating the implementation of the UI component-based page display method provided in Embodiment 1 of this application;
[0049] Figure 3 yes Figure 1 A flowchart of a specific implementation method following step S206;
[0050] Figure 4 yes Figure 3 A flowchart of a specific implementation of step S302;
[0051] Figure 5yes Figure 1 A flowchart of a specific implementation method prior to step S201;
[0052] Figure 6 yes Figure 5 A flowchart of a specific implementation of step S503;
[0053] Figure 7 yes Figure 1 A flowchart of a specific implementation method prior to step S206;
[0054] Figure 8 yes Figure 1 A flowchart of another specific implementation method following step S206;
[0055] Figure 9 A schematic diagram of the structure of the UI component-based page display device provided in Embodiment 2 of this application;
[0056] Figure 10 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation
[0057] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0058] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0059] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0060] like Figure 1As shown, system architecture 200 may include terminal devices 101, 102, and 103, network 104, and server 105. Network 104 is used as a medium to provide communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.
[0061] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0062] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.
[0063] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.
[0064] It should be noted that the UI component-based page display method provided in this application embodiment is generally executed by a server / terminal device, and correspondingly, the UI component-based page display device is generally set in the server / terminal device.
[0065] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0066] Example 1
[0067] Continue to refer to Figure 2 The diagram shows the implementation flowchart of the page display method based on UI components provided in Embodiment 1 of this application. For ease of explanation, only the parts related to this application are shown.
[0068] The above-described UI component-based page display method includes the following steps:
[0069] Step S201: Obtain the original task data carrying the original data type through the data provider layer. The data provider layer wraps the UI component library and defines N data types and N task data corresponding to the N data types, where N is a positive integer.
[0070] In this embodiment of the application, the data provider layer, namely DataProvider, can not only obtain the corresponding data according to the business abstraction type, but also process the data using a custom loading process.
[0071] In this embodiment, the DataProvider (data provider layer) has built-in types abstracted from different business data. Business data of the corresponding type can be automatically loaded by passing in the business type. Simultaneously, it abstracts and formats the business data from different types of interface responses, storing it in a unified format within the data provider layer. For example, if the data type is `task`, the model is `{uuid:string,name:string,type:number}`, the retrieval configuration is `{type:number}`, and the retrieval method is to obtain the corresponding `task` data based on the passed-in data type `task` and data configuration `type`. It should be understood that the examples of the data provider layer definition here are for ease of understanding only and are not intended to limit this application.
[0072] In this embodiment, the DataProvider can receive custom types and bind custom loading processes. This custom approach can satisfy special logical scenarios that cannot be built in, and in these special scenarios, the DataProvider can reuse all data.
[0073] In this embodiment, the DataProvider (data provider layer) can receive configurations that conform to the business model to load the corresponding data according to the configuration. For example, if there are two users, A and B, the business model configuration can flexibly assemble either A or B to load and reuse the corresponding data.
[0074] In this embodiment of the application, business personnel need to predefine the data type, model, retrieval configuration and method in the DataProvider (data provider layer). For example, a data type is defined as task, the model is {uuid:string,name:string,type:number}, the retrieval configuration is {type:number}, and the retrieval method is to retrieve the task data of the corresponding type based on the input data type task and data configuration type.
[0075] In this embodiment, the original task data (task) refers to a specific task. It includes a primary key (UUID), a task name (name), and a task type (type).
[0076] In this embodiment of the application, the UI component library is pre-created and contains multiple UI components. The UI components in the UI component library are components obtained by developers by encapsulating commonly used UI controls. Each UI component in the UI component library is independent of each other, and inter-component relationships can be pre-established between two or more components to generate higher-level components.
[0077] Step S202: Among the N data types in the data provider layer, identify the data type that matches the original data type as the target data type.
[0078] Step S203: Load the target task data corresponding to the target data type and store the target task data in the data operation layer.
[0079] In this embodiment of the application, the task is processed and injected into the DataContext according to the data model and processing procedure abstracted in the DataProvider (data provider layer).
[0080] Step S204: Obtain the target task data in the data operation layer according to the data operation method of the data operation layer.
[0081] In this embodiment, the data operation layer, namely the DataContext mentioned above, can not only obtain the required business data from the DataProvider (data provider layer), but also perform operations on the built-in data, such as reloading, modifying, or deleting it. The DataContext is a global data source that can be shared by multiple UI components, so a single modification can take effect simultaneously on all UI components, improving data processing efficiency.
[0082] Step S205: Obtain the target UI component that matches the target task data from the UI component library.
[0083] In this embodiment of the application, the UI component obtains the corresponding task data from the DataContext through useDataContext and passes it to the UI component for rendering.
[0084] In this embodiment, the UI components are commonly used tools, such as dropdown selectors or radio buttons. However, these UI components do not contain business data.
[0085] In this embodiment, useDataContext is a method exposed by DataContext to provide task data and commonly used methods such as reload and updateConfig.
[0086] Step S206: Render the target task data to the UI page based on the target UI component.
[0087] This application provides a page display method based on UI components, comprising: obtaining raw task data carrying raw data types through a data providing layer, wherein the data providing layer encapsulates a UI component library, the data providing layer defines N data types and N task data corresponding to the N data types, where N is a positive integer; identifying the data type consistent with the raw data type among the N data types in the data providing layer as the target data type; loading the target task data corresponding to the target data type and storing the target task data in a data operation layer; obtaining the target task data in the data operation layer according to the data operation method of the data operation layer; obtaining the target UI component matching the target task data from the UI component library; and rendering the target task data to the UI page according to the target UI component. Compared with existing technologies, this application wraps the UI component library in a data provision layer. The data provision layer then automatically loads task data into the data operation layer. The UI components obtain the task data from the data operation layer and use this data for rendering to satisfy user tasks such as selection. This achieves automatic data loading and injection into the UI components, freeing developers from the details of data acquisition; they only need to use the acquired data. Furthermore, since the data operation layer is a global data source, multiple UI components can share this data source, enabling multiple UI components to reuse data, avoiding repeated loading, reducing browser performance overhead, and improving the rendering performance of the front-end page.
[0088] Continue reading Figure 3 The flowchart illustrates a specific implementation of the page update operation provided in Embodiment 1 of this application. For ease of explanation, only the parts related to this application are shown.
[0089] In some optional implementations of this embodiment, after step S206, the following step is further included:
[0090] Step S301: Receive feedback data sent by the user when performing operations on the target task data to be rendered;
[0091] Step S302: Call the overloaded method provided by the data operation layer to perform data reload operation on the feedback data to obtain the reloaded task data;
[0092] Step S303: Call the target UI component to perform a data refresh operation on the data operation layer to obtain the reloaded task data;
[0093] Step S304: Render the reload task data according to the target UI component to perform the page update operation.
[0094] In this embodiment of the application, after the UI component is operated, the data can be reloaded by calling the method provided by DataContext according to the operation result. Specifically, the UpdateConfig interface of the data operation layer can be called to update the configuration data of the data provider layer according to the feedback data, and the data provider layer can be called to load the data according to the updated configuration data to obtain the reload task data.
[0095] In this embodiment of the application, DataContext uses DataProvider (data source provider) to reload the data, retrieve the latest business data from the backend, and inject it into DataContext.
[0096] In this embodiment of the application, after the DataContext obtains the latest data, it will notify the UI component to refresh the data in order to present the results of the operations in the previous steps.
[0097] Continue reading Figure 4 , showed Figure 3 The flowchart of a specific embodiment of step S302 is shown. For ease of explanation, only the parts relevant to this application are shown.
[0098] In some optional implementations of this embodiment, step S302 specifically includes:
[0099] Step S401: Call the update configuration interface of the data operation layer to update the configuration data of the data provision layer according to the feedback data;
[0100] Step S402: Call the data provider layer to load data based on the updated configuration data to obtain the reload task data.
[0101] In this embodiment, `useDataContext` is a method exposed by `DataContext`, used to provide task data and common methods such as `reload` and `updateConfig`. It can reload data and modify the behavior of the `DataProvider` (data source provider).
[0102] Continue reading Figure 5 The diagram shows a flowchart of a specific implementation of the UI component library generation method provided in Embodiment 1 of this application. For ease of explanation, only the parts related to this application are shown.
[0103] In some optional implementations of this embodiment, before step S201, the following steps are further included:
[0104] Step S501: Create the initial UI component library.
[0105] In this embodiment of the application, the initial UI component library refers to a pre-created library for storing specified UI components. The initial UI component library is an empty library, that is, a library in which the specified UI components have not yet been added.
[0106] In this embodiment of the application, business personnel can pre-create an initial UI component library for adding specified UI components in subsequent processes.
[0107] Step S502: Encapsulate the pre-compiled UI controls into corresponding UI components, with the target UI component being a component among the multiple UI components.
[0108] In the embodiments of this application, multiple UI controls refer to commonly used UI controls in the project, such as drop-down selectors, radio buttons, etc. It should be understood that the examples of UI controls here are only for ease of understanding and are not intended to limit this application.
[0109] In the embodiments of this application, multiple commonly used UI controls can be pre-compiled and generated, and these multiple UI controls can be encapsulated into individual UI components. Each UI component is independent of the others, that is, the UI components do not interfere with each other, and each UI component can be called independently.
[0110] Step S503: Add multiple UI components to the initial UI component library to generate the UI component library.
[0111] In this embodiment of the application, a UI component library can be obtained after adding multiple pre-compiled UI components to the initial UI component library.
[0112] Continue reading Figure 6 , showed Figure 5 The flowchart of a specific embodiment of step S503 is shown. For ease of explanation, only the parts relevant to this application are shown.
[0113] In some optional implementations of this embodiment, step S503 specifically includes:
[0114] Step S601: Based on the layout information of each UI control and the interaction information between at least two UI controls, determine the component layout information of each UI component and the component interaction information between the UI components corresponding to at least two UI controls.
[0115] In this embodiment of the application, component interaction information refers to the interaction information between components. For example, clicking the control corresponding to component A can jump to the control corresponding to component B, and clicking the control corresponding to component B can jump to the control corresponding to component C. Therefore, there is an interaction relationship between components A, B, and C, and the component interaction information between components A, B, and C can be determined.
[0116] In this embodiment of the application, after obtaining multiple UI components, the component layout information of each UI component and the component interaction information between the UI components corresponding to at least two UI controls can be determined based on the layout information of each UI control and the interaction information between at least two UI controls.
[0117] Step S602: Add multiple UI components, the component layout information of each UI component, and the component interaction information between at least two UI components to the initial UI component library to generate the UI component library.
[0118] In this embodiment, after determining the component layout information of each UI component and the component interaction information between the UI components corresponding to at least two UI controls, multiple UI components, the component layout information of each UI component, and the component interaction information between at least two UI components can be added to the initial UI component library to generate a UI component library. A JSON-UI converter can be pre-set on the client side. Based on commonly used UI interfaces on the client side, commonly used UI controls can be obtained and added to the JSON-UI converter. The JSON-UI converter then individually encapsulates these UI controls into individual UI components, which are then added to the initial UI component library to obtain the UI component library.
[0119] Continue reading Figure 7 The diagram shows a flowchart of a specific implementation of the target UI page generation method provided in Embodiment 1 of this application. For ease of explanation, only the parts related to this application are shown.
[0120] In some optional implementations of this embodiment, before step S206, the following steps are further included:
[0121] Step S701: Obtain the target component layout information and the target component interaction information corresponding to the target UI component.
[0122] In this embodiment of the application, the target component layout information refers to the layout information of the target UI component.
[0123] In this embodiment, the target component interaction information refers to the interaction information between target UI components. The target UI components can be added to the parent view one by one according to the hierarchy. After the addition is completed, the layout method of the control is set according to the layout parameters.
[0124] Step S702: Generate the target UI page based on the target UI component, the target component layout information, and the target component interaction information.
[0125] In this embodiment of the application, after obtaining the target UI component, the target component layout information and the target component interaction information, the initial UI interface can be modified in combination with this information to obtain the target UI interface.
[0126] Continue reading Figure 8 , showed Figure 1 The flowchart shows a specific implementation after step S206. For ease of explanation, only the parts relevant to this application are shown.
[0127] In some optional implementations of this embodiment, after step S206, the following step is further included:
[0128] Step S801: Save the UI page.
[0129] In this embodiment of the application, after the target UI interface is generated, the target UI interface can be saved on the client side.
[0130] Step S802: If a next page loading request for the UI page is received and the current network is abnormal, render and display the saved UI page.
[0131] In this embodiment of the application, the next interface loading request refers to a request initiated by the client side to request the loading of the UI interface.
[0132] In this embodiment of the application, in order to avoid the application not displaying properly when the network is disconnected, the target UI interface can be saved locally. The locally saved target UI interface is loaded first, and then the page is refreshed after the request is successful, and the latest UI interface is saved locally.
[0133] In this embodiment of the application, the latest saved UI interface can be rendered and displayed on the next request, even if there is a network error.
[0134] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware with computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium, and when executed, they can include the processes of the embodiments of the methods described above. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0135] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0136] Example 2
[0137] Further reference Figure 9 As a response to the above Figure 2 The implementation of the method shown in this application provides an embodiment of a page display device based on UI components, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0138] like Figure 9 As shown, the UI component-based page display device 200 described in this embodiment includes: a task data acquisition module 201, a data type confirmation module 202, a target data loading module 203, a target data acquisition module 204, a target component acquisition module 205, and a rendering module 206. Wherein:
[0139] The task data acquisition module 201 is used to acquire raw task data carrying raw data types through the data providing layer. The data providing layer includes a UI component library and defines N data types and N task data corresponding to the N data types, where N is a positive integer.
[0140] The data type confirmation module 202 is used to confirm, among the N data types in the data providing layer, the data type that is consistent with the original data type as the target data type;
[0141] The target data loading module 203 is used to load target task data corresponding to the target data type and store the target task data in the data operation layer;
[0142] Target data acquisition module 204 is used to acquire the target task data in the data operation layer according to the data operation method of the data operation layer;
[0143] The target component acquisition module 205 is used to acquire a target UI component that matches the target task data from the UI component library.
[0144] The rendering module 206 is used to render the target task data to the UI page based on the target UI component.
[0145] In this embodiment of the application, the data provider layer, namely DataProvider, can not only obtain the corresponding data according to the business abstraction type, but also process the data using a custom loading process.
[0146] In this embodiment, the DataProvider (data provider layer) has built-in types abstracted from different business data. Business data of the corresponding type can be automatically loaded by passing in the business type. Simultaneously, it abstracts and formats the business data from different types of interface responses, storing it in a unified format within the data provider layer. For example, if the data type is `task`, the model is `{uuid:string,name:string,type:number}`, the retrieval configuration is `{type:number}`, and the retrieval method is to obtain the corresponding `task` data based on the passed-in data type `task` and data configuration `type`. It should be understood that the examples of the data provider layer definition here are for ease of understanding only and are not intended to limit this application.
[0147] In this embodiment, the DataProvider can receive custom types and bind custom loading processes. This custom approach can satisfy special logical scenarios that cannot be built in, and in these special scenarios, the DataProvider can reuse all data.
[0148] In this embodiment, the DataProvider (data provider layer) can receive configurations that conform to the business model to load the corresponding data according to the configuration. For example, if there are two users, A and B, the business model configuration can flexibly assemble either A or B to load and reuse the corresponding data.
[0149] In this embodiment of the application, business personnel need to predefine the data type, model, retrieval configuration and method in the DataProvider (data provider layer). For example, a data type is defined as task, the model is {uuid:string,name:string,type:number}, the retrieval configuration is {type:number}, and the retrieval method is to retrieve the task data of the corresponding type based on the input data type task and data configuration type.
[0150] In this embodiment, the original task data (task) refers to a specific task. It includes a primary key (UUID), a task name (name), and a task type (type).
[0151] In this embodiment of the application, the UI component library is pre-created and contains multiple UI components. The UI components in the UI component library are components obtained by developers by encapsulating commonly used UI controls. Each UI component in the UI component library is independent of each other, and inter-component relationships can be pre-established between two or more components to generate higher-level components.
[0152] In this embodiment of the application, the task is processed and injected into the DataContext according to the data model and processing procedure abstracted in the DataProvider (data provider layer).
[0153] In this embodiment, the data operation layer, namely the DataContext mentioned above, can not only obtain the required business data from the DataProvider (data provider layer), but also perform operations on the built-in data, such as reloading, modifying, or deleting it. The DataContext is a global data source that can be shared by multiple UI components, so a single modification can take effect simultaneously on all UI components, improving data processing efficiency.
[0154] In this embodiment of the application, the UI component obtains the corresponding task data from the DataContext through useDataContext and passes it to the UI component for rendering.
[0155] In this embodiment, the UI components are commonly used tools, such as dropdown selectors or radio buttons. However, these UI components do not contain business data.
[0156] In this embodiment, useDataContext is a method exposed by DataContext to provide task data and commonly used methods such as reload and updateConfig.
[0157] In this embodiment of the application, a page display device 200 based on UI components is provided, including: a task data acquisition module 201, used to acquire original task data carrying original data types through a data providing layer, wherein the data providing layer encapsulates a UI component library, the data providing layer defines N data types and N task data corresponding to the N data types, where N is a positive integer; a data type confirmation module 202, used to confirm that the data type consistent with the original data type among the N data types in the data providing layer is the target data type; a target data loading module 203, used to load the target task data corresponding to the target data type and store the target task data in a data operation layer; a target data acquisition module 204, used to acquire the target task data in the data operation layer according to the data operation method of the data operation layer; a target component acquisition module 205, used to acquire a target UI component matching the target task data in the UI component library; and a rendering module 206, used to render the target task data to a UI page according to the target UI component. Compared with existing technologies, this application wraps the UI component library in a data provision layer. The data provision layer then automatically loads task data into the data operation layer. The UI components obtain the task data from the data operation layer and use this data for rendering to satisfy user tasks such as selection. This achieves automatic data loading and injection into the UI components, freeing developers from the details of data acquisition; they only need to use the acquired data. Furthermore, since the data operation layer is a global data source, multiple UI components can share this data source, enabling multiple UI components to reuse data, avoiding repeated loading, reducing browser performance overhead, and improving the rendering performance of the front-end page.
[0158] In some optional implementations of this embodiment, the UI component-based page display device 200 further includes: a feedback data acquisition module, a reload module, a data refresh module, and a page update module, wherein:
[0159] The feedback data acquisition module is used to receive feedback data sent by the user when performing operations on the target task data being rendered.
[0160] The reload module is used to call the reload method provided by the data operation layer to perform data reload operation on the feedback data to obtain reload task data;
[0161] The data refresh module is used to call the target UI component to perform a data refresh operation on the data operation layer in order to obtain the reloaded task data;
[0162] The page update module is used to render the reloaded task data according to the target UI component in order to perform a page update operation.
[0163] In this embodiment of the application, after the UI component is operated, the data can be reloaded by calling the method provided by DataContext according to the operation result. Specifically, the UpdateConfig interface of the data operation layer can be called to update the configuration data of the data provider layer according to the feedback data, and the data provider layer can be called to load the data according to the updated configuration data to obtain the reload task data.
[0164] In this embodiment of the application, DataContext uses DataProvider (data source provider) to reload the data, retrieve the latest business data from the backend, and inject it into DataContext.
[0165] In this embodiment of the application, after the DataContext obtains the latest data, it will notify the UI component to refresh the data in order to present the results of the operations in the previous steps.
[0166] In some optional implementations of this embodiment, the overloaded module includes: a configuration data update submodule and a data loading submodule, wherein:
[0167] The configuration data update submodule is used to call the update configuration interface of the data operation layer to update the configuration data of the data provision layer according to the feedback data.
[0168] The data loading submodule is used to call the data providing layer to load data according to the updated configuration data, so as to obtain the reload task data.
[0169] In this embodiment, `useDataContext` is a method exposed by `DataContext`, used to provide task data and common methods such as `reload` and `updateConfig`. It can reload data and modify the behavior of the `DataProvider` (data source provider).
[0170] In some optional implementations of this embodiment, the UI component-based page display device 200 further includes: a component library creation module, an encapsulation module, and a component library generation module, wherein:
[0171] The component library creation module is used to create the initial UI component library;
[0172] An encapsulation module is used to encapsulate multiple pre-compiled UI controls into corresponding UI components, wherein the target UI component is a component among the multiple UI components;
[0173] The component library generation module is used to add multiple UI components to the initial UI component library to generate the UI component library.
[0174] In this embodiment of the application, the initial UI component library refers to a pre-created library for storing specified UI components. The initial UI component library is an empty library, that is, a library in which the specified UI components have not yet been added.
[0175] In this embodiment of the application, business personnel can pre-create an initial UI component library for adding specified UI components in subsequent processes.
[0176] In the embodiments of this application, multiple UI controls refer to commonly used UI controls in the project, such as drop-down selectors, radio buttons, etc. It should be understood that the examples of UI controls here are only for ease of understanding and are not intended to limit this application.
[0177] In the embodiments of this application, multiple commonly used UI controls can be pre-compiled and generated, and these multiple UI controls can be encapsulated into individual UI components. Each UI component is independent of the others, that is, the UI components do not interfere with each other, and each UI component can be called independently.
[0178] In this embodiment of the application, a UI component library can be obtained after adding multiple pre-compiled UI components to the initial UI component library.
[0179] In some optional implementations of this embodiment, the component library generation module includes: an interaction information determination submodule and a component library generation submodule, wherein:
[0180] The interaction information determination submodule is used to determine the component layout information of each UI component and the component interaction information between the UI components corresponding to the at least two UI controls, based on the layout information of each UI control and the interaction information between at least two UI controls.
[0181] The component library generation submodule is used to add multiple UI components, the component layout information of each UI component, and the component interaction information between at least two UI components to the initial UI component library to generate the UI component library.
[0182] In this embodiment of the application, component interaction information refers to the interaction information between components. For example, clicking the control corresponding to component A can jump to the control corresponding to component B, and clicking the control corresponding to component B can jump to the control corresponding to component C. Therefore, there is an interaction relationship between components A, B, and C, and the component interaction information between components A, B, and C can be determined.
[0183] In this embodiment of the application, after obtaining multiple UI components, the component layout information of each UI component and the component interaction information between the UI components corresponding to at least two UI controls can be determined based on the layout information of each UI control and the interaction information between at least two UI controls.
[0184] In this embodiment, after determining the component layout information of each UI component and the component interaction information between the UI components corresponding to at least two UI controls, multiple UI components, the component layout information of each UI component, and the component interaction information between at least two UI components can be added to the initial UI component library to generate a UI component library. A JSON-UI converter can be pre-set on the client side. Based on commonly used UI interfaces on the client side, commonly used UI controls can be obtained and added to the JSON-UI converter. The JSON-UI converter then individually encapsulates these UI controls into individual UI components, which are then added to the initial UI component library to obtain the UI component library.
[0185] In some optional implementations of this embodiment, the UI component-based page display device 200 further includes: a component layout acquisition module and a UI page generation module, wherein:
[0186] The component layout acquisition module is used to acquire the target component layout information corresponding to the target UI component, and the target component interaction information corresponding to the target UI component;
[0187] The UI page generation module is used to generate the UI page based on the target UI component, the target component layout information, and the target component interaction information.
[0188] In this embodiment of the application, the target component layout information refers to the layout information of the target UI component.
[0189] In this embodiment, the target component interaction information refers to the interaction information between target UI components. The target UI components can be added to the parent view one by one according to the hierarchy. After the addition is completed, the layout method of the control is set according to the layout parameters.
[0190] In this embodiment of the application, after obtaining the target UI component, the target component layout information and the target component interaction information, the initial UI interface can be modified in combination with this information to obtain the target UI interface.
[0191] In some optional implementations of this embodiment, the UI component-based page display device 200 further includes: a UI page saving module and a UI page rendering module, wherein:
[0192] UI page saving module, used to save the UI page;
[0193] The UI page rendering module is used to render and display the saved UI page when a next page loading request for the UI page is received and the current network is abnormal.
[0194] In this embodiment of the application, after the target UI interface is generated, the target UI interface can be saved on the client side.
[0195] In this embodiment of the application, the next interface loading request refers to a request initiated by the client side to request the loading of the UI interface.
[0196] In this embodiment of the application, in order to avoid the application not displaying properly when the network is disconnected, the target UI interface can be saved locally. The locally saved target UI interface is loaded first, and then the page is refreshed after the request is successful, and the latest UI interface is saved locally.
[0197] In this embodiment of the application, the latest saved UI interface can be rendered and displayed on the next request, even if there is a network error.
[0198] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 10 , Figure 10 This is a basic structural block diagram of the computer device in this embodiment.
[0199] The computer device 300 includes a memory 310, a processor 320, and a network interface 330 that are interconnected via a system bus. It should be noted that only the computer device 300 with components 310-330 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0200] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0201] The memory 310 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 310 may be an internal storage unit of the computer device 300, such as the hard disk or memory of the computer device 300. In other embodiments, the memory 310 may also be an external storage device of the computer device 300, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. Of course, the memory 310 may also include both internal storage units and external storage devices of the computer device 300. In this embodiment, the memory 310 is typically used to store the operating system and various application software installed on the computer device 300, such as computer-readable instructions for page display methods based on UI components. Furthermore, the memory 310 can also be used to temporarily store various types of data that have been output or will be output.
[0202] In some embodiments, the processor 320 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 320 is typically used to control the overall operation of the computer device 300. In this embodiment, the processor 320 is used to execute computer-readable instructions stored in the memory 310 or to process data, for example, to execute computer-readable instructions for the UI component-based page display method.
[0203] The network interface 330 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 300 and other electronic devices.
[0204] The computer device provided in this application wraps the UI component library in a data provision layer. The data provision layer then automatically loads task data into the data operation layer. The UI components obtain the task data from the data operation layer and use this data for rendering to satisfy user tasks such as selection. This achieves automatic data loading and injection into the UI components, freeing developers from the details of data acquisition; they only need to use the acquired data. Furthermore, since the data operation layer is a global data source, multiple UI components can share this data source, enabling multiple UI components to reuse data, avoiding repeated loading, reducing browser performance overhead, and improving the rendering performance of the front-end page.
[0205] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by at least one processor to cause the at least one processor to perform the steps of the UI component-based page display method described above.
[0206] The computer-readable storage medium provided in this application wraps a UI component library in a data provision layer. The data provision layer then automatically loads task data into a data operation layer. The UI components obtain the task data from the data operation layer and use this data for rendering to satisfy user tasks such as selection. This achieves automatic data loading and injection into the UI components, freeing developers from the details of data acquisition; they only need to use the acquired data. Furthermore, since the data operation layer is a global data source, multiple UI components can share this data source, enabling data reuse among multiple UI components, avoiding repeated loading, reducing browser performance overhead, and improving the rendering performance of the front-end page.
[0207] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0208] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. A page display method based on UI components, characterized in that, Includes the following steps: The raw task data carrying the original data type is obtained through the data providing layer. The data providing layer wraps a UI component library and defines N data types and N task data corresponding to the N data types, where N is a positive integer. Among the N data types in the data providing layer, the data type that matches the original data type is identified as the target data type; Load the target task data corresponding to the target data type, and store the target task data in the data operation layer, wherein the data operation layer is a global data source shared by multiple UI components; The target task data is obtained in the data operation layer according to the data operation method of the data operation layer; Obtain the target UI component that matches the target task data from the UI component library; Render the target task data to the UI page according to the target UI component; After the step of rendering the target task data to the UI page according to the target UI component, the following steps are also included: Receive feedback data sent by the user when performing operations on the target task data being rendered; The data operation layer is invoked to perform a data reload operation on the feedback data to obtain reloaded task data, wherein the data reload operation is performed according to the data source provider provided by the data operation layer. The target UI component is invoked to perform a data refresh operation on the data operation layer in order to obtain the reloaded task data; The reloaded task data is rendered based on the target UI component to perform a page update operation.
2. The page display method based on UI components according to claim 1, characterized in that, The step of calling the data operation layer to perform a data reload operation on the feedback data to obtain reloaded task data specifically includes the following steps: The configuration update interface of the data operation layer is invoked to update the configuration data of the data provision layer based on the feedback data. The data provider layer is invoked to load data based on the updated configuration data to obtain the reloaded task data.
3. The page display method based on UI components according to claim 1, characterized in that, Before the step of obtaining the raw task data carrying the original data type through the data providing layer, the following steps are also included: Create an initial UI component library; Multiple pre-compiled UI controls are encapsulated into corresponding UI components, wherein the target UI component is a component among the multiple UI components; Multiple UI components are added to the initial UI component library to generate the UI component library.
4. The page display method based on UI components according to claim 3, characterized in that, The step of adding multiple UI components to the initial UI component library to generate the UI component library specifically includes the following steps: Based on the layout information of each UI control and the interaction information between at least two UI controls, determine the component layout information of each UI component and the component interaction information between the UI components corresponding to at least two UI controls; The UI component library is generated by adding multiple UI components, the component layout information of each UI component, and the component interaction information between at least two UI components to the initial UI component library.
5. The page display method based on UI components according to claim 4, characterized in that, Before the step of rendering the target task data to the UI page based on the target UI component, the following steps are specifically included: Obtain the target component layout information and the target component interaction information corresponding to the target UI component; The UI page is generated based on the target UI component, the target component layout information, and the target component interaction information.
6. The page display method based on UI components according to claim 1, characterized in that, After the step of rendering the target task data to the UI page according to the target UI component, the following steps are also included: Save the UI page; If a next page loading request for the UI page is received and the current network is abnormal, the saved UI page will be rendered and displayed.
7. A page display device based on UI components, characterized in that, include: The task data acquisition module is used to acquire raw task data carrying raw data types through the data providing layer. The data providing layer includes a UI component library and defines N data types and N task data corresponding to the N data types, where N is a positive integer. The data type confirmation module is used to confirm, among the N data types in the data providing layer, that the data type consistent with the original data type is the target data type; The target data loading module is used to load target task data corresponding to the target data type and store the target task data in the data operation layer, wherein the data operation layer is a global data source shared by multiple UI components; The target data acquisition module is used to acquire the target task data in the data operation layer according to the data operation method of the data operation layer; The target component acquisition module is used to acquire target UI components that match the target task data from the UI component library. The rendering module is used to render the target task data to the UI page based on the target UI component; The UI component-based page display device further includes: a feedback data acquisition module, a reload module, a data refresh module, and a page update module, wherein: The feedback data acquisition module is used to receive feedback data sent by the user when performing operations on the rendered target task data; The reload module is used to call the data operation layer to perform a data reload operation on the feedback data to obtain reload task data, wherein the data reload operation is performed according to the data source provider provided by the data operation layer. The data refresh module is used to call the target UI component to perform a data refresh operation on the data operation layer in order to obtain the reloaded task data; The page update module is used to render the reloaded task data according to the target UI component in order to perform a page update operation.
8. A computer device, characterized in that, The method includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps of the UI component-based page display method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the page display method based on UI components as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method, device, terminal and storage medium for generating control page
CN110673494A
Method and system for automatically loading and controlling attribute data of page elements in background
CN114816576A
