CN114428609A - Page file generation method and device, storage medium and electronic equipment - Google Patents

Page file generation method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN114428609A
CN114428609A CN202210056537.4A CN202210056537A CN114428609A CN 114428609 A CN114428609 A CN 114428609A CN 202210056537 A CN202210056537 A CN 202210056537A CN 114428609 A CN114428609 A CN 114428609A
Authority
CN
China
Prior art keywords
component
page
target
components
commodity
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210056537.4A
Other languages
Chinese (zh)
Inventor
蒋圣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Youzhuju Network Technology Co Ltd
Original Assignee
Beijing Youzhuju Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Youzhuju Network Technology Co Ltd filed Critical Beijing Youzhuju Network Technology Co Ltd
Priority to CN202210056537.4A priority Critical patent/CN114428609A/en
Publication of CN114428609A publication Critical patent/CN114428609A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure relates to a method and a device for generating a page file, a storage medium and an electronic device, wherein the method comprises the following steps: acquiring a page description file; analyzing the page description file to obtain a page component tree; generating a corresponding entry file based on a target platform language rule according to the hierarchical relation among the components in the page component tree and the type and attribute value of each component; selecting each target component which is of a corresponding type and is realized by adopting a target platform language from a component library according to the type of each component in the page component tree, and copying each target component to a directory where the entry file is located to obtain a target page item; and compiling the target page project to obtain the page file realized by adopting the target platform language. According to the method and the device, the page description file can be automatically converted into the page files of multiple platforms by writing the page description file, and a user can increase or decrease components and modify attribute values of the components in the page description file to adjust the target page without knowing specific code development.

Description

Page file generation method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for generating a page file, a storage medium, and an electronic device.
Background
The same application may have multiple application platforms, such as an applet, a webpage, Android (Android) and iOS, each platform has a different programming language, and when developing cross-platform applications, versions of multiple different platforms are often required to be developed, which requires developers to learn multiple languages at the same time, and the same logic and page are implemented on multiple platforms by using different platform languages, which consumes a lot of manpower and has a high learning threshold for developers.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In a first aspect, the present disclosure provides a method for generating a page file, including:
acquiring a page description file, wherein the page description file is used for describing types and attribute values of a plurality of components required by a target page;
analyzing the page description file to obtain a page component tree, wherein the page component tree comprises the hierarchical relation among the components and the type and attribute value of each component;
generating a corresponding entry file based on a target platform language rule according to the hierarchical relation in the page component tree and the type and attribute value of each component;
selecting each target component which corresponds to the type and is realized by adopting a target platform language from a component library according to the type of each component in the page component tree, and copying each target component to a directory where the entry file is located to obtain a target page item;
and compiling the target page project to obtain a page file realized by adopting a target platform language.
In a second aspect, the present disclosure provides a device for generating a page file, including:
the page description module is used for acquiring a page description file, and the page description file is used for describing types and attribute values of a plurality of components required by a target page;
the page analysis module is used for analyzing the page description file to obtain a page component tree, and the page component tree comprises the hierarchical relation among the components and the type and attribute value of each component;
the entry generation module is used for generating a corresponding entry file based on a target platform language rule according to the hierarchical relation in the page component tree and the type and the attribute value of each component;
the component copying module is used for selecting each target component which corresponds to the type and is realized by adopting a target platform language from a component library according to the type of each component in the page component tree, and copying each target component to a directory where the entry file is located to obtain a target page project;
and the project compiling module is used for compiling the target page project to obtain a page file realized by adopting a target platform language.
In a third aspect, the present disclosure provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processing apparatus, implements the method of the first aspect.
In a fourth aspect, the present disclosure provides an electronic device comprising:
a storage device having a computer program stored thereon;
processing means for executing the computer program in the storage means to implement the method of the first aspect.
In the above technical solution, only the page description file described in the structured language needs to be obtained, the hierarchical relationship of the components in the page description file, the type and the attribute value of each component may be automatically analyzed, and the corresponding entry file may be generated based on the corresponding platform language rule, for example, under a default condition, the html page file, the Android page file, and the iOS page file may be automatically generated based on the html language rule, the Android language rule, and the iOS language rule, or a certain target platform language may be specified to generate the page file corresponding to the target platform language. The page description file only needs to describe the types and attribute values of all components required by the target page, developers do not need to learn special languages, the learning cost is low, the operation is easy, the learning cost of the developers can be greatly reduced, and the development efficiency is improved.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale. In the drawings:
fig. 1 is a flowchart of a method for generating a page file according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a hierarchical relationship in a page description file according to an embodiment of the present disclosure;
FIG. 3 is a schematic illustration of a mid-section subassembly of a component library in an embodiment of the disclosure;
FIG. 4 is a diagram illustrating a process of generating page files of different platforms in the related art;
FIG. 5 is a schematic diagram of a process for generating a pagefile for different platforms in an embodiment of the present disclosure;
FIG. 6 is a schematic diagram of the components required to compose a form page in an embodiment of the present disclosure;
fig. 7 is a block diagram of a pagefile generating device provided by an embodiment of the present disclosure;
fig. 8 is a block diagram of an electronic device provided by an embodiment of the disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
In the related art, if the same page is to be implemented on a plurality of different platforms, different platform languages are required to be respectively adopted to compile page items, and then the page items are compiled to generate a page file suitable for the corresponding platform. Therefore, the page file generation method provided by the embodiment of the disclosure can automatically convert the page description file into the page file realized by adopting each platform language only by compiling the page description file.
First, the disclosed embodiments provide a component library for storing individual components. The component library comprises page basic components, and the following table I shows detailed information of some page basic components in the component library:
Figure BDA0003476724350000041
Figure BDA0003476724350000051
watch 1
It is to be understood that the page base components can include, but are not limited to, the components listed in Table one.
Fig. 1 shows a flowchart of a method for generating a pagefile according to an embodiment of the present disclosure, and as shown in fig. 1, the method includes the following steps:
s110, a page description file is obtained, and the page description file is used for describing types and attribute values of a plurality of components required by the target page.
The multiple components forming the target page comprise at least one page basic component.
S120, analyzing the page description file to obtain a page component tree, wherein the page component tree comprises the hierarchical relation among the components and the type and attribute value of each component.
In the page description file, components refer to other components through parent-child attributes, the parent-child attributes of the components in the page description file are analyzed, the hierarchical relationship among the components can be obtained, and then a page component tree is generated according to the hierarchical relationship among the components and the type and attribute value of each component. For example, in a page description file, a root page component refers to a container component through a parent-child attribute, the container component refers to the page component and a text component through a parent-child attribute, after the page description file is parsed, the hierarchical relationship shown in fig. 2 can be parsed, the outermost layer is the root page component, the root page component is wrapped in the container component, and the container component is wrapped in the container component and the text component. And obtaining the page component tree according to the hierarchical relation and the type and the attribute value of each component.
Alternatively, when writing a page description file, the parent-child property may be represented by a "child" property.
And S130, generating a corresponding entry file based on the target platform language rule according to the hierarchical relation in the page component tree and the type and the attribute value of each component.
The target platform language is a programming language suitable for a target platform, and after the page component tree is obtained, the entry file is generated based on the target platform language rule according to the hierarchical relationship among the components in the page component tree and the type and attribute value of each component.
S140, according to the type of each component in the page component tree, selecting each target component which is of a corresponding type and is realized by adopting a target platform language from the component library, and copying each target component to a directory where the entry file is located to obtain a target page item.
Before step S110 is executed, the embodiment of the present disclosure further includes: the method comprises the steps of obtaining a plurality of components which are realized by adopting different platform languages and correspond to each type, storing the plurality of components which correspond to each type into a component library, and recording the type and the platform language realization corresponding to each component. The above process is referred to as registration of the component. Fig. 3 shows a schematic diagram of a subassembly in the middle of the component library, and as shown in fig. 3, in the component library, the container component includes three components, which are a component implemented in html language, a component implemented in Android language, and a component implemented in iOS language, respectively, and records a type "view" corresponding to each component and a platform language implementation corresponding thereto. Similarly, the text component, the picture component and the video component respectively comprise three components implemented by the three languages.
Because the type and platform language implementation corresponding to each component are recorded in advance, after the page component tree is obtained, each target component which is realized by the corresponding type and adopting the target platform language can be searched in the component library according to the type of each component in the page component tree, each target component is copied to the directory where the entry file is located, and the target page item is obtained according to the entry file and each target component under the directory. It should be noted that the plurality of components in the page description file should be existing components in the component library, i.e. registered components, and if an unregistered component type is described in the page description file, the corresponding target component cannot be found from the component library.
S150, compiling the target page project to obtain the page file realized by adopting the target platform language.
For ease of understanding, the above steps S110-S150 are described in detail by an exemplary embodiment.
Illustratively, a target page is described in terms of a structured page description file, the following is an example of a page description file:
Figure BDA0003476724350000071
wherein each component has a unique ID and corresponding type (type), and the different types of components have their own specific attributes, e.g. picture component has a picture address attribute and text component has a text content attribute. In the above embodiments, the type and attribute value of the root page component are described in "id1" { }, where the root page component references the container component by the child attribute (i.e., parent-child attribute); the type and attribute value of the container component are described in 'id 2' { }, wherein the attributes of the container component comprise a width attribute, a height attribute, and a child attribute, and the container component refers to the graph component and the text component through the child attribute; the type and attribute value of the picture component are described in "id3" { }, wherein the attribute of the picture component includes a picture address attribute, and the attribute value of the picture address attribute is "aaa", which means that a picture with the picture address of "aaa" is to be displayed on the target page; the type and attribute value of the text component are described in "id4" { }, wherein the attribute of the text component includes a text content attribute, and the attribute value of the text content attribute is "bbb", indicating that the text content of "bbb" is to be displayed on the target page.
It will be appreciated that the above example is merely one example of a page-describing file and does not represent a definition of a target page or of components that make up the target page, nor of component properties.
In step S110, a page-describing file is acquired.
In step S120, the page description file is parsed to obtain the hierarchical relationship between the components. As in the above example, the hierarchical relationship between components is: the outermost layer is a root page component, a container component is wrapped in the root page component, and a picture component and a text component are wrapped in the container component. And obtaining the page component tree according to the hierarchical relationship and the type and the attribute value of each component. The following is an example of a page component tree:
Figure BDA0003476724350000081
Figure BDA0003476724350000091
in the above example, the page component tree describes that the outermost layer is a root page component, a container component is wrapped in the root page component, a hierarchical relationship between a picture component and a text component is wrapped in the container component, and the type and attribute value of each component are described.
In step S130, taking the target platform language as html language as an example, a corresponding entry file is generated based on html language rules according to the hierarchical relationship in the page component tree and the type and attribute value of each component. The following is an example of a portal file generated based on html language rules according to the page component tree described above:
Figure BDA0003476724350000092
as can be seen from the above example, the entry file includes a hierarchical relationship of "the outermost layer is a root page component, a container component is wrapped in the root page component, a picture component and a text component are wrapped in the container component", and a type and an attribute value of each component.
In step S140, each target component that is realized in html language and has a corresponding type is selected from the component library according to the type of each component in the page component tree. In the component library, a root page component comprises an html language implementation, an Android language implementation and an iOS language implementation respectively, a container component, a picture component and a text component also comprise components implemented by the three languages, a target root page component which is of a type of "page" and is implemented by the html language is selected from the component library according to the type of each component in a page component tree, a target container component which is of a type of "view" and is implemented by the html language is selected from the component library, a target picture component which is of a type of "picture" and is implemented by the html language is selected from the component library, and a target text component which is of a type of "text" and is implemented by the html language is selected from the component library.
Then, the target root page component, the target container component, the target image component and the target text component are copied to the directory where the entry file generated in step S130 is located, and a corresponding target page item, that is, an html page item, is obtained according to the entry file in the directory, the target root page component, the target container component, the target image component and the target text component.
In step S150, the target page item is compiled, and a page file implemented in html language and suitable for html platform is obtained after the compilation is completed.
It can be understood that, as shown in fig. 4, in the related art, if a cross-platform application is to be developed, a same page needs to be written in different platform languages to obtain pages implemented on different platforms, which requires developers to manually write html page items based on html language rules, and then compile the html page items to obtain html page files; manually writing an Android page project based on Android language rules, and then compiling the Android page project to obtain an Android page file; manually writing an iOS page project based on the iOS language rule, and compiling the iOS page project to obtain an iOS page file.
In the embodiment of the present disclosure, as shown in fig. 5, only the page description file described in the structured language needs to be obtained, the hierarchical relationship of the components in the page description file, the type and the attribute value of each component may be automatically analyzed to obtain a page component tree, then, according to the page component tree, based on the corresponding platform language rule, the corresponding entry file is generated to obtain the corresponding page item, and after the compiling, the corresponding page file is obtained. For example, in a default case, the html page file, the Android page file, and the iOS page file may be automatically generated at the same time based on html language rules, Android language rules, and iOS language rules, or a certain target platform language may be specified to generate a page file corresponding to the target platform language. According to the foregoing example, the page description file only needs to describe the types and attribute values of the components required to form the target page, and does not need the developer to learn a special language, so that the learning cost is low, the operation is easy, the learning cost of the developer can be greatly reduced, and the development efficiency is improved.
Optionally, besides the page basic component, the component library further includes a service component, such as a form service component and/or a commodity service component, and the form service component may be used to compose a form page for a user to write information. In some application scenarios, a user has a need to fill information in a form page, and after the user opens the form page, the user can actively fill various information in the form page, and the form page is allowed to send a form filled by the user to a designated form receiver after the user clicks a submit button. After the form is sent to a designated form receiver, the information filled in on the form page by the user is emptied, or the filled information is temporarily cached under the condition of user authorization, so that the form page can be automatically filled in the form according to the cached information when the user fills the information in the same form page next time.
Illustratively, the following table two shows details of some form business components in the component library:
Figure BDA0003476724350000111
Figure BDA0003476724350000121
watch two
The form management components are packaged with form related management logic, and each field component is used for processing logic of a corresponding field, including receiving content input of the corresponding field, displaying input content of the corresponding field, monitoring state change of the corresponding field and the like. In Table two, the form management component is able to communicate messages with all components.
The form service component may include, but is not limited to, various components shown in table two above, and may further include more components, and for the possibility of more components, embodiments of the present disclosure are not necessarily listed.
It can be understood that when the target page is a form page, a form is often divided into various fields, the core logic of the form is encapsulated in the form management component, and each field component only needs to perform message communication with the form management component according to a certain rule, so that the logic of the form can be realized. In a particular embodiment, the plurality of components required to compose the target page in the page description file include a form management component and a plurality of field components, and the form management component is capable of communicating messages with each of the field components.
Each field component is used for receiving content input of a user in a corresponding field and transmitting the content of the corresponding field to the form management component through message communication when the state of the corresponding field is changed. The field component can input corresponding contents by filling or selecting the corresponding contents by a user, and the state change of the corresponding field comprises the content change of the field, the loss of the input focus or the selection focus of the field and the like.
Taking a form including a mailbox field, a Chinese last name field, a Chinese first name field, a Chinese full name field, a province field, and a city field as an example, fig. 6 shows a schematic diagram of components required to compose a corresponding form page, including a form management component and a plurality of field components. It should be noted that, the multiple components required for composing the corresponding form page also include some page basic components, and some other optional components in the form service components, such as a preview component, a submit button component, etc., which are not shown in fig. 6 for simplicity of description.
As shown in FIG. 6, the form management component has the following logic encapsulated therein:
1. checking if mandatory fields are entered
The field component receives content input of a user in a corresponding field, and transmits the content of the corresponding field to the form management component through message communication when the state of the corresponding field changes, the form management component checks whether the corresponding field is necessary to be filled after receiving a message sent by the field component and determines whether the content of the corresponding field is empty according to the message, and when the corresponding field is necessary to be filled and the content is empty, an error message is sent to the field component to indicate the field component to generate filling reminding, so that the user knows that the unfilled field is necessary to be filled.
2. Managing associations between fields
The form management component manages the association between fields, such as the association of the Chinese surname field, the Chinese first name field and the Chinese full name field, and the association of the province field and the city field. After receiving the message sent by the field component, if the corresponding field is associated with other fields, the form management component processes the associated logic corresponding to other fields according to the message, generates the field contents of other fields, and transmits the generated field contents to the field components of other fields through message communication.
In one example, the Chinese surname field component receives a Chinese surname input by a user and transmits the Chinese surname input by the user to the form management component through message communication, the Chinese surname field component receives a Chinese name input by the user and transmits the Chinese name input by the user to the form management component through message communication, the form management component processes the association logic of the Chinese full name field according to the association relation of the Chinese surname field, the Chinese surname field and the Chinese full name field, the Chinese surname and the Chinese full name form a Chinese full name, and transmits the Chinese full name to the Chinese full name field component through message communication, and the Chinese full name field component displays the Chinese full name. On the contrary, the form management component can also analyze the Chinese surname and the Chinese name according to the Chinese full name input by the user and transmitted from the Chinese full name field component, transmit the Chinese surname to the Chinese surname field component, display the Chinese surname by the Chinese surname field component, transmit the Chinese name to the Chinese name field component, and display the Chinese name by the Chinese name field component.
In yet another example, the province field component receives a province selected by a user in a drop-down box and communicates the province selected by the user to the form management component via message communication, and upon receipt of the message, the form management component screens all cities of the province from the city database and communicates all cities of the province to the city field component via message communication, such that the city field component displays all cities of the province in the drop-down box.
3. Checking the validity of the contents of a field
And after receiving the message sent by the field component, the form management component checks the content validity of the corresponding field according to the message, thereby avoiding inputting wrong and illegal data.
4. Processing form submission logic
And the submission button component receives the click operation of the user on the submission button, transmits the click operation to the form management component through message communication, and submits the form to a specified form receiver according to submission logic after receiving the message. The submission logic includes, but is not limited to, checking whether there are mandatory fields in the form whose contents are empty, whether the user has checked a checkbox that knows and agrees to the user's agreement, and the like.
In a practical application scenario, the management logic of the form may be optionally encapsulated in the form management component, for example, the form submission logic and some other optional logic, such as at least one of the above logics 1-3.
Illustratively, the following table three shows detailed information of some commodity business components in the component library:
Figure BDA0003476724350000141
watch III
The commodity management component encapsulates logic related to commodity list display and purchase, and the commodity management component in the third table can perform message communication with all the components. The commodity business components may include, but are not limited to, various components shown in table three above, and may further include more components, and for the possibility of more components, embodiments of the present disclosure are not necessarily listed.
Optionally, when the target page is a commodity page, the plurality of components required for forming the target page include a commodity management component, a commodity selection component, a purchase button component and a commodity map component, and the commodity management component can perform message communication with the commodity selection component, the purchase button component and the commodity map component.
The commodity selection component is used for receiving the selection operation of the user on commodities in the displayed commodity list and transmitting the selection operation of the user to the commodity management component through message communication.
The purchase button assembly is used for receiving click operation of a user on the purchase button and transmitting the click operation of the user to the commodity management assembly through message communication.
The commodity map component is used for receiving the message sent by the commodity management component and displaying the detail picture of the corresponding commodity according to the message.
The merchandise management component is used for: (1) processing the display logic of the commodity list; (2) receiving a message sent by the commodity selection component, determining a target commodity selected by a user according to the message, and indicating the commodity picture component to display a detailed picture of the target commodity through message communication; (3) and receiving a message sent by the purchase button component, and initiating a purchase request aiming at the target commodity which is confirmed to be purchased by the user according to the message.
Illustratively, after a corresponding page file is generated by the embodiment of the disclosure, the page file includes a commodity management component, a commodity selection component, a purchase button component and a commodity map component, when a page is rendered on a device according to the page file, the commodity management component in the page file firstly displays a corresponding commodity list, a user can browse the commodity list on the device, when the user selects a certain target commodity, the commodity selection component receives the selection operation of the user on the target commodity and transmits the selection operation to the commodity management component through message communication, after receiving the message, the commodity management component determines the target commodity selected by the user according to the message and transmits a picture display instruction for the target commodity to the commodity map component through message communication, after receiving the message, the commodity map component displays the detailed picture of the target commodity according to the message, and various operations of the user on the detailed pictures are supported, such as zooming, saving and the like, the user can browse the detailed pictures of the target commodities and click a purchase button displayed on a page by the purchase button assembly, the purchase button assembly receives the click operation of the user on the purchase button and then transmits the click operation of the user to the commodity management assembly through message communication, and after receiving the message, the commodity management assembly initiates a purchase request for confirming the purchased target commodities by the user according to the message, so that a purchase order is generated.
In the embodiment of the disclosure, based on the embodiment of the page description file, a page is divided into components, and specific functional logic, for example, a plurality of page basic components, a plurality of form business components, and a plurality of commodity business components, are encapsulated in each component. The method has the advantages that when different pages need to be written, only different page description files need to be written, all the components in the component library can be reused, all the business logic is packaged in the components, the platform is friendly, and only the components need to be mechanically spliced in the page description files, the corresponding page files can be automatically generated, so that the required functions are realized.
In summary, in the embodiment of the present disclosure, as long as the components are registered in advance, and then the page description file is written according to the component definitions, one page description file can be converted into page files of multiple platforms, and a user can increase or decrease the components and modify the attribute values of the components in the page description file to adjust the target page without knowing specific code development.
As shown in fig. 7, the apparatus 200 for generating a page file includes:
a page description module 210, configured to obtain a page description file, where the page description file is used to describe types and attribute values of multiple components required to form a target page;
a page parsing module 220, configured to parse the page description file to obtain a page component tree, where the page component tree includes a hierarchical relationship among the multiple components and a type and an attribute value of each component;
the entry generating module 230 is configured to generate a corresponding entry file based on a target platform language rule according to the hierarchical relationship in the page component tree and the type and attribute value of each component;
a component copying module 240, configured to select, according to a type of each component in the page component tree, each target component that corresponds to the type and is implemented by using a target platform language from a component library, and copy each target component to a directory where the entry file is located, so as to obtain a target page item;
and the project compiling module 250 is used for compiling the target page project to obtain a page file realized by adopting a target platform language.
Optionally, in the page description file, the component refers to other components through parent-child attributes, and the page parsing module 220 is configured to:
analyzing the parent-child attributes of the components in the page description file to obtain the hierarchical relationship among the components;
and generating a page component tree according to the hierarchical relation among the components and the type and attribute value of each component.
Optionally, the apparatus 200 further includes a component registration module, configured to:
before the page description file is obtained, a plurality of components which are realized by adopting different platform languages and correspond to each type are obtained, the plurality of components which correspond to each type are stored in a component library, and the type and the platform language realization which correspond to each component are recorded.
Optionally, when the target page is a form page, the multiple components required for forming the target page include a form management component and multiple field components, and the form management component can perform message communication with each field component;
each field component is used for receiving the content input of a user in a corresponding field and transmitting the content of the corresponding field to the form management component through message communication when the state of the corresponding field is changed;
the form management component is configured to process the submission logic of the form and at least one of the following:
when receiving a message sent by a field component, checking whether a corresponding field is necessary to be filled and determining whether the content of the corresponding field is empty according to the message, and when the corresponding field is necessary to be filled and the content is empty, sending an error report message to the field component to indicate the field component to generate a filling prompt;
managing the association relation among the fields, processing the association logic corresponding to other fields according to the message if the corresponding field is associated with other fields after receiving the message sent by the field assembly, generating the field contents of other fields, and transmitting the field contents to the field assemblies of other fields through message communication;
and when receiving the message sent by the field component, checking the content validity of the corresponding field according to the message.
Optionally, when the target page is a commodity page, a plurality of components required for forming the target page include a commodity management component, a commodity selection component, a purchase button component and a commodity map component, and the commodity management component can perform message communication with the commodity selection component, the purchase button component and the commodity map component;
the commodity selection component is used for receiving the selection operation of the user on commodities in the displayed commodity list and transmitting the selection operation of the user to the commodity management component through message communication;
the purchase button assembly is used for receiving the click operation of a user on the purchase button and transmitting the click operation of the user to the commodity management assembly through message communication;
the commodity map component is used for receiving the message sent by the commodity management component and displaying the detail picture of the corresponding commodity according to the message;
the merchandise management component is used for:
processing the display logic of the commodity list;
receiving a message sent by a commodity selection component, determining a target commodity selected by a user according to the message, and indicating a commodity picture component to display a detail picture of the target commodity through message communication;
and receiving a message sent by the purchasing button component, and initiating a purchasing request aiming at the target commodity which is confirmed to be purchased by the user according to the message.
Optionally, the plurality of components composing the target page include at least one page base component, and the page base component includes: a page root component, a sub-page component, a container component, a floating container component, a picture component, a text component, a return button component, and an exit button component.
Referring now to FIG. 8, a block diagram of an electronic device 300 suitable for use in implementing embodiments of the present disclosure is shown. The electronic device in the embodiments of the present disclosure may include, but is not limited to, a terminal such as a notebook computer, a PAD (tablet), a desktop computer, and the like. The electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 8, the electronic device 300 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 301 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)302 or a program loaded from a storage means 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data necessary for the operation of the electronic apparatus 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
Generally, the following devices may be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 307 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 308 including, for example, magnetic tape, hard disk, etc.; and a communication device 309. The communication means 309 may allow the electronic device 300 to communicate wirelessly or by wire with other devices to exchange data. While fig. 8 illustrates an electronic device 300 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 309, or installed from the storage means 308, or installed from the ROM 302. The computer program, when executed by the processing device 301, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring a page description file, wherein the page description file is used for describing types and attribute values of a plurality of components required by a target page; analyzing the page description file to obtain a page component tree, wherein the page component tree comprises the hierarchical relation among the components and the type and attribute value of each component; generating a corresponding entry file based on a target platform language rule according to the hierarchical relation in the page component tree and the type and attribute value of each component; selecting each target component which corresponds to the type and is realized by adopting a target platform language from a component library according to the type of each component in the page component tree, and copying each target component to a directory where the entry file is located to obtain a target page item; and compiling the target page project to obtain a page file realized by adopting a target platform language.
In the embodiment of the present disclosure, the page description file may be written by using a language in a structured format, such as JSON (JavaScript Object Notation), the foregoing of the embodiment of the present disclosure provides an example of the page description file by taking JSON as an example, and certainly in actual application, the page description file may be written by using other formats or other languages.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present disclosure may be implemented by software or hardware. The name of a module does not in some cases constitute a limitation to the module itself, and for example, a page description module may also be described as a "module for acquiring a page description file".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
Example 1 provides a pagefile generation method according to one or more embodiments of the present disclosure, comprising:
acquiring a page description file, wherein the page description file is used for describing types and attribute values of a plurality of components required by a target page;
analyzing the page description file to obtain a page component tree, wherein the page component tree comprises the hierarchical relation among the components and the type and attribute value of each component;
generating a corresponding entry file based on a target platform language rule according to the hierarchical relation in the page component tree and the type and attribute value of each component;
selecting each target component which corresponds to the type and is realized by adopting a target platform language from a component library according to the type of each component in the page component tree, and copying each target component to a directory where the entry file is located to obtain a target page item;
and compiling the target page project to obtain a page file realized by adopting a target platform language.
According to one or more embodiments of the present disclosure, example 2 provides the method of example 1, where in the page description file, a component refers to other components through parent-child attributes, and the page description file is parsed to obtain a page component tree, including:
analyzing the parent-child attributes of the components in the page description file to obtain the hierarchical relationship among the components;
and obtaining the page component tree according to the hierarchical relation among the components and the type and attribute value of each component.
Example 3 provides the method of example 1, further comprising, prior to obtaining the page description file:
acquiring a plurality of components which are realized by adopting different platform languages and correspond to each type;
and storing a plurality of components corresponding to each type into a component library, and recording the type and platform language implementation corresponding to each component.
Example 4 provides the method of example 1, wherein when the target page is a form page, the plurality of components required to compose the target page include a form management component and a plurality of field components, and the form management component is capable of communicating with each field component;
each field component is used for receiving the content input of a user in a corresponding field and transmitting the content of the corresponding field to the form management component through message communication when the state of the corresponding field is changed;
the form management component is configured to process the submission logic of the form and at least one of the following:
when receiving a message sent by a field component, checking whether a corresponding field is necessary to be filled and determining whether the content of the corresponding field is empty according to the message, and when the corresponding field is necessary to be filled and the content is empty, sending an error report message to the field component to indicate the field component to generate a filling prompt;
managing the association relation among the fields, processing the association logic corresponding to other fields according to the message if the corresponding field is associated with other fields after receiving the message sent by the field assembly, generating the field contents of other fields, and transmitting the field contents to the field assemblies of other fields through message communication;
and when receiving the message sent by the field component, checking the content validity of the corresponding field according to the message.
Example 5 provides the method of example 1, wherein when the target page is a commodity page, the plurality of components required to compose the target page include a commodity management component, a commodity selection component, a purchase button component, and a commodity map component, and the commodity management component is capable of communicating with the commodity selection component, the purchase button component, and the commodity map component by messages;
the commodity selection component is used for receiving the selection operation of the user on commodities in the displayed commodity list and transmitting the selection operation of the user to the commodity management component through message communication;
the purchase button assembly is used for receiving the click operation of a user on the purchase button and transmitting the click operation of the user to the commodity management assembly through message communication;
the commodity map component is used for receiving the message sent by the commodity management component and displaying the detail picture of the corresponding commodity according to the message;
the merchandise management component is used for:
display logic to process a list of items;
receiving a message sent by a commodity selection component, determining a target commodity selected by a user according to the message, and indicating a commodity picture component to display a detail picture of the target commodity through message communication;
and receiving a message sent by the purchasing button component, and initiating a purchasing request aiming at the target commodity which is confirmed to be purchased by the user according to the message.
Example 6 provides the method of example 1, the plurality of components making up the target page including at least one page base component, the page base component including: a page root component, a sub-page component, a container component, a floating container component, a picture component, a text component, a return button component, and an exit button component.
Example 7 provides, in accordance with one or more embodiments of the present disclosure, a pagefile generation apparatus comprising:
the page description module is used for acquiring a page description file, and the page description file is used for describing types and attribute values of a plurality of components required by a target page;
the page analysis module is used for analyzing the page description file to obtain a page component tree, and the page component tree comprises the hierarchical relation among the components and the type and attribute value of each component;
the entry generation module is used for generating a corresponding entry file based on a target platform language rule according to the hierarchical relation in the page component tree and the type and the attribute value of each component;
the component copying module is used for selecting each target component which corresponds to the type and is realized by adopting a target platform language from a component library according to the type of each component in the page component tree, and copying each target component to a directory where the entry file is located to obtain a target page project;
and the project compiling module is used for compiling the target page project to obtain a page file realized by adopting a target platform language.
Example 8 provides the apparatus of example 7, wherein the page description file has components that reference other components by parent-child attributes, and the page resolution module is to:
analyzing the parent-child attributes of the components in the page description file to obtain the hierarchical relationship among the components;
and generating a page component tree according to the hierarchical relation among the components and the type and attribute value of each component.
Example 9 provides the apparatus of example 7, further comprising a component registration module to:
before the page description file is obtained, a plurality of components which are realized by adopting different platform languages and correspond to each type are obtained, the plurality of components which correspond to each type are stored in a component library, and the type and the platform language realization which correspond to each component are recorded.
Example 10 provides a computer-readable storage medium having stored thereon a computer program that, when executed by a processing device, implements the method of any of examples 1-6, in accordance with one or more embodiments of the present disclosure.
Example 11 provides, in accordance with one or more embodiments of the present disclosure, an electronic device, comprising:
a storage device having a computer program stored thereon;
processing means for executing said computer program in said storage means to implement the method of any of examples 1-6.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims. With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

Claims (10)

1. A method for generating a page file is characterized by comprising the following steps:
acquiring a page description file, wherein the page description file is used for describing types and attribute values of a plurality of components required by a target page;
analyzing the page description file to obtain a page component tree, wherein the page component tree comprises the hierarchical relation among the components and the type and attribute value of each component;
generating a corresponding entry file based on a target platform language rule according to the hierarchical relation in the page component tree and the type and attribute value of each component;
selecting each target component which corresponds to the type and is realized by adopting a target platform language from a component library according to the type of each component in the page component tree, and copying each target component to a directory where the entry file is located to obtain a target page item;
and compiling the target page project to obtain a page file realized by adopting a target platform language.
2. The method according to claim 1, wherein in the page description file, a component refers to other components through parent-child attributes, and the parsing the page description file to obtain a page component tree comprises:
analyzing the parent-child attributes of the components in the page description file to obtain the hierarchical relationship among the components;
and obtaining the page component tree according to the hierarchical relation among the components and the type and attribute value of each component.
3. The method of claim 1, wherein prior to obtaining the page-describing file, the method further comprises:
acquiring a plurality of components which are realized by adopting different platform languages and correspond to each type;
and storing a plurality of components corresponding to each type into a component library, and recording the type and platform language implementation corresponding to each component.
4. The method of claim 1, wherein when the target page is a form page, the plurality of components required to compose the target page include a form management component and a plurality of field components, the form management component being capable of communicating messages with each of the field components;
each field component is used for receiving the content input of a user in a corresponding field and transmitting the content of the corresponding field to the form management component through message communication when the state of the corresponding field is changed;
the form management component is configured to process the submission logic of the form and at least one of the following:
when receiving a message sent by a field component, checking whether a corresponding field is necessary to be filled and determining whether the content of the corresponding field is empty according to the message, and when the corresponding field is necessary to be filled and the content is empty, sending an error report message to the field component to indicate the field component to generate a filling prompt;
managing the association relation among the fields, processing the association logic corresponding to other fields according to the message if the corresponding field is associated with other fields after receiving the message sent by the field assembly, generating the field contents of other fields, and transmitting the field contents to the field assemblies of other fields through message communication;
and when receiving the message sent by the field component, checking the content validity of the corresponding field according to the message.
5. The method according to claim 1, wherein when the target page is a commodity page, the plurality of components required for composing the target page include a commodity management component, a commodity selection component, a purchase button component and a commodity map component, and the commodity management component can perform message communication with the commodity selection component, the purchase button component and the commodity map component;
the commodity selection component is used for receiving the selection operation of the user on commodities in the displayed commodity list and transmitting the selection operation of the user to the commodity management component through message communication;
the purchase button assembly is used for receiving the click operation of a user on the purchase button and transmitting the click operation of the user to the commodity management assembly through message communication;
the commodity map component is used for receiving the message sent by the commodity management component and displaying the detail picture of the corresponding commodity according to the message;
the merchandise management component is used for:
processing the display logic of the commodity list;
receiving a message sent by a commodity selection component, determining a target commodity selected by a user according to the message, and indicating a commodity picture component to display a detail picture of the target commodity through message communication;
and receiving a message sent by the purchasing button component, and initiating a purchasing request aiming at the target commodity which is confirmed to be purchased by the user according to the message.
6. The method of claim 1, wherein the plurality of components that make up the target page include at least one page base component, the page base component comprising: a page root component, a sub-page component, a container component, a floating container component, a picture component, a text component, a return button component, and an exit button component.
7. A pagefile generating device, comprising:
the page description module is used for acquiring a page description file, and the page description file is used for describing types and attribute values of a plurality of components required by a target page;
the page analysis module is used for analyzing the page description file to obtain a page component tree, and the page component tree comprises the hierarchical relationship among the components and the type and attribute value of each component;
the entry generation module is used for generating a corresponding entry file based on a target platform language rule according to the hierarchical relation in the page component tree and the type and the attribute value of each component;
the component copying module is used for selecting each target component which corresponds to the type and is realized by adopting a target platform language from a component library according to the type of each component in the page component tree, and copying each target component to a directory where the entry file is located to obtain a target page project;
and the project compiling module is used for compiling the target page project to obtain a page file realized by adopting a target platform language.
8. The apparatus of claim 7, wherein in the page description file, a component references other components by parent-child attributes, and wherein the page resolution module is configured to:
analyzing the parent-child attributes of the components in the page description file to obtain the hierarchical relationship among the components;
and generating a page component tree according to the hierarchical relation among the components and the type and attribute value of each component.
9. A computer-readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by processing means, carries out the method of any one of claims 1-6.
10. An electronic device, comprising:
a storage device having a computer program stored thereon;
processing means for executing the computer program in the storage means to implement the method of any one of claims 1-6.
CN202210056537.4A 2022-01-18 2022-01-18 Page file generation method and device, storage medium and electronic equipment Pending CN114428609A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210056537.4A CN114428609A (en) 2022-01-18 2022-01-18 Page file generation method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210056537.4A CN114428609A (en) 2022-01-18 2022-01-18 Page file generation method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN114428609A true CN114428609A (en) 2022-05-03

Family

ID=81312349

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210056537.4A Pending CN114428609A (en) 2022-01-18 2022-01-18 Page file generation method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN114428609A (en)

Similar Documents

Publication Publication Date Title
US20200380200A1 (en) Information processing apparatus and method and non-transitory computer readable medium
CN109062563B (en) Method and device for generating page
JP6941617B2 (en) Methods and equipment for reusing ListCell in hybrid applications
US11797273B2 (en) System and method for enhancing component based development models with auto-wiring
US11586772B2 (en) Method and device for displaying information
CN109359194B (en) Method and apparatus for predicting information categories
CN112684968A (en) Page display method and device, electronic equipment and computer readable medium
US20170054790A1 (en) System and Method for Object Compression and State Synchronization
CN111506300A (en) Applet generation method, device, equipment and storage medium
CN113836014A (en) Interface testing method and device, electronic equipment and storage medium
CN113094776A (en) Method and system for constructing visual component model data and electronic equipment
CN110489326B (en) IDS-based HTTPAPI debugging method device, medium and equipment
CN112035092A (en) Form processing method, device, equipment and readable medium
CN111145143A (en) Problem image determination method and device, electronic equipment and storage medium
CN110717134A (en) Product description issuing method and device, storage medium and electronic equipment
CN114428609A (en) Page file generation method and device, storage medium and electronic equipment
CN115408009A (en) Code file generation method, device, equipment and storage medium
CN111209028B (en) Data processing method and device, electronic equipment and storage medium
CN114115982A (en) Code issuing method, device, equipment and storage medium
CN110221827B (en) Data processing method and related device
CN113064987A (en) Data processing method, apparatus, electronic device, medium, and program product
CN113779952B (en) Text processing method and device and electronic equipment
CN111209739A (en) Electronic form, electronic device, storage medium, and electronic form verification method
JP2005122398A (en) Dynamic document generating program, recording medium thereof, dynamic document generating device, and dynamic document generating method
CN115543969B (en) Data migration method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination