Target page generation method and device, computer device, and storage medium
By inheriting the page layout of the parent view control from the child view control, parsing the data source to be laid out to generate the page layout partition model, and using the delegate method of the parent view control to generate the target page, the problem of redundant code and layout changes in UITableView is solved, which improves efficiency and reduces development workload.
Patent Information
- Application Number
- CN202210444474.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-26
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2042-04-26
AI Technical Summary
When using UITableView, as the requirements for list interfaces in apps become more diverse, traditional methods result in a large amount of redundant code, reducing page generation efficiency. Furthermore, when page layout information changes, it is necessary to modify the layout of each page individually, increasing the workload of developers.
By inheriting the page layout of the parent view control from the child view control, the data source to be laid out is written into the child view control, the page layout partition model is generated by parsing, and the target page is generated by using the delegate method of the parent view control, thus avoiding the use of the delegate method multiple times.
It improves page generation efficiency, reduces redundant code, lowers the workload for developers, and only requires modification of the parent view control when layout information changes, thus reducing repetitive work.
Smart Images

Figure CN114692056B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a target page generation method and device, computer equipment, storage medium and computer program product. BACKGROUND
[0002] With the development of communication infrastructure, the traffic of mobile devices is more and more stable, cheap and instant, and a large number of application APPs have emerged and been widely used, which brings a lot of convenience to people's life. In the design of APP, various UITableViews (list view) are often used to display a large amount of data.
[0003] In the process of using the traditional UITableView, with the development of society, on the one hand, the list interface to be displayed in various APPs is more and more rich, and multiple proxy methods need to be implemented when using the UITableView, resulting in a large amount of redundant code and reducing the efficiency of page generation; on the other hand, when the page layout information in the APP changes, the layout of each page needs to be modified one by one, increasing the workload of page developers. SUMMARY
[0004] Therefore, it is necessary to provide a target page generation method and device, computer equipment, computer readable storage medium and computer program product capable of improving the efficiency of page generation.
[0005] In a first aspect, the present application provides a target page generation method, which comprises:
[0006] writing a data source to be laid out into a sub-view control of a page to be generated, the sub-view control inheriting a page layout of a corresponding parent-view control;
[0007] analyzing the data source to be laid out by using the sub-view control to determine each element of the page to be generated, and generating a page layout partition model of the page to be generated according to the position of each element;
[0008] inputting each page layout partition model into the parent-view control, and generating a target page according to each page layout partition model by using a proxy method encapsulated by the parent-view control.
[0009] In one embodiment, the analyzing the data source to be laid out by using the sub-view control to determine each element of the page to be generated, and generating a page layout partition model of the page to be generated according to the position of each element comprises:
[0010] The sub-view control is used to parse the to-be-laid-out data source to obtain each to-be-laid-out data, wherein each to-be-laid-out data carries a corresponding element unit identifier and a partition identifier;
[0011] According to each to-be-laid-out data and the element unit identifier corresponding to each to-be-laid-out data, each element unit model is generated;
[0012] According to each element unit model and the partition identifier corresponding to each to-be-laid-out data, a corresponding page layout partition model is generated.
[0013] In one embodiment, the generating of each element unit model according to each to-be-laid-out data and the element unit identifier corresponding to each to-be-laid-out data comprises:
[0014] According to the element unit identifier corresponding to the to-be-laid-out data, the element unit type of each to-be-laid-out data is obtained;
[0015] Each to-be-laid-out data is bound with the element unit type corresponding thereto to generate each element unit model.
[0016] In one embodiment, the generating of a corresponding page layout partition model according to each element unit model and the partition identifier corresponding to each to-be-laid-out data comprises:
[0017] Based on the partition identifier corresponding to each to-be-laid-out data and the preset specific structure of the page layout, a corresponding page layout partition model is generated.
[0018] In one embodiment, the generating of a corresponding page layout partition model based on the partition identifier corresponding to each to-be-laid-out data and the preset specific structure of the page layout comprises:
[0019] Based on the partition identifier corresponding to each to-be-laid-out data and the preset specific structure of the page layout, element unit models carrying the same partition identifier are encapsulated according to the preset specific structure to obtain a corresponding page layout partition model.
[0020] In one embodiment, the preset specific structure is set according to the page layout information of the sub-view control.
[0021] In a second aspect, the application further provides a target page generation device, which comprises:
[0022] A data writing module is configured to write a to-be-laid-out data source into a sub-view control of a to-be-generated page, wherein the sub-view control inherits the page layout of a corresponding parent view control;
[0023] The partition model generation module is configured to parse the data source to be laid out by using the sub-view control, determine elements of the page to be generated, and generate a page layout partition model of the page to be generated according to positions of the elements.
[0024] The target page generation module is configured to input the page layout partition models into the parent view control, and generate a target page by using an agent method encapsulated by the parent view control according to the page layout partition models.
[0025] In a third aspect, the present application provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0026] In a fourth aspect, the present application provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps of the above method when executed by a processor.
[0027] In a fifth aspect, the present application provides a computer program product, which includes a computer program, and the computer program implements the steps of the above method when executed by a processor.
[0028] The target page generation method, device, computer device, storage medium and computer program product have the advantages that the sub-view control inherits the page layout of the parent view control, when generating a target page, only the data source to be laid out needs to be written into the corresponding sub-view control, the sub-view control determines elements of the page to be generated after parsing the data source to be laid out, generates a page layout partition model of the corresponding page to be generated according to the inherited page layout information of the parent view control, inputs the page layout partition model into the parent view control, and generates the target page. When generating the target page, only the agent method encapsulated by the parent view control needs to be used, and the agent method does not need to be used multiple times, thereby avoiding a large amount of redundant codes and improving the efficiency of terminal page generation. In addition, the sub-view control inherits the page layout of the parent view control, and thus does not need to be laid out, and only the page layout of the parent view control needs to be modified when the page layout information changes, thereby greatly reducing the workload of the developer. BRIEF DESCRIPTION OF DRAWINGS
[0029] Figure 1 An application environment diagram of the target page generation method in an embodiment;
[0030] Figure 2 A flowchart of the target page generation method in an embodiment;
[0031] Figure 3A flowchart of a step of generating a page layout partition model of the to-be-generated page according to the positions of the elements in one embodiment using the sub-view control to parse the to-be-laid-out data source to determine the elements of the to-be-generated page;
[0032] Figure 4 A flowchart of a target page generation method in another embodiment;
[0033] Figure 5 A structural block diagram of a target page generation apparatus in one embodiment;
[0034] Figure 6 An internal structure diagram of a computer device in one embodiment. DETAILED DESCRIPTION
[0035] To make the objectives, technical solutions, and advantages of the present application clearer, further detailed descriptions will be given below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and should not be used to limit the present application.
[0036] The target page generation method provided by the embodiments of the present application can be applied in an application environment as shown in Figure 1 . The terminal 102 communicates with the server 104 through a network. The data storage system can store data required to be processed by the server 104. The data storage system can be integrated on the server 104, or placed on a cloud or other network server. The terminal 102 receives the to-be-laid-out data source sent by the server 104, writes the to-be-laid-out data source into the sub-view control of the to-be-generated page, and the sub-view control inherits the page layout of the corresponding parent view control; uses the sub-view control to parse the to-be-laid-out data source to determine the elements of the to-be-generated page, and generates the page layout partition model of the page according to the positions of the elements; inputs each page layout partition model into the parent view control, and uses the proxy method encapsulated by the parent view control to generate the target page according to each page layout partition model. The terminal 102 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things device can be a smart speaker, a smart television, a smart air conditioner, a smart vehicle device, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc. The server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0037] In one embodiment, as shown in Figure 2 , a target page generation method is provided. Taking the terminal in Figure 1 as an example, the method includes the following steps:
[0038] Step 202, write the data source to be laid out into the sub-view control of the page to be generated, and the sub-view control inherits the page layout of the corresponding parent view control.
[0039] The data source to be laid out is a collection of information data generated according to the business needs of the user using the APP and needs to be displayed on the page. For example, when the user uses a medical APP, the data source to be laid out can be a collection of medical result information corresponding to the user's inquiry of medical problems, or a collection of medicine information corresponding to the user's purchase of medical medicine. It can be understood that the data source to be laid out carries page identification information, and the terminal writes it into the sub-view control of the corresponding page to be generated according to the page identification of the data source to be laid out.
[0040] The parent view control is a control obtained by encapsulating two delegate methods of UITableView. It can be understood that UITableView includes protocol delegate methods (UITableViewDelegate) and data source delegate methods (UITableViewDataSource), wherein UITableViewDelegate corresponds to the delegate method that needs to be implemented: returning the number of partitions corresponding to the list view and the number of element units corresponding to each partition according to the data source to be displayed; the delegate method of UITableViewDataSource is: the processing method of the click event and the height data of each element unit of the list view.
[0041] The sub-view control is a view control that inherits the page layout of the parent view control. It can be understood that each APP has multiple pages, and each page has its corresponding sub-view control for receiving the data source to be laid out that generates the page. The sub-view control inherits the page layout of the parent view control.
[0042] Specifically, when the user uses the APP to operate according to the business needs, the APP generates a page generation request according to the user's business needs, and sends the page generation request to the server. The page generation request carries page identification information, the server determines the page layout information of the page according to the page identification information, obtains the corresponding data to be laid out according to the page layout information, encapsulates each data to be laid out to obtain the data source to be laid out, and sends the data source to be laid out to the corresponding terminal according to the page identification information. The terminal writes the data source to be laid out into the sub-view control of the corresponding page to be generated according to the page identification of the data source to be laid out.
[0043] Step 204, parse the data source to be laid out by using the sub-view control, determine each element of the page to be generated, and generate a page layout partition model of the page to be generated according to the position of each element.
[0044] The data source to be laid out has a fixed format. The child view control needs to parse the data source to obtain the individual data items to be laid out. Based on these data items, the elements of the page to be generated are determined. Understandably, each element of the page to be generated has its corresponding position on the page.
[0045] Specifically, the terminal uses the subview control to parse the data source to be laid out written to the subview control, obtains each data to be laid out, determines each element of the page to be generated based on each data to be laid out, and generates the page layout partition model of the page to be generated based on the position of each element in the page to be generated.
[0046] Step 206: Input the layout partition model of each page into the parent view control, and use the delegate method encapsulated by the parent view control to generate the target page based on the layout partition model of each page.
[0047] Specifically, the terminal inputs the page layout partition models generated by the subview control into the parent view control, and uses the parent view control to implement its two encapsulated delegate methods according to the page layout partition models to generate the target page.
[0048] In the above method for generating the target page, since the child view control inherits the page layout of the parent view control, when generating the target page, it is only necessary to write the data source to be laid out into its corresponding child view control. The child view control parses the data source to be laid out and determines the elements of the page to be generated. Based on the page layout information inherited from the parent view control, it generates the corresponding page layout partition model of the page to be generated, and then inputs the page layout partition model into the parent view control to generate the target page. When generating the target page, only all the delegate methods encapsulated by the parent view control need to be used, without having to use the delegate methods separately multiple times, avoiding a large amount of redundant code and improving the efficiency of terminal page generation. At the same time, since the child view control inherits the page layout of the parent view control, there is no need to set the layout of the child view control. When the page layout information changes, only the page layout in the parent view control needs to be modified, which greatly reduces the workload of developers.
[0049] In one embodiment, such as Figure 3 As shown, the subview control is used to parse the data source to be laid out to determine the elements of the page to be generated. Based on the position of each element, a page layout partition model of the page to be generated is generated, including:
[0050] Step 302: Use the subview control to parse the data source to be laid out and obtain each piece of data to be laid out; each piece of data to be laid out carries the corresponding element unit identifier and partition identifier.
[0051] The element unit refers to a basic unit of a page, and is a unit for carrying a page element. It can be understood that a page can be composed of one or more element units. It can be understood that the element units can be divided into multiple types, for example, the element units can be divided according to the types of page elements supported by the element units, that is, two element units support different types of page elements, and the two element units can be regarded as belonging to different types.
[0052] The element unit can support display of one or more page elements, which is not limited in the present application. It can be understood that the page element types in the present application include, but are not limited to, text element types, picture element types, audio element types, video element types, and the like.
[0053] The element unit identifier is pre-set identifier information corresponding to the element unit type in a one-to-one manner, and the sub-view control can find the element unit type corresponding to the to-be-laid-out data according to the element unit identifier.
[0054] The partition identifier is pre-set identifier information corresponding to the display area in the page layout in a one-to-one manner, and the display area of the element unit corresponding to the to-be-laid-out data in the page can be determined according to the partition identifier.
[0055] Specifically, the terminal parses the fixed format to-be-laid-out data source written by the sub-view control to obtain corresponding to-be-laid-out data. It can be understood that each to-be-laid-out data corresponds to an element unit, and each to-be-laid-out data carries a corresponding element unit identifier and a partition identifier.
[0056] In one of the embodiments, the fixed format of the to-be-laid-out data source is a json string format. The sub-view control parses the to-be-laid-out data source to obtain corresponding to-be-laid-out data, and the to-be-laid-out data includes text data, picture data, or link data, wherein the picture data can be a picture download link data.
[0057] Step 304, generating each element unit model according to each to-be-laid-out data and the element unit identifier corresponding to each to-be-laid-out data.
[0058] Specifically, the sub-view control determines the element type corresponding to each to-be-laid-out data according to the element unit identifier corresponding to each to-be-laid-out data, and generates each element unit model according to each to-be-laid-out data and the element type corresponding to each to-be-laid-out data.
[0059] Step 306, generating a corresponding page layout partition model according to each element unit model and the partition identifier corresponding to each to-be-laid-out data.
[0060] Specifically, each element unit model carries a partition identifier carried by the corresponding to-be-laid-out data, and a corresponding page layout partition model is generated according to each element unit model and the partition identifier corresponding to each to-be-laid-out data.
[0061] In this embodiment, when different to-be-laid-out data sources are input into the sub-view control, the sub-view control can generate each element unit model according to the element unit identifier corresponding to each to-be-laid-out data, and generate a page layout partition model according to each element unit model and the partition identifier corresponding to each to-be-laid-out data, thereby providing a data basis for generating a target page according to the proxy method encapsulated in the parent view control.
[0062] In one embodiment, generating each element unit model according to each to-be-laid-out data and the element unit identifier corresponding to each to-be-laid-out data includes: obtaining the element unit type of each to-be-laid-out data according to the element unit identifier corresponding to the to-be-laid-out data; and binding each to-be-laid-out data with the element unit type corresponding thereto to obtain each element unit model.
[0063] Specifically, the terminal determines the element unit type corresponding to each to-be-laid-out data according to the element unit identifier carried by each to-be-laid-out data in the to-be-laid-out data source, obtains each element unit type from a database, and binds each to-be-laid-out data with the element unit type corresponding thereto to obtain each corresponding element unit model. By binding each to-be-laid-out data with the element unit type to generate each element unit model using the sub-view control, a data basis can be provided for generating a page layout partition model according to each element unit model.
[0064] In one embodiment, generating a corresponding page layout partition model according to each element unit model and the partition identifier corresponding to each to-be-laid-out data includes: generating a corresponding page layout partition model based on the partition identifier corresponding to each to-be-laid-out data and a preset specific structure of the page layout.
[0065] The sub-view control and the preset specific structure correspond to each other, and each sub-view control has a corresponding preset specific structure. Specifically, the preset specific structure specifies the number of partitions of a to-be-generated page, the element unit type in each partition, the number of element units, the height information of the element units, and the click callback method corresponding to each element unit, etc. The sub-view control generates each page layout partition model according to the partition identifier corresponding to each to-be-laid-out data and the preset specific structure corresponding to the sub-view control.
[0066] In the embodiment, the preset specific structure is encapsulated in the sub-view control. When generating the page layout partition model according to the element unit model and the partition identifier corresponding to each to-be-laid-out data, the sub-view control uniformly processes the specific layout information of each element unit in the to-be-generated page according to the preset specific structure to obtain the corresponding page layout partition model. In the later stage, the processed page layout partition model is only needed to be input into the parent view control to implement the proxy method, and the target page can be obtained, thereby effectively reducing the development of a large number of non-business related redundant codes and improving the page generation efficiency.
[0067] In one embodiment, the corresponding page layout partition model is generated based on the partition identifier corresponding to each to-be-laid-out data and the preset specific structure of the page layout, including: encapsulating the element unit models carrying the same partition identifier according to the preset specific structure to obtain the corresponding page layout partition model based on the partition identifier corresponding to each to-be-laid-out data and the preset specific structure of the page layout.
[0068] Specifically, the partition identifiers are the same, that is, the element unit models corresponding to the partition identifiers belong to the same partition in the to-be-generated page, and the element unit needs to be arranged in the same partition during the page layout. The sub-view control encapsulates the element unit models carrying the same partition identifier according to the preset specific structure to obtain the corresponding page layout partition model based on the partition identifier corresponding to each to-be-laid-out data. According to the method, the page layout partition model of the to-be-generated page is obtained, the element units belonging to the same layout region are bound according to the preset specific structure in advance, and in the subsequent generation of the target page, the page layout partition model is only needed to be input into the parent view to implement the corresponding proxy method to generate the target page, thereby effectively reducing the development of a large number of non-business related redundant codes and improving the page generation efficiency.
[0069] In one embodiment, the preset specific structure is set according to the page layout information of the sub-view control. Specifically, the sub-view control inherits the page layout of the parent view control, generates the preset specific result according to the page layout information, and encapsulates the preset specific structure in the sub-view control. When the to-be-laid-out data source is written into the sub-view control, the sub-view control processes each to-be-laid-out data in the to-be-laid-out data source according to the preset specific structure to obtain the corresponding page layout partition model, thereby effectively reducing the development of a large number of non-business related redundant codes and improving the page generation efficiency.
[0070] In one embodiment, as shown in Figure 4 a target page generation method is provided, and the method includes the following steps:
[0071] At step 402, the data source to be laid out is received, and the data source to be laid out is written into a sub-view control of the page to be generated, and the sub-view control inherits the page layout of the corresponding parent view control.
[0072] Specifically, when the user uses the APP to operate according to the business requirement, the APP generates a page generation request according to the business requirement of the user, sends the page generation request to the server, and carries the page identification information in the page generation request. The server determines the page layout information of the page according to the page identification information, obtains the corresponding data to be laid out according to the page layout information, processes each data to be laid out and its corresponding element unit identification and partition identification into a fixed format, sorts each data to be laid out according to the page layout information, and encapsulates to obtain the data source to be laid out. The server sends the data source to be laid out to the terminal according to the page identification information; the terminal writes the data to be laid out into the corresponding sub-view control of the page to be generated according to the page identification information of the data to be laid out, and the sub-view control inherits the page layout of the corresponding parent view control.
[0073] At step 404, the data source to be laid out is parsed by using the sub-view control to obtain each data to be laid out, and each data to be laid out carries its corresponding element unit identification information and partition identification information.
[0074] Specifically, the data source to be laid out is parsed by using the sub-view control to obtain each data to be laid out in the data source to be laid out, and each data to be laid out carries its corresponding element unit identification and partition identification. It can be understood that the data source to be laid out has a corresponding fixed format, for example, the data source to be laid out can be in json string format, and after the sub-view control parses it, the corresponding text information, picture information or link information is obtained, wherein the picture information can be the download link information of the picture.
[0075] At step 406, the sub-view control obtains the element unit type of each data to be laid out according to the element unit identification of each data to be laid out, binds each data to be laid out and its corresponding element unit type, and obtains each element unit model.
[0076] Specifically, according to the element unit identification information carried by each data to be laid out in the data source to be laid out, the element unit type corresponding to each data to be laid out is determined. The element unit type includes but is not limited to text element type, picture element type, audio element type, video element type, etc. Each data to be laid out is bound with its corresponding element unit type to obtain each element unit model.
[0077] In step 408, based on the partition identifier carried by each to-be-laid-out data and the preset specific structure of the sub-view control, the element unit model carrying the same partition identifier is encapsulated according to the preset specific structure to obtain a corresponding page layout partition model, wherein the preset specific structure is preset according to the page layout information of the sub-view control.
[0078] Specifically, the application program running on the terminal contains at least one page, and each page has corresponding page layout information. The page layout information is designed by a page designer according to the actual application of the APP. The page layout information can include the number of partitions of the page, the element unit type in each partition, the number of element units, the height information of the element units, and the click callback method corresponding to each element unit, etc.
[0079] Each element unit model can be obtained by binding a to-be-laid-out data and the element unit type corresponding thereto. The element unit model carries the partition identifier information of the to-be-laid-out data. If the partition identifier information is the same, it is considered that the element unit model belongs to the same partition, and the element unit needs to be arranged in the same partition during page layout. According to the preset specific structure of the sub-view control, the element unit models belonging to the same partition are encapsulated according to the preset specific structure to obtain a corresponding page layout partition model.
[0080] In step 410, each page layout partition model is input into a parent view control to generate a target page by implementing a proxy method encapsulated by the parent view control.
[0081] Specifically, at least one page layout partition model is transmitted to the corresponding parent view control. The parent view control implements the proxy method encapsulated therein according to the input page layout partition model to generate a corresponding target page. The parent view control is obtained by encapsulating a list view control and the corresponding proxy method to be implemented. It can be understood that the proxy method in the present scheme is UITableViewDelegate and UITableViewDataSource. The proxy method corresponding to UITableViewDelegate needs to be implemented, which returns the number of partitions corresponding to the list view and the number of element units corresponding to each partition according to the data source to be displayed. The proxy method corresponding to UITableViewDataSource is the processing method of the click event and height data of each element unit of the list view.
[0082] In the target page generation method, the to-be-laid-out data source is written into the sub-view control, each to-be-laid-out data is obtained by parsing the to-be-laid-out data source by using the sub-view control, an element unit type is obtained according to an element unit identifier corresponding to each to-be-laid-out data, an element unit model is obtained by binding each to-be-laid-out data and the element unit type corresponding to the to-be-laid-out data, each element unit model is encapsulated into a plurality of page layout partition models according to a partition identifier corresponding to the element unit model and a preset specific structure, wherein the preset specific structure is set according to page layout information, and thus the page layout partition models generated according to the specific structure have specified the number of element units required by each partition of the page, the data information corresponding to each element unit, and the height information of each element unit, and the like; the page layout partition models are input into the parent view control encapsulating the proxy method required for generating the target page, the proxy method is implemented according to each page layout partition model by using the parent view control, and the target page is generated. When a developer develops a list page by using the method in the embodiment, the developer only needs to provide the to-be-laid-out data required for generating the target page and the element unit type required for displaying the to-be-laid-out data, and the remaining repetitive page generation work is processed by the sub-view control and the parent view control, thereby reducing the generation of redundant codes in the page generation process and avoiding the risk of application crash caused by the need for re-laying out the page due to business changes.
[0083] It should be understood that, although each step in the flowchart involved in each embodiment as described above is displayed in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, at least part of the steps in the flowchart involved in each embodiment as described above can include multiple steps or stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps.
[0084] Based on the same inventive concept, the embodiments of the present application also provide a target page generation device for implementing the target page generation method as described above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, and therefore the specific limitations in one or more target page generation device embodiments provided below can refer to the limitations of the target page generation method described above, which will not be described here again.
[0085] In one embodiment, as Figure 5As shown, a target page generation apparatus 500 is provided, comprising a data writing module 501, a partition model generation module 502 and a target page generation module 503, wherein:
[0086] The data writing module 501 is configured to write a data source to be laid out into a sub-view control of a page to be generated, and the sub-view control inherits a page layout of a corresponding parent view control.
[0087] The partition model generation module 502 is configured to parse the data source to be laid out by using the sub-view control, determine elements of the page to be generated, and generate a page layout partition model of the page to be generated according to positions of the elements.
[0088] The target page generation module 503 is configured to input the page layout partition model into the parent view control, and generate a target page by using a proxy method encapsulated by the parent view control according to the page layout partition model.
[0089] The target page generation apparatus described above, since the sub-view control inherits the page layout of the parent view control, when generating the target page, only needs to write the data source to be laid out into the corresponding sub-view control, the sub-view control determines the elements of the page to be generated after parsing the data source to be laid out, generates the corresponding page layout partition model of the page to be generated according to the inherited page layout information of the parent view control, and then inputs the page layout partition model into the parent view control to generate the target page. When generating the target page, only needs to use all the proxy methods encapsulated by the parent view control, and does not need to use the proxy method separately for multiple times, thereby avoiding a large amount of redundant codes, improving the efficiency of terminal page generation, and since the sub-view control inherits the page layout of the parent view control, it is not necessary to set the layout of the sub-view control, and when the page layout information changes, only needs to modify the page layout in the parent view control, thereby greatly reducing the workload of the developer.
[0090] In one embodiment, the partition model generation module further comprises: parsing the data source to be laid out by using the sub-view control to obtain each data to be laid out; each data to be laid out carries a corresponding element unit identifier and a partition identifier; generating each element unit model according to each data to be laid out and the corresponding element unit identifier of each data to be laid out; and generating a corresponding page layout partition model according to each element unit model and the corresponding partition identifier of each data to be laid out.
[0091] In one embodiment, the partition model generation module further comprises: obtaining an element unit type of each data to be laid out according to the corresponding element unit identifier of the data to be laid out; and binding each data to be laid out with the corresponding element unit type to obtain each element unit model.
[0092] In one embodiment, the partition model generation module further comprises: generating a corresponding page layout partition model based on the partition identifier corresponding to each data to be laid out and the preset specific structure of the page layout.
[0093] In one embodiment, the partition model generation module further comprises: encapsulating element unit models carrying the same partition identifier according to the preset specific structure to obtain a corresponding page layout partition model based on the partition identifier corresponding to each data to be laid out and the preset specific structure of the page layout.
[0094] The modules in the above target page generation apparatus can be realized by software, hardware, and combinations thereof, in whole or in part. The modules can be embedded in or independent of a processor in a computer device in hardware form, or stored in a memory in a computer device in software form, so as to be called and executed by a processor to perform operations corresponding to the modules.
[0095] In one embodiment, a computer device is provided, which can be a server, and an internal structure diagram thereof can be as shown in Figure 6 The computer device includes a processor, a memory, and a network interface connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The database of the computer device is configured to store element unit type data. The network interface of the computer device is configured to communicate with an external terminal through a network connection. The computer program is executed by the processor to implement a target page generation method.
[0096] Those skilled in the art can understand that Figure 6 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. A specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0097] In one embodiment, a computer device is provided, which includes a memory and a processor. The memory stores a computer program. The processor executes the computer program to implement the following steps:
[0098] The data source to be laid out is written into a sub-view control of the page to be generated. The sub-view control inherits the page layout of the corresponding parent view control.
[0099] The sub-view control is used to parse the data source to be laid out, to determine elements of a page to be generated, and to generate a page layout partition model of the page to be generated according to positions of the elements.
[0100] The page layout partition models are input into the parent view control, and a target page is generated according to the page layout partition models by using a proxy method encapsulated by the parent view control.
[0101] In one embodiment, the processor, when executing the computer program, also implements the following steps:
[0102] The sub-view control is used to parse the data source to be laid out, to obtain each data to be laid out, and each data to be laid out carries a corresponding element unit identifier and a partition identifier.
[0103] Each element unit model is generated according to each data to be laid out and the element unit identifier corresponding to each data to be laid out.
[0104] A corresponding page layout partition model is generated according to each element unit model and the partition identifier corresponding to each data to be laid out.
[0105] In one embodiment, the processor, when executing the computer program, also implements the following steps:
[0106] The element unit type of each data to be laid out is obtained according to the element unit identifier corresponding to the data to be laid out.
[0107] Each element unit model is obtained by binding each data to be laid out and the element unit type corresponding to the data to be laid out.
[0108] In one embodiment, the processor, when executing the computer program, also implements the following steps:
[0109] A corresponding page layout partition model is generated based on the partition identifier corresponding to each data to be laid out and a preset specific structure of a page layout.
[0110] In one embodiment, the processor, when executing the computer program, also implements the following steps:
[0111] The element unit models carrying the same partition identifier are encapsulated according to the preset specific structure based on the partition identifier corresponding to each data to be laid out and a preset specific structure of a page layout, to obtain a corresponding page layout partition model.
[0112] In one embodiment, the processor, when executing the computer program, also implements the following steps:
[0113] The preset specific structure is set according to page layout information of the sub-view control.
[0114] In one embodiment, a computer readable storage medium is provided, having stored thereon a computer program which, when executed by a processor, implements the following steps:
[0115] writing the data source to be laid out into a sub-view control of the page to be generated, the sub-view control inheriting the page layout of the corresponding parent view control;
[0116] using the sub-view control to parse the data source to be laid out, determining elements of the page to be generated, and generating a page layout partition model of the page to be generated according to the positions of the elements;
[0117] inputting each page layout partition model into the parent view control, and using the proxy method encapsulated by the parent view control to generate a target page according to each page layout partition model.
[0118] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0119] using the sub-view control to parse the data source to be laid out to obtain each data to be laid out; each data to be laid out carries a corresponding element unit identifier and a partition identifier;
[0120] generating each element unit model according to each data to be laid out and the element unit identifier corresponding to each data to be laid out;
[0121] generating a corresponding page layout partition model according to each element unit model and the partition identifier corresponding to each data to be laid out.
[0122] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0123] obtaining the element unit type of each data to be laid out according to the element unit identifier corresponding to the data to be laid out;
[0124] binding each data to be laid out with the element unit type corresponding thereto to obtain each element unit model.
[0125] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0126] generating a corresponding page layout partition model based on the partition identifier corresponding to each data to be laid out and the preset specific structure of the page layout.
[0127] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0128] based on the partition identifier corresponding to each data to be laid out and the preset specific structure of the page layout, encapsulating element unit models carrying the same partition identifier according to the preset specific structure to obtain a corresponding page layout partition model.
[0129] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0130] The preset specific structure is set according to the page layout information of the sub-view control.
[0131] In one embodiment, a computer program product is provided, comprising a computer program which, when executed by the processor, implements the following steps:
[0132] The to-be-laid-out data source is written into the sub-view control of the to-be-generated page, and the sub-view control inherits the page layout of the corresponding parent view control;
[0133] The to-be-laid-out data source is parsed by using the sub-view control to determine the elements of the to-be-generated page, and a page layout partition model of the to-be-generated page is generated according to the positions of the elements;
[0134] Each page layout partition model is input into the parent view control, and a target page is generated according to each page layout partition model by using the proxy method encapsulated by the parent view control.
[0135] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0136] The to-be-laid-out data source is parsed by using the sub-view control to obtain each to-be-laid-out data; each to-be-laid-out data carries a corresponding element unit identifier and a partition identifier;
[0137] Each element unit model is generated according to each to-be-laid-out data and the element unit identifier corresponding to each to-be-laid-out data;
[0138] The corresponding page layout partition model is generated according to each element unit model and the partition identifier corresponding to each to-be-laid-out data.
[0139] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0140] The element unit type of each to-be-laid-out data is obtained according to the element unit identifier corresponding to the to-be-laid-out data;
[0141] Each to-be-laid-out data is bound with the element unit type corresponding thereto to obtain each element unit model.
[0142] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0143] The corresponding page layout partition model is generated based on the partition identifier corresponding to each to-be-laid-out data and the preset specific structure of the page layout.
[0144] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0145] According to the partition identifier corresponding to each piece of to-be-laid-out data and the preset specific structure of the page layout, element unit models carrying the same partition identifier are encapsulated according to the preset specific structure, to obtain a corresponding page layout partition model.
[0146] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0147] The preset specific structure is set according to page layout information of the sub-view control.
[0148] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties.
[0149] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric memory (Ferroelectric Random Access Memory, FRAM), phase change memory (Phase Change Memory, PCM), graphene memory, etc. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.
[0150] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present application.
[0151] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are within the scope of protection of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A method of generating a target page, characterized by, The method comprises: writing a data source to be laid out into a sub-view control of a page to be generated, the sub-view control inheriting a page layout of a corresponding parent view control; using the sub-view control, parsing the data source to be laid out to obtain each data to be laid out, each data to be laid out carrying a corresponding element unit identifier and a partition identifier; generating each element unit model according to each data to be laid out and the element unit identifier corresponding to each data to be laid out; generating a corresponding page layout partition model according to each element unit model and the partition identifier corresponding to each data to be laid out; inputting each page layout partition model into the parent view control, and using a proxy method encapsulated by the parent view control to generate a target page according to each page layout partition model; the proxy method encapsulated by the parent view control comprises a protocol proxy method and a data source proxy method, the protocol proxy method returns the number of partitions corresponding to a list view and the number of element units corresponding to each partition according to a data source to be displayed, and the data source proxy method is a processing method for a click event and a height of each element unit of the list view.
2. The method of claim 1, wherein, The generating each element unit model according to each data to be laid out and the element unit identifier corresponding to each data to be laid out comprises: obtaining an element unit type of each data to be laid out according to the element unit identifier corresponding to the data to be laid out; binding each data to be laid out and the element unit type corresponding to the data to be laid out to generate each element unit model.
3. The method of claim 1, wherein, The generating a corresponding page layout partition model according to each element unit model and the partition identifier corresponding to each data to be laid out comprises: generating a corresponding page layout partition model based on the partition identifier corresponding to each data to be laid out and a preset specific structure of the page layout; the preset specific structure is used to specify the number of partitions of the page to be generated, the element unit type in each partition, the number of element units, the height information of the element units, and the click callback method corresponding to each element unit.
4. The method of claim 3, wherein, The generating a corresponding page layout partition model based on the partition identifier corresponding to each data to be laid out and the preset specific structure of the page layout comprises: based on the partition identifier corresponding to each data to be laid out and the preset specific structure of the page layout, encapsulating element unit models carrying the same partition identifier according to the preset specific structure to obtain a corresponding page layout partition model.
5. The method of claim 3, wherein, The preset specific structure is set according to page layout information of the sub-view control.
6. A target page generating apparatus characterized by comprising: The device comprises: a data writing module configured to write a data source to be laid out into a sub-view control of a page to be generated, the sub-view control inheriting a page layout of a corresponding parent view control; The partition model generation module is configured to parse the to-be-laid-out data source by using the sub-view control to obtain each to-be-laid-out data, wherein each to-be-laid-out data carries a corresponding element unit identifier and a partition identifier; generate each element unit model according to each to-be-laid-out data and the element unit identifier corresponding to each to-be-laid-out data; and generate a corresponding page layout partition model according to each element unit model and the partition identifier corresponding to each to-be-laid-out data. The target page generation module is configured to input each page layout partition model into the parent view control, and generate a target page according to each page layout partition model by using a proxy method encapsulated by the parent view control. The proxy method encapsulated by the parent view control includes a protocol proxy method and a data source proxy method. The protocol proxy method returns the number of partitions corresponding to a list view and the number of element units corresponding to each partition according to a data source required to be displayed. The data source proxy method is a processing method for a click event and height data of each element unit of the list view.
7. The apparatus of claim 6, wherein, The partition model generation module is configured to obtain an element unit type of each to-be-laid-out data according to the element unit identifier corresponding to the to-be-laid-out data; and bind each to-be-laid-out data and the element unit type corresponding thereto to generate each element unit model.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, The processor executes the computer program to implement the steps of the method in any one of claims 1 to 5.
9. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 5.
10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 5.
Citation Information
Patent Citations
Table webpage generation method and device
CN111104635A
Interface calling method and device, computer equipment and storage medium
CN112988409A