Method, device, equipment and readable storage medium for constructing page components
By obtaining and querying component data and view classes, and dynamically creating and loading business UI components, the problems of extended release time and low iteration efficiency caused by frequent modification of UI components are solved, and more efficient application software iteration is achieved.
Patent Information
- Application Number
- CN202111074579.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-14
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2041-09-14
AI Technical Summary
During the application software requirements iteration process, due to the frequent addition, modification and deletion of UI components, the release time is extended and the iteration efficiency is low.
By obtaining the component data of the business component to be built and its corresponding manager class mapping table, querying the mapping table to determine the view class corresponding to the component data, creating a business UI component in the view model, and building a page view based on the business UI component.
It reduces the time for frequent code changes, improves the iteration efficiency of application software, and avoids the creation of unnecessary business UI components and warnings of excessive memory.
Smart Images

Figure CN113778443B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of UI development, and in particular to a method, device, equipment and readable storage medium for constructing a page component. Background Art
[0002] In the process of iterating the requirements of electronic product application software, it is usually necessary to re-release the page because of the need to add, modify or delete a specified UI component. Sometimes, due to repeated modifications of the same UI component, technicians need to frequently change the code, which prolongs the release time and greatly reduces the iteration efficiency of the application software. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a method, apparatus, device and readable storage medium for constructing a page component to solve the problems of long release time and low iteration efficiency of application software.
[0004] According to the first aspect, an embodiment of the present invention provides a method for constructing a page component, including: obtaining component data corresponding to a business component to be constructed and a mapping table between the business component to be constructed and a manager class; querying the mapping table to determine a view class corresponding to the component data; creating a business UI component in a view model based on component properties in the view class; and constructing a page view according to the business UI component.
[0005] The method for constructing a page component provided by an embodiment of the present invention obtains component data corresponding to the component to be created, constructs a manager corresponding thereto, generates a mapping table between the business component to be constructed and the manager class, finds the view class corresponding to the component data based on the mapping table, creates a business UI component, and loads it into the page view. Since the component data corresponding to the component to be created is determined based on the user's browsing intention, the creation of the business UI component is determined by the component data here, which facilitates the creation of the business UI component by the technician as needed, without the need to frequently change the code information of the business UI component, thus minimizing the time for frequent code changes and improving the iteration efficiency of the application software. At the same time, the creation of redundant business UI components is avoided, and the warning of excessive memory is avoided.
[0006] In combination with the first aspect, in a first implementation of the first aspect, creating a business UI component in the view model based on the component properties in the view class includes: determining whether the component properties of the view class correspond to a container class component; when the component properties of the view class correspond to a container class component, creating a container business UI component in the view model.
[0007] In combination with the first implementation of the first aspect, in the second implementation of the first aspect, the business UI component is created in the view model based on the component properties in the view class, and also includes: when the component properties of the view class correspond to a non-container class component, a separate business UI component is created in the view model.
[0008] The method for constructing a page component provided by an embodiment of the present invention determines whether the component property of the view class corresponds to a container class component. When the component property of the view class corresponds to a container class component, a container business UI component is created in the view model. When the component property of the view class corresponds to a non-container class component, a separate business UI component is created in the view model, thereby ensuring the accurate creation of the business UI component and avoiding repeated modifications due to errors in the creation of the business UI component.
[0009] In combination with the first aspect, in a third implementation of the first aspect, constructing a page view based on the business UI component includes: adding the business UI component to a first view list corresponding to the view model; assigning the first view list to a second view list corresponding to the page view to obtain a page component; and laying out the page component to generate the page view.
[0010] The method for constructing a page component provided by an embodiment of the present invention adds a business UI component to a first view list corresponding to a view model, assigns the first view list to a second view list corresponding to a page view, obtains a page component, and lays out the page component to generate a page view, thereby realizing dynamic creation of the business UI component in the view model, and then dynamically adding it to the page view, realizing dynamic update of the business UI component on the page view and loading it onto the page.
[0011] In combination with the third implementation manner of the first aspect, in the fourth implementation manner of the first aspect, after assigning the first view list to the second view list corresponding to the page view to obtain the page component, it also includes: constructing a fixed component view to obtain a fixed component list, the fixed component list including multiple component views of the same level; determining whether the component data is in the fixed component list; when the component data is in the fixed component list, directly adding the business UI component corresponding to the component data to the page view; and updating the position of the container component corresponding to the page view.
[0012] In combination with the fourth implementation of the first aspect, in the fifth implementation of the first aspect, after assigning the first view list to the second view list corresponding to the page view to obtain the page component, it also includes: when the component data is not in the fixed component list, determining whether the business UI component corresponding to the component data is in the container component; when the business UI component corresponding to the component data is in the container component, loading the business UI component corresponding to the component data into the page view.
[0013] The method for constructing a page component provided by an embodiment of the present invention constructs a fixed component view including multiple component views of the same level to form a fixed component list, and determines whether the component data is in the fixed component list. When the component data is in the fixed component list, the business UI component corresponding to the component data is directly added to the page view, and the position of the container component corresponding to the page view is updated, so as to facilitate traversing the container components from top to bottom, stacking each container component in sequence, and completing the construction of the page view; when the component data is not in the fixed component list, it is determined whether the business UI component corresponding to the component data is in the container component. If the business UI component corresponding to the component data is in the container component, it indicates that the business UI component corresponding to the component data belongs to the component for constructing the page view, and it is loaded into the page view to realize the construction of the page view, thereby ensuring the accurate construction of the page view.
[0014] In combination with the first aspect, in a sixth implementation of the first aspect, querying the mapping table to determine the view class corresponding to the component data includes: obtaining a component identifier corresponding to the component data; and querying the mapping table based on the component identifier to determine the view class corresponding to the component data.
[0015] The page component construction method provided in the embodiment of the present invention obtains the component identifier corresponding to the component data, queries the mapping table based on the component identifier, and determines the view class corresponding to the component data. This makes it easy for technical personnel to create business UI components corresponding to the component data according to actual needs, thereby ensuring flexible creation of business UI components.
[0016] According to the second aspect, an embodiment of the present invention provides a device for constructing a page component, comprising: an acquisition module, used to obtain component data corresponding to a business component to be constructed and a mapping table between the business component to be constructed and a manager class; a query module, used to query the mapping table to determine a view class corresponding to the component data; a creation module, used to create a business UI component in a view model based on component properties in the view class; and a construction module, used to construct a page view according to the business UI component.
[0017] The construction device of the page component provided by the embodiment of the present invention obtains the component data corresponding to the component to be created, constructs the corresponding manager, generates a mapping table between the business component to be constructed and the manager class, finds the view class corresponding to the component data based on the mapping table, creates the business UI component, and loads it into the page view. Since the component data corresponding to the component to be created is determined based on the user's browsing intention, the creation of the business UI component is determined by the component data here, which makes it convenient for technicians to create the business UI component as needed, without frequently changing the code information of the business UI component, thus minimizing the time for frequent code changes and improving the iteration efficiency of the application software. At the same time, the creation of redundant business UI components is avoided, and the warning of excessive memory is avoided.
[0018] According to the third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the method for constructing a page component described in the first aspect or any embodiment of the first aspect by executing the computer instructions.
[0019] According to a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method for constructing a page component described in the first aspect or any implementation method of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 is a flowchart of a method for constructing a page component according to an embodiment of the present invention;
[0022] Figure 2 is another flow chart of a method for constructing a page component according to an embodiment of the present invention;
[0023] Figure 3 is another flow chart of a method for constructing a page component according to an embodiment of the present invention;
[0024] Figure 4 is a structural block diagram of a device for constructing a page component according to an embodiment of the present invention;
[0025] Figure 5It is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0027] According to an embodiment of the present invention, an embodiment of a method for constructing a page component is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0028] In this embodiment, a method for constructing a page component is provided, which can be used in electronic devices such as mobile phones, tablet computers, and computers. Figure 1 is a flow chart of a method for constructing a page component according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0029] S11, obtaining component data corresponding to the business component to be constructed and a mapping table between the business component to be constructed and the manager class.
[0030] The business components to be built are the business components required for the current APP release. The component data of the business components to be built are dynamically returned by the server connected to the electronic device. As the front end, the electronic device can adopt the VIPER architecture mode to build the page view according to the component data corresponding to the components to be built.
[0031] Each business UI component of the page view corresponds to a manager class, which includes: functions assigned to component data, functions to implement component click events, and functions for component fallback UI. Specifically, the electronic device can assign specified component data to the manager, use string constants to determine the click position of the button, implement click events, and set fallback UI functions.
[0032] The electronic device is locally set with its own mapping table for each business UI component, which includes the component view name componentViewName, the component data model name componentModelName, the component logic class viewModel name componentViewModelName and the component unique identifier widget_id. Since it is necessary to create a corresponding manage for each business component to be constructed, a mapping between the business component to be constructed and the manager class can be formed, thereby generating a mapping table between the business component to be constructed and the manager class.
[0033] The VIPER architecture model is the view-entity (data)-interactor-presenter-router architecture. The view contains the business logic at the UI level and the method calls at the interactor level; the electronic device can create all the basic UI components needed for the page view based on the UIView class in the view, including: custom buttons, custom labels, some page display modules, etc., and assemble specific business UI modules based on the basic UI components. Specifically, basic UI components can be added to the containerView according to business needs.
[0034] Among them, the entity is a data object. The entity is responsible for requesting the data of the page view and assigning the requested data to the corresponding model class. After it requests the network data, it can cut the network data and generate the corresponding business models respectively.
[0035] Among them, the interactor includes business logic about data and network requests, such as creating an entity (data) or obtaining some data from the server. However, the implementation of these functions requires reliance on external services and managers. The interactor can create a corresponding manager for each specific business component. The manager includes: UI component registration ID, click response events, data assignment, and bottom-up UI assignment.
[0036] Among them, the displayer is used to cut the data requested by the entity, and then create a corresponding model class for each json data. Each model class corresponds to a specific business UI component, and displays and assigns values to the business UI component. Specifically, the electronic device can create a click constant enumeration, that is, the click event constants of various business UI components, distinguishing different click positions; it can also create a component array list, in which the data models of all business UI components are placed. Each data model contains the manager class name of the business component, the component View class name of the business component, the component ID of the business component, the position of the business component in the page view, and the enumeration of the business component.
[0037] Among them, the router is used to connect the various interactors of VIPER, that is, to connect multiple managers together to synthesize modular pages.
[0038] S12, querying the mapping table to determine the view class corresponding to the component data.
[0039] After receiving the component data corresponding to the component to be built, the electronic device can determine the component ID corresponding to the component data based on the mapping table between the component to be built and the manager class, and query the mapping table based on the component ID to determine the view class corresponding to the component data, that is, the View class.
[0040] S13, based on the component properties in the view class, create a business UI component in the view model.
[0041] Component attributes are used to indicate whether the component corresponding to the view class is a container component. After determining the View class corresponding to the component data, the electronic device can identify the corresponding component attributes to create a corresponding business UI component in the view model (ViewModel) according to the component attributes. The business UI component is the functional component required to be displayed in the current page view, that is, the component required to be displayed on the APP release page view.
[0042] S14, constructing a page view according to the business UI component.
[0043] The electronic device assigns the business UI component created in the view model (ViewModel) to the page view, obtains the page component corresponding to the business UI component, dynamically loads the page component into the page view, and generates a corresponding target page.
[0044] The method for constructing a page component provided in this embodiment obtains the component data corresponding to the component to be created, constructs a manager corresponding to it, generates a mapping table between the business component to be constructed and the manager class, finds the view class corresponding to the component data based on the mapping table, creates the business UI component, and loads it into the page view. Since the component data corresponding to the component to be created is determined based on the user's browsing intention, the creation of the business UI component is determined by the component data here, which makes it easy for technicians to create business UI components as needed, without frequently changing the code information of the business UI component, thus minimizing the time for frequent code changes and improving the iteration efficiency of the application software. At the same time, the creation of redundant business UI components is avoided, and the warning of excessive memory is avoided.
[0045] In this embodiment, a method for constructing a page component is provided, which can be used in electronic devices such as mobile phones, tablet computers, and computers. Figure 2 is a flow chart of a method for constructing a page component according to an embodiment of the present invention. Figure 2As shown, the process includes the following steps:
[0046] S21, obtaining component data corresponding to the service component to be constructed and a mapping table between the service component to be constructed and the manager class. For detailed description, please refer to the relevant description of the above embodiment, which will not be repeated here.
[0047] S22, query the mapping table to determine the view class corresponding to the component data. For detailed description, please refer to the relevant description of the above embodiment, which will not be repeated here.
[0048] S23, based on the component properties in the view class, create a business UI component in the view model.
[0049] Specifically, the above step S23 may include:
[0050] S231, determining whether the component property of the view class corresponds to the container class component.
[0051] The electronic device identifies the component attribute of the view class and determines whether the component attribute corresponds to the container class component. When the component attribute of the view class corresponds to the container class component, step S232 is executed, otherwise step S233 is executed.
[0052] S232, creating a container business UI component in the view model.
[0053] When the component property of the view class corresponds to a container class component, it indicates that the component to be constructed is a container class component. At this time, the electronic device can create a container business UI component corresponding to the component data in the view model according to the component property.
[0054] S233, create a separate business UI component in the view model.
[0055] When the component property of the view class corresponds to a non-container component, it means that the component to be constructed is a single component, not a container component. At this time, the electronic device can create a separate business UI component corresponding to the component data in the view model according to the component property.
[0056] S24, constructing a page view according to the business UI component. For detailed description, please refer to the relevant description of the above embodiment, which will not be repeated here.
[0057] The page component construction method provided in this embodiment determines whether the view class is a container class component. When the view class is a container component, a container business UI component is created in the view model. When the view class is not a container component, a separate business UI component is created in the view model. This ensures the accurate creation of the business UI component and avoids repeated modifications due to errors in the creation of the business UI component.
[0058] In this embodiment, a method for constructing a page component is provided, which can be used in electronic devices such as mobile phones, tablet computers, and computers. Figure 3 is a flow chart of a method for constructing a page component according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0059] S31, obtaining component data corresponding to the service component to be constructed and a mapping table between the service component to be constructed and the manager class. For detailed description, please refer to the relevant description of the above embodiment, which will not be repeated here.
[0060] S32, querying the mapping table to determine the view class corresponding to the component data.
[0061] Specifically, the above step S32 may include:
[0062] S321, obtaining a component identifier corresponding to the component data.
[0063] The component identifier is a unique identifier of the component to be constructed. After receiving the component data returned by the server, the electronic device can determine the unique identifier widget_id of the component corresponding to the current component data from a mapping table between the components to be constructed and the manager class pre-stored locally.
[0064] S322, query the mapping table based on the component identifier to determine the view class corresponding to the component data.
[0065] After obtaining the unique identifier widget_id of the component, the electronic device can use widget_id to find the corresponding componentViewName, componentModelName and componentViewModelName in the mapping table. Create the corresponding view through componentViewName, create the corresponding model data model through componentModelName, and create the corresponding viewModel logic class through componentViewModelName.
[0066] S33, based on the component attributes in the view class, create a business UI component in the view model. For detailed description, please refer to the relevant description of the above embodiment, which will not be repeated here.
[0067] S34, constructing a page view according to the business UI component.
[0068] Specifically, the above step S34 may include:
[0069] S341, adding the business UI component to the first view list corresponding to the view model.
[0070] The first view list is a UI view list componentViewArray in the view model, i.e., a view array, which contains the View views corresponding to multiple business UI components required for APP release. After creating a business UI component, the electronic device can add it to the first view list so that the business UI component in the first view list can be dynamically loaded into the page view.
[0071] S342, assigning the first view list to the second view list corresponding to the page view to obtain a page component.
[0072] The second view list is the UI view list corresponding to the page view, that is, the view array for loading the page view. After the electronic device completes the creation of each business UI component in the view model, it can generate the corresponding first view list. In order to load it into the page view, the electronic device needs to assign the corresponding first UI view list (componentViewArray) in the view model to the second UI view list (componentViewArray) of the page view to obtain the page component corresponding to the page view.
[0073] S343, layout the page components and generate a page view.
[0074] After obtaining the second UI view list, the electronic device can lay out the page components corresponding to the second UI view list in order from top to bottom to obtain a page view. Specifically, after the page view obtains the second view list, the electronic device can use Masonry to lay out the page components corresponding to the second UI view list from top to bottom in the page view.
[0075] Optionally, after step S352, the following steps may also be included:
[0076] (1) Construct a fixed component view to obtain a fixed component list, wherein the fixed component list includes multiple component views at the same level.
[0077] A fixed component view is a component view at the same level as a container component, for example, a search box and an anchor are at the same level as a container component. In response to a construction instruction for a fixed component view, the electronic device can generate multiple fixed component views corresponding to the construction instruction to obtain a fixed component list.
[0078] (2) Determine whether the component data is in the fixed component list.
[0079] When the electronic device obtains the component data, it can compare the component data with the component data in the fixed component list to determine whether the component data is in the fixed component list. If the component data is in the fixed component list, step (3) is executed, otherwise step (5) is executed.
[0080] (3) Add the business UI component corresponding to the component data directly to the page view.
[0081] When component data is in the fixed component list, it means that the component data is a functional component required for building an APP release. At this time, the electronic device can directly add the business UI component corresponding to the component data to the page view.
[0082] (4) Update the position of the container component corresponding to the page view.
[0083] When the page view detects the addition of a business UI component, the electronic device may update the position of the container component corresponding to the current page view, that is, rearrange the multiple container components in a bottom-to-bottom order.
[0084] (5) Determine whether the component data is in the container component.
[0085] When the component data is not in the fixed component list, the component data can be further compared with the component data in the container component to determine whether the component data is in the container component. When the component data is in the container component, step (6) is executed, otherwise other operations are executed. The other operations may be discarding the component data and re-acquiring it, or separately constructing the business UI component corresponding to the component data. No specific limitation is made here for other operations.
[0086] (6) Load the business UI component corresponding to the component data into the page view.
[0087] When component data is in a container component, it means that the business UI component corresponding to the component data is the component required for APP release. Here, the electronic device can add it directly to the container component and refresh the page view to load the business UI component corresponding to the component data into the page view.
[0088] The method for constructing a page component provided in this embodiment obtains the component identifier corresponding to the component data, queries the mapping table based on the component identifier, and determines the view class corresponding to the component data, thereby facilitating the technicians to create the business UI component corresponding to the component data according to actual needs, and ensuring the flexible creation of the business UI component. By adding the business UI component to the first view list corresponding to the view model, assigning the first view list to the second view list corresponding to the page view, the page component is obtained, and the page view is generated based on the layout of the page component, thereby realizing the dynamic creation of the business UI component in the view model, and then dynamically adding it to the page view, realizing the dynamic update of the business UI component on the page view and loading it onto the page. By constructing a fixed component view including multiple component views at the same level to form a fixed component list, it is determined whether the component data is in the fixed component list. When the component data is in the fixed component list, the business UI component corresponding to the component data is directly added to the page view, and the position of the container component corresponding to the page view is updated to facilitate traversal of the container components from top to bottom, stacking each container component in sequence to complete the construction of the page view; when the component data is not in the fixed component list, determine whether the business UI component corresponding to the component data is in the container component. If the business UI component corresponding to the component data is in the container component, it means that the business UI component corresponding to the component data belongs to the component for constructing the page view, and it is loaded into the page view to realize the construction of the page view, thereby ensuring the accurate construction of the page view.
[0089] In this embodiment, a device for constructing a page component is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated hereafter. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0090] This embodiment provides a device for constructing a page component, such as Figure 4 As shown, including:
[0091] The acquisition module 41 is used to acquire component data corresponding to the service component to be constructed and a mapping table between the service component to be constructed and the manager class. For detailed description, please refer to the relevant description corresponding to the above method embodiment, which will not be repeated here.
[0092] The query module 42 is used to query the mapping table to determine the view class corresponding to the component data. For detailed description, please refer to the relevant description corresponding to the above method embodiment, which will not be repeated here.
[0093] The creation module 43 is used to create a business UI component in the view model based on the component attributes in the view class. For detailed description, please refer to the relevant description corresponding to the above method embodiment, which will not be repeated here.
[0094] The construction module 44 is used to construct a page view according to the business UI component. For detailed description, please refer to the relevant description corresponding to the above method embodiment, which will not be repeated here.
[0095] The construction device of the page component in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0096] The further functional description of each of the above modules is the same as that of the above corresponding embodiments and will not be repeated here.
[0097] The embodiment of the present invention also provides an electronic device having the above Figure 4 The construction device of the page component shown.
[0098] See also Figure 5 , Figure 5 is a schematic diagram of the structure of an electronic device provided by an optional embodiment of the present invention, such as Figure 5 As shown, the electronic device may include: at least one processor 501, such as a CPU (Central Processing Unit), at least one communication interface 503, a memory 504, and at least one communication bus 502. The communication bus 502 is used to realize the connection and communication between these components. The communication interface 503 may include a display screen (Display), a keyboard (Keyboard), and the optional communication interface 503 may also include a standard wired interface and a wireless interface. The memory 504 may be a high-speed RAM memory (Random Access Memory) or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 504 may optionally be at least one storage device located away from the aforementioned processor 501. The processor 501 may be combined with Figure 4 In the described device, the memory 504 stores an application program, and the processor 501 calls the program code stored in the memory 504 to execute any of the above method steps.
[0099] The communication bus 502 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The communication bus 502 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0100] Among them, the memory 504 may include a volatile memory (English: volatile memory), such as a random access memory (English: random-access memory, abbreviated: RAM); the memory may also include a non-volatile memory (English: non-volatile memory), such as a flash memory (English: flash memory), a hard disk drive (English: hard disk drive, abbreviated: HDD) or a solid-state drive (English: solid-state drive, abbreviated: SSD); the memory 504 may also include a combination of the above types of memory.
[0101] The processor 501 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and a NP.
[0102] The processor 501 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0103] Optionally, the memory 504 is also used to store program instructions. The processor 501 can call the program instructions to implement the present application Figures 1 to 3The method for constructing the page component shown in the embodiment.
[0104] The embodiment of the present invention also provides a non-transitory computer storage medium, which stores computer executable instructions, and the computer executable instructions can execute the processing method of the construction method of the page component in any of the above method embodiments. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (Flash Memory), a hard disk (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above types of memory.
[0105] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for constructing a page component, characterized in that: include: Obtain component data corresponding to the business component to be constructed and a mapping table between the business component to be constructed and the manager class; Query the mapping table to determine the view class corresponding to the component data; Based on the component properties in the view class, creating a business UI component in the view model, including: determining whether the component properties of the view class correspond to a container class component; when the component properties of the view class correspond to a container class component, creating a container business UI component in the view model; when the component properties of the view class correspond to a non-container class component, creating a separate business UI component in the view model; Construct a page view according to the business UI component.
2. The method according to claim 1, characterized in that The step of constructing a page view according to the business UI component includes: Add the business UI component to the first view list corresponding to the view model; Assigning the first view list to the second view list corresponding to the page view to obtain a page component; The page components are laid out to generate the page view.
3. The method according to claim 2, characterized in that After assigning the first view list to the second view list corresponding to the page view to obtain the page component, the method further includes: Constructing a fixed component view to obtain a fixed component list, wherein the fixed component list includes a plurality of component views at the same level; Determining whether the component data is in the fixed component list; When the component data is in the fixed component list, directly adding the business UI component corresponding to the component data to the page view; Update the position of the container component corresponding to the page view.
4. The method according to claim 3, characterized in that After assigning the first view list to the second view list corresponding to the page view to obtain the page component, the method further includes: When the component data is not in the fixed component list, determining whether the component data is in a container component; When the component data is in a container component, the business UI component corresponding to the component data is loaded into the page view.
5. The method according to claim 1, characterized in that The querying the mapping table to determine the view class corresponding to the component data includes: Obtaining a component identifier corresponding to the component data; The mapping table is queried based on the component identifier to determine the view class corresponding to the component data.
6. A device for constructing a page component, characterized in that: include: An acquisition module, used to acquire component data corresponding to the business component to be constructed and a mapping table between the business component to be constructed and the manager class; A query module, used for querying the mapping table to determine the view class corresponding to the component data; A creation module, used to create a business UI component in the view model based on the component attributes in the view class, including: determining whether the component attributes of the view class correspond to a container class component; when the component attributes of the view class correspond to a container class component, creating a container business UI component in the view model; when the component attributes of the view class correspond to a non-container class component, creating a separate business UI component in the view model; A construction module is used to construct a page view according to the business UI component.
7. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for constructing a page component according to any one of claims 1 to 5 by executing the computer instructions.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method for constructing a page component according to any one of claims 1 to 5.
Citation Information
Patent Citations
Form generation method, device, computer and storage medium
CN108428112A