A page generation method, device and computer readable storage medium

By filtering and adjusting the source code based on the platform information in the terminal, and constructing the target component, the problem of page reuse between different platforms is solved, cross-platform component development is realized, and the application scope of the source code is expanded.

CN113360146BActive Publication Date: 2026-06-16TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2020-03-03
Publication Date
2026-06-16

AI Technical Summary

Technical Problem

When reusing source code across different application platforms, existing technologies require reusing the entire application's page components, which limits the scope of reuse and makes it impossible to generate pages with the same functionality and appearance on different platforms.

Method used

By acquiring the source code call request sent by the terminal, filtering the target source code according to the code running platform information, and then adjusting it on the terminal to build the target component and generate the target page, a component-level source code reuse method is adopted.

🎯Benefits of technology

It enables cross-platform component development across different platforms, expands the application scope of source code generation pages, and improves the efficiency and flexibility of code reuse.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113360146B_ABST
    Figure CN113360146B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a page generation method and device and a computer readable storage medium; after a source code calling request sent by a terminal is acquired, the source code calling request carries identity of source code and code running platform information, target source code corresponding to the identity is filtered according to the code running platform information, the target source code is sent to the terminal, adjusted source code after the terminal adjusts the target source code is acquired, a target component corresponding to the adjusted source code is constructed, and a target page is generated based on the target component; the scheme can greatly increase the application range of generating a page by reusing source code.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and more specifically to a page generation method, apparatus, and computer-readable storage medium. Background Technology

[0002] In recent years, with the rapid development of internet technology, the application scope of applications has become increasingly wide. For example, they are used on mobile application platforms such as iOS (a mobile application operating system) and Android, as well as web (web page) front-end platforms. Pages in an application typically consist of one or more components. A component can be seen as a simple encapsulation of data and methods; for example, a list on a page can be considered a component. Therefore, many components with the same functionality and appearance appear on pages of mobile and web front-end platforms. When developing these components for different platforms, due to differences in the details of the source code, they cannot be directly reused. Often, it is necessary to develop relatively independent source code for each platform. To reduce repetitive work, current technology mainly involves obtaining the entire source code of the application, reusing all the source code, and modifying it to obtain an application that runs on different application platforms.

[0003] Existing technologies for reusing the source code of an entire application across different application platforms require reusing all components of the application's pages. As a result, only pages that are similar to or identical to the original application can be rebuilt, which greatly reduces the scope of applications that can be generated by reusing source code. Summary of the Invention

[0004] This invention provides a page generation method, apparatus, and computer-readable storage medium. This can greatly increase the application scope of reusing source code to generate pages.

[0005] A page generation method, comprising:

[0006] Obtain a source code call request sent by the terminal, wherein the source code call request carries the identity identifier of the source code and the code execution platform information of the source code;

[0007] Based on the code execution platform information, the target source code corresponding to the identity identifier is selected;

[0008] The target source code is sent to the terminal, and the modified source code after the terminal has adjusted the target source code is obtained;

[0009] Construct the target component corresponding to the adjusted source code;

[0010] Based on the target component, the target page is generated.

[0011] Accordingly, embodiments of the present invention provide a page generation apparatus, comprising:

[0012] The acquisition unit is used to receive a source code call request sent by the terminal, wherein the source code call request carries the identity identifier of the source code and the code execution platform information of the source code;

[0013] The filtering unit is used to filter out the target source code corresponding to the identity identifier based on the code execution platform information.

[0014] A sending unit is configured to send the target source code to the terminal and obtain the modified source code after the terminal has adjusted the target source code;

[0015] Construction unit, used to construct the target component corresponding to the adjusted source code;

[0016] The generation unit generates the target page based on the target component.

[0017] Optionally, in some embodiments, the filtering unit may be specifically used to determine the code execution platform of the source code based on the code execution platform information, wherein the code execution platform includes a first code execution platform and a second code execution platform; when the source code is applied to the first code execution platform, the first source code corresponding to the identity identifier is filtered out from the source code database, and the first source code is used as the target source code, and the first source code is applied to the first code execution platform; when the source code is applied to the second code execution platform, the second source code corresponding to the identity identifier is filtered out from the source code database, and the second source code is used as the target source code, and the second source code is applied to the second code execution platform, wherein the second source code is converted from the first source code.

[0018] Optionally, in some embodiments, the filtering unit may be specifically used to obtain the source code of the basic component corresponding to the identity identifier, and use the source code of the basic component as the first source code;

[0019] The first source code is parsed to construct a syntax tree corresponding to the first source code, the syntax tree including at least one node; the nodes of the syntax tree are adjusted according to the standard information of the second code execution platform; and the second source code of the basic component is generated based on the adjusted syntax tree.

[0020] Optionally, in some embodiments, the filtering unit may specifically be used to check the nodes of the syntax tree to obtain node information of the syntax tree; filter out node standard information from the standard information of the second code execution platform; compare the node standard information with the node information; and adjust the nodes of the syntax tree according to the comparison result.

[0021] Optionally, in some embodiments, the filtering unit may be specifically used to determine the target nodes that need to be adjusted in the syntax tree based on the comparison results; classify the target nodes; and adjust the different types of target nodes according to preset rules based on the classification results to obtain the adjusted syntax tree.

[0022] Optionally, in some embodiments, the construction unit may be specifically used to query the first reference component library of the first code execution platform in the first adjusted source code when the adjusted source code is a first adjusted source code obtained by adjusting the first source code; to filter out the first rendering component in the first reference component library; to render the first component corresponding to the first adjusted source code based on the first rendering component, and to use the first component as the target component.

[0023] Optionally, in some embodiments, the construction unit may be specifically used to query the second reference component library of the second code execution platform in the second adjusted source code when the adjusted source code is a second adjusted source code obtained by adjusting the second source code; to filter out the second rendering component in the second reference component library; to render the second component corresponding to the second adjusted source code based on the second rendering component, and to use the second component as the target component.

[0024] Optionally, in some embodiments, the generation unit may be specifically used to receive initial page information sent by the terminal; construct an initial page based on the initial page information; and draw the target component on the initial page to obtain the target page.

[0025] Furthermore, embodiments of the present invention also provide an electronic device, including a processor and a memory, wherein the memory stores an application program, and the processor is used to run the application program in the memory to implement the page generation method provided in embodiments of the present invention.

[0026] Furthermore, embodiments of the present invention also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute steps in any of the page generation methods provided in embodiments of the present invention.

[0027] In this embodiment of the invention, after receiving a source code call request from a terminal, the source code call request carries the source code's identity identifier and code execution platform information. Based on the code execution platform information, the target source code corresponding to the identity identifier is selected, and the target source code is sent to the terminal. The terminal then receives the modified source code after adjusting the target source code, constructs the target component corresponding to the modified source code, and generates the target page based on the target component. Since this solution adopts component-level source code reuse, cross-platform components can be developed, and pages can be generated using components on different platforms, which can greatly increase the application scope of reusing source code to generate pages. Attached Figure Description

[0028] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0029] Figure 1 This is a schematic diagram of a scenario for the page generation method provided in an embodiment of the present invention;

[0030] Figure 2 This is a flowchart illustrating the page generation method provided in an embodiment of the present invention;

[0031] Figure 3 This is a schematic diagram of the structure of the initial page provided in an embodiment of the present invention;

[0032] Figure 4 This is a schematic diagram of the initial update process provided in an embodiment of the present invention;

[0033] Figure 5 This is a schematic diagram of the process of converting the first source code into the second source code according to an embodiment of the present invention;

[0034] Figure 6 This is another flowchart illustrating the page generation method provided in this embodiment of the invention;

[0035] Figure 7 This is a schematic diagram of the structure of the page generation device provided in an embodiment of the present invention;

[0036] Figure 8 This is a schematic diagram of the structure of the filtering unit of the page generation device provided in an embodiment of the present invention;

[0037] Figure 9 This is a schematic diagram of the structure of the generation unit of the page generation device provided in an embodiment of the present invention;

[0038] Figure 10This is another structural schematic diagram of the page generation device provided in an embodiment of the present invention;

[0039] Figure 11 This is a schematic diagram of the structure of the conversion unit of the page generation device provided in an embodiment of the present invention;

[0040] Figure 12 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation

[0041] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0042] This invention provides a page generation method, apparatus, and computer-readable storage medium. The page generation apparatus can be integrated into an electronic device, such as a server.

[0043] For example, see Figure 1 Taking the integration of a page generation device into an electronic device as an example, the system obtains a source code call request sent by the terminal. This source code call request carries the identity identifier of the source code and the code execution platform information. Based on the code execution platform information, the system filters out the target source code corresponding to the identity identifier from the source code database, sends the target source code to the terminal, and obtains the modified source code after the terminal has adjusted the target source code. Then, the system constructs the target component corresponding to the modified source code and generates the target page based on the target component.

[0044] In this context, a component is a simple encapsulation of data and methods. For example, a list on a page can be considered a relatively simple component. Components can have their own properties and methods. Properties are simple accessors to the component's data, while methods are some simple and visible functionalities of the component.

[0045] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.

[0046] This embodiment will be described from the perspective of a page generation device, which can be integrated into an electronic device, such as a server.

[0047] A page generation method, comprising:

[0048] After receiving the source code call request sent by the terminal, the source code call request carries the source code's identity identifier and code execution platform information. Based on the code execution platform information, the target source code corresponding to the identity identifier is selected, the target source code is sent to the terminal, and the modified source code after the terminal has adjusted the target source code is obtained. The target component corresponding to the modified source code is constructed, and the target page is generated based on the target component.

[0049] like Figure 2 As shown, the specific process of this page generation method is as follows:

[0050] 101. Obtain the source code call request sent by the terminal.

[0051] The source code call request carries the source code's identity and runtime platform information. The runtime platform information can indicate the platform on which the source code is running. For example, it could indicate that the source code is running on a first runtime platform, such as Android or iOS, a mobile application platform built using a mobile application development framework (React Native, RN). Alternatively, it could indicate that the source code is running on a second runtime platform, such as a web front-end platform built using a web front-end development framework (React).

[0052] For example, there are several ways to obtain source code call requests sent by a terminal. For instance, the terminal can directly send the source code call request to the page generation device, which can then directly obtain the request. Alternatively, a third-party tool can be used to obtain the source code call request. For example, the terminal can send the source code call request directly to the page generation device, but store the identity and code execution platform information carried in the request in a third-party database, including the storage address in the request. Upon receiving the source code call request, the page generation device retrieves the identity and code execution platform information from the third-party database based on the storage address carried in the request. After obtaining the identity and code execution platform information, it can also send feedback information to the terminal to indicate that the page generation device has successfully received the source code call request, identity, and code execution platform information.

[0053] 102. Based on the code execution platform information, filter out the target source code corresponding to the identity identifier.

[0054] For example, based on the code execution platform information, the code execution platform of the source code is determined. Based on the determined code execution platform, the target source code corresponding to the identity identifier is filtered out from the source code database. Specifically, it can be done as follows:

[0055] S1. Determine the code execution platform for the source code based on the code execution platform information.

[0056] The source code can run on two code platforms: a first code platform and a second code platform. Therefore, the source code with the same identity may run on different code platforms. For example, the first code platform may be a mobile application platform built on the RN application framework, while the second code platform may be a web front-end application platform built on the React application framework.

[0057] For example, based on the code execution platform information, the code execution platform of the source code can be determined. For instance, the specific information of the code execution platform can be obtained from the code execution platform information. For example, if the code execution platform information indicates that the source code is applied to the first code execution platform, then the code execution platform of the source code can be determined to be the first code execution platform. If the code execution platform information indicates that the source code is applied to the second code execution platform, then the code execution platform of the source code can be determined to be the second code execution platform.

[0058] S2. When the source code is applied to the first code execution platform, the first source code corresponding to the identity identifier is selected from the source code database and used as the target source code.

[0059] The first source code is applied to the first code execution platform.

[0060] For example, when source code is used on the first code execution platform, the source code database is used to filter out the first source code corresponding to an identity identifier. For instance, the identity identifier of the source code can be the type or function of the underlying component, such as a list component or a text box component for displaying text. The source code database is then used to filter out the target source code corresponding to this identity identifier. For example, if the identity identifier is a list component and it is used on the first code execution platform, based on the two query conditions mentioned above, the source code database is searched for the first source code of the list component used on the first code execution platform, and this first source code is used as the target source code.

[0061] S3. When the source code is used on the second code execution platform, the second source code corresponding to the identity identifier is selected from the source code database and used as the target source code.

[0062] The second source code is used on the second code execution platform.

[0063] For example, when source code is used on a second code execution platform, the source code database is used to filter out the second source code corresponding to an identity identifier. For instance, the identity identifier could be the type or function of the underlying component corresponding to the source code, such as a list component or a text box component for displaying text. The source code database is then used to filter out the target source code corresponding to this identity identifier. For example, if the identity identifier is a list component and it is used on a second code execution platform, based on the two query conditions mentioned above, the source code database is searched for the second source code of the list component used on the second code execution platform, and this second source code is selected as the target source code.

[0064] The second source code under the same identity is derived from the first source code. The conversion process is as follows:

[0065] C1. Obtain the source code of the basic component corresponding to the identity identifier, and use the source code of the basic component as the first source code.

[0066] For example, to obtain the source code of the basic component corresponding to the identity identifier, such as a list-type component, one could obtain the source code of the basic list-type component online, receive the source code of a list-type component uploaded or sent by a user, or even obtain the source code of the entire application. From the source code of the entire application, the source code of the list-type component could be filtered out and used as the source code of the basic list-type component. Then, the source code of the basic component would be used as the first source code.

[0067] The source code of the basic components consists of two parts: code for logical behavior and code for visual presentation.

[0068] C2. Parse the first source code to construct the syntax tree corresponding to the first source code.

[0069] A syntax tree, also known as an abstract syntax tree (AST), is an abstract representation of the syntactic structure of source code. It represents the syntactic structure of a programming language in a tree-like structure, where each node represents a structure in the source code. The syntax is described as "abstract" because it doesn't represent every detail of the actual syntax. For example, nested parentheses are implicit in the tree structure and not presented as nodes. A syntax tree can include one or more nodes.

[0070] For example, parsing the first source code to construct its corresponding syntax tree involves several steps. First, lexical analysis of the source code is performed, primarily by reading the source code. Then, according to predetermined rules, the source code is merged into individual identifiers or tokens. During the reading and merging process, whitespace, comments, and other elements are removed. Finally, the entire source code is divided into a list of tokens or a one-dimensional array. The array derived from the lexical analysis is then converted into a tree structure. Simultaneously, the syntax is validated; if errors are found, they are thrown and corrected. When generating the syntax tree, some unnecessary identifiers or tokens, such as complete parentheses, are removed. Therefore, the abstract syntax tree is not 100% identical to the source code. Alternatively, a third-party plugin like Babel (a code compiler) can be used to parse the first source code and obtain its corresponding syntax tree.

[0071] C3. Adjust the nodes of the syntax tree according to the standard information of the second code execution platform.

[0072] Among them, the standard information of the second code execution platform can be some standards required for the code to run in the second code execution platform. For example, the source code must be run in the second code execution platform, the component reference entry must be the component library of the second code execution platform, and some attribute information in the source code must match some attribute information in the second code execution platform, etc.

[0073] For example, based on the node standard information in the standard information of the second code execution platform, the nodes of the syntax tree are adjusted. The specific adjustment process is as follows:

[0074] (1) Examine the nodes of the syntax tree to obtain node information of the syntax tree.

[0075] For example, the nodes of the syntax tree can be inspected, such as by traversing the nodes of the syntax tree to obtain information about all nodes. This information is then used as the node information of the syntax tree. This node information includes node attribute information, position information, and quantity information, etc.

[0076] (2) Filter out the node standard information from the standard information of the second code running platform.

[0077] Among them, the node standard information can be the running rules or standards that the nodes in the syntax tree corresponding to the source code running on the second code execution platform need to follow.

[0078] For example, the standard information of nodes can be filtered from the standard information of the second code execution platform. For instance, the standard information can be used to query the node standard information that nodes in the syntax tree corresponding to the source code running on the second code execution platform must follow. For example, the attribute information of node A must be the same as the attribute information of attribute B in the second code execution platform, or the second code execution platform must contain node C, but may not contain node D, and so on.

[0079] (3) Compare the node standard information with the node information.

[0080] For example, the node standard information of the second code execution platform is compared with the node information in the syntax tree corresponding to the first source code. For instance, the nodes existing in the node standard information are compared with the nodes existing in the node information. When a certain node exists in both the node standard information and the node information, the attribute information, position information, and quantity information of this node in the node standard information and the node information are further compared.

[0081] (4) Adjust the nodes of the syntax tree based on the comparison results.

[0082] For example, based on the comparison results, the target node that needs adjustment in the syntax tree can be determined. For instance, if node A is required in the standard node information but not in the syntax tree's node information, then node A can be identified as the target node. Similarly, if node B is not required in the standard node information but exists in the syntax tree's node information, then node B can also be identified as a target node. Furthermore, if both the standard node information and the node information contain node C, but the standard node information shows node C's referenced component entry address as address A, while the syntax tree's node information shows node C's actual referenced component entry address as address B, then since addresses A and B are different, node C can also be identified as a target node. Target nodes can be categorized; for example, target nodes like node A can be categorized as nodes that need to be added, target nodes like node B can be categorized as nodes that need to be deleted, and target nodes like node C can be categorized as nodes whose node information needs adjustment. Based on the classification results, different types of target nodes are adjusted according to preset rules. For example, nodes that need to be added are added to the syntax tree, and nodes that need to be deleted are removed from the syntax tree. For nodes whose information needs to be adjusted, adjustments are made according to preset rules. For instance, if the address of a component reference entry needs to be adjusted, it needs to be changed to the address of the component library on the second code execution platform. For example, if the first code execution platform is a mobile application platform built on React, and the second code execution platform is a web front-end platform built on React, the reference entry for the RN component in the first execution platform is changed to the entry point of the H5 version library of the RN component. Another example is target nodes whose attribute information needs to be modified, which are adjusted according to the attribute information of the second code execution platform. For instance, the attribute fields of the target node are modified to meet the runtime requirements of the second code execution platform. After the adjustments are completed, the adjusted syntax tree is obtained.

[0083] C4. Based on the adjusted syntax tree, generate the second source code for the basic components.

[0084] For example, based on the adjusted syntax tree, the inverse operation of constructing the syntax tree is performed to generate the second source code for the basic components. This involves restoring the structure of the source code corresponding to the nodes in the adjusted syntax tree. During this restoration process, the syntax standards of the first source code are preserved, and unnecessary identifiers that were deleted are restored. Finally, the second source code for the basic components running on the second code execution platform is obtained. Taking a mobile application platform built on React Native as the first code execution platform and a web front-end platform built on React as the second code execution platform, the differences between the first and second source codes can be seen as follows:

[0085] The original first part of the source code:

[0086] import React form ‘react’

[0087] import{ View, Text , StyleSheet}form ‘react-native’

[0088] XXXXXXX

[0089] XXXXXXX

[0090] <view data-class=""compa-view”style={style.view}">

[0091] XXX

[0092] The corresponding second source code after conversion:

[0093] import React form 'react'

[0094] import{ View, Text, StyleSheet}form 'xxx-xp-components-sdk'

[0095] The xxx-xp-components-sdk package contains implementations of components or APIs (functions) such as View, Text, and StyleSheet for web front-end platforms.

[0096] XXXXXXX

[0097] XXXXXXX

[0098] <view classname=""compa-view”style={style.view}">

[0099] XXX

[0100] 103. Send the target source code to the terminal and obtain the modified source code after the terminal has made adjustments to the target source code.

[0101] For example, since the source code is being called, it has the capability for secondary development. Based on the received source code call request, the filtered target source code is sent to the terminal, and the terminal obtains the adjusted source code after modifying the target source code. For instance, the target source code is sent to the terminal, and after receiving it, the terminal makes appropriate adjustments according to development needs. For example, if the basic component corresponding to the target source code is a list-type basic component with two columns, but the terminal needs to develop a list-type component with five columns, then the terminal only needs to modify the parameters corresponding to the number of columns in the list based on the target source code. After modifying the parameters in the target source code, the adjusted source code is obtained. The terminal then sends the adjusted source code to the page generation device, which obtains the adjusted source code sent by the terminal.

[0102] 104. Build the target component corresponding to the adjusted source code.

[0103] For example, rendering the adjusted source code will yield the target component corresponding to the adjusted source code. Since different code execution platforms result in different rendering methods, the rendering needs to be performed according to the actual code execution platform on which the adjusted source code is used. Specifically, it can be done as follows:

[0104] (1) When the adjusted source code is the first adjusted source code obtained by adjusting the first source code, construct the target component corresponding to the first adjusted source code.

[0105] For example, when the target source code is the first source code, the modified source code obtained by the terminal based on the first source code can be the first modified source code, and the target component corresponding to the first modified source code can be constructed. For example, the first reference component library of the encapsulated first code execution platform can be queried in the first modified source code, and the first rendering component can be selected from the first reference component library. For example, when the target component is a list component, rendering components such as FlatList or ScrollView (a type of rendering component) can be selected from the first reference component library. Based on the selected rendering component, the first component corresponding to the first modified source code can be directly rendered, and the first component can be used as the target component.

[0106] (2) When the adjusted source code is the second adjusted source code obtained by adjusting the second source code, construct the target component corresponding to the second adjusted source code.

[0107] For example, when the target source code is the second source code, the modified source code obtained by the terminal by adjusting the second source code can be the second modified source code, and the target component corresponding to the second modified source code can be constructed. For example, the second reference component library of the encapsulated second code execution platform can be queried in the second modified source code, and the second rendering component can be selected from the second reference component library. For example, when the target component is a list component, rendering components such as FlatList or ScrollView can be selected from the second reference component library. Based on the selected rendering component, the second component corresponding to the second modified source code can be directly rendered, and the second component can be used as the target component.

[0108] 105. Generate the target page based on the target component.

[0109] For example, since the target page contains at least one component, when the target page contains multiple components—for instance, a list component, an animation component, and an input component, with the target component being the list component—the client develops the target page, creating the animation and input components. For the list component, the source code of the basic list component can be directly called, and the source code of the basic list component can be adjusted based on the specific parameters of the list component in the target page to obtain the list component required by the target page. This list component is then directly added to the initial page that already contains the animation and input components, thus directly obtaining the target page. The specific process of generating the target page is as follows:

[0110] (1) Receive the initial page information sent by the terminal.

[0111] For example, when the target page has multiple components, the receiving terminal sends initial page information. This initial page information includes all components except the target component, as well as page template information, such as the position of each component, the layout size of each component, and / or the settings information of each component. When the target page has only one target component, the receiving terminal sends initial page information, which includes page template information, such as the position of the target component, the layout size of the target component, and / or the settings information of the target component.

[0112] (2) Construct the initial page based on the initial page information.

[0113] For example, based on the initial page information, an initial page is constructed. For instance, if the target page contains multiple components, the initial page is generated according to the page template information, and all components except the target component are added to the initial page. For example, if the initial page contains component A and component B, and a drawing area is reserved for the target component, the initial page can be constructed as follows: Figure 3 As shown. When adding other components to the initial page, each component needs to be added to its corresponding position according to the page template information and layout size, and configured according to the settings. For example, taking an input component, the font size and format can be set. Alternatively, when the target component only includes the target component, a blank page of the corresponding size and layout is generated according to the page template information. This blank page is used as the initial page, reserving a blank area for the target component's layout size within it. The blank area for drawing the target component can also be pre-configured. For example, with a list component, parameters such as the brightness of the data displayed in the list, the font format, or the font size can be set.

[0114] (3) Draw the target component on the initial page to obtain the target page.

[0115] For example, the target component is drawn on the initial page to obtain the target page. For instance, the component's exported interface `render` (a component refresh mechanism) can be found in the component reference library of the target component. The `render` component is called to draw the target component in the reserved position on the initial page, and the entire initial page is refreshed to obtain the updated initial page. This updated initial page is then used as the target page. The entire update process is as follows: Figure 4 As shown. After generating the target page, it can be sent to the terminal for display, or it can be displayed in an application on the terminal.

[0116] As can be seen from the above, in this embodiment of the application, after receiving the source code call request sent by the terminal, the source code call request carries the identity identifier of the source code and the code execution platform information. Based on the code execution platform information, the target source code corresponding to the identity identifier is selected, the target source code is sent to the terminal, and the terminal receives the modified source code after adjusting the target source code. The target component corresponding to the modified source code is constructed, and the target page is generated based on the target component. Since this solution adopts component-level source code reuse, cross-platform components can be developed, and the components can be used to generate pages on different platforms, which can greatly increase the application scope of reusing source code to generate pages.

[0117] Based on the method described in the above embodiments, the following examples will provide further detailed explanations.

[0118] In this embodiment, the page generation device is specifically integrated into an electronic device, which is a server. The first code execution platform is a mobile application platform built on React Native (hereinafter referred to as the RN platform), and the second code is a web front-end platform built on React Native (hereinafter referred to as the web front-end platform). The target component is a list component.

[0119] (i) Store the source code of the list class basic component corresponding to the list component in the source code database, which are applied to different types of source code on the RN platform and the web front-end platform.

[0120] For example, the source code database stores different types of source code for the list component's underlying list class application on the React Native (RN) platform and the web front-end platform. The first source code applied to the RN platform is then converted into the second source code applied to the web front-end platform. This conversion can be performed using a third-party tool, such as Babel. The entire conversion process is as follows: Figure 5 As shown, the details are as follows:

[0121] A1. The server obtains the source code of the basic component corresponding to the identity identifier and uses the source code of the basic component as the first source code.

[0122] For example, since the target component is a list component, the identifier can be the source code corresponding to the list class base component. To obtain the source code corresponding to the list class base component, the server can obtain the source code of the list class base component from the network, receive the source code of the list class base component uploaded or sent by the user through the terminal, or obtain the source code of a complete application containing list components. The server can then filter out the source code of the list class component from the source code of the complete application, use the filtered source code as the source code of the list class base component, and then identify the source code of the base component as the first source code applied to the RN platform and store it in the source code database.

[0123] A2. The server parses the first source code to construct the syntax tree corresponding to the first source code.

[0124] For example, the server reads the first source code stored in the source code database. During the reading process, it removes whitespace, comments, etc., and merges the remaining first source code into individual identifiers or tokens according to predetermined rules. Finally, the entire source code is divided into a list of tokens or a one-dimensional array, and then the list of tokens or the one-dimensional array is converted into a tree structure. Simultaneously, the syntax is validated; if a syntax error is found, it is thrown and corrected. After successful syntax validation, unnecessary tokens, such as complete parentheses, are deleted. Finally, a syntax tree corresponding to the first source code is generated.

[0125] A3. The server adjusts the nodes of the syntax tree according to the standard information of the web front-end platform.

[0126] For example, the server adjusts the nodes of the syntax tree based on standard information from the web front-end platform. The specific adjustment process is as follows:

[0127] (1) The server checks the nodes of the syntax tree to obtain node information of the syntax tree.

[0128] For example, the server traverses the nodes of the syntax tree, obtains information about all nodes, and uses this information as the node information of the syntax tree. This node information includes node attribute information, position information, and quantity information, etc.

[0129] (2) The server filters out the node standard information from the standard information in the web front end.

[0130] For example, the server queries the standard information to determine the standard node information that nodes in the syntax tree corresponding to the source code running on the web front-end platform must follow. For instance, the attribute information of node A must be the same as the attribute information of node B in the second code execution platform, or the second code execution platform must contain node C, but may not contain node D, etc.

[0131] (3) The server compares the node standard information with the node information.

[0132] For example, the server compares the nodes that exist in the node standard information with the nodes that exist in the node information. If a certain node exists in both the node standard information and the node information, it continues to compare the attribute information, location information, and quantity information of this node in the node standard information and the node information, or directly compares the nodes that exist in the node standard information with the nodes that exist in the node information.

[0133] (4) The server adjusts the nodes of the syntax tree based on the comparison results.

[0134] For example, if the node standard information indicates that node A is required in a component running on the web front-end platform, but node A is not present in the node information of the syntax tree corresponding to the first source code, then node A can be identified as the target node. Another scenario exists where the node standard information indicates that node B is not required in a component running on the web front-end platform, but node B exists in the node information of the syntax tree corresponding to the first source code; in this case, node B can also be identified as the target node. Yet another scenario exists where the node standard information indicates that node C is required in a component running on the web front-end platform, and node C also exists in the syntax tree corresponding to the first source code. However, the entry address of the referenced component for node C in the node standard information is address A, but the actual entry address of the referenced component for node C in the syntax tree is address B. Since addresses A and B are different, node C can also be identified as the target node. Then, these target nodes, such as nodes A, B, and C, are categorized. For example, node A can be categorized as a node that needs to be added, node B as a node that needs to be deleted, and node C as a node whose node information needs to be adjusted. For nodes that need to be added, add this type of node to the syntax tree; for nodes that need to be deleted, remove this type of node from the syntax tree; for nodes whose information needs to be adjusted, adjust them according to preset rules. For example, change the entry point for referencing RN components in the RN platform to the H5 version library of the RN component, and the H5 version library of the RN component to the component library used on the web front-end platform. Another example is modifying the attribute fields of the target node to meet the requirements of the web front-end platform. After the adjustments are complete, the adjusted syntax tree is obtained.

[0135] A4. The server generates the second source code for the basic components based on the adjusted syntax tree.

[0136] For example, the structure of the source code corresponding to the nodes in the adjusted syntax tree is restored. During this restoration process, the syntax standards of the first source code are preserved, and unnecessary identifiers that were deleted are restored. Finally, the second source code, which runs the basic components on the second code execution platform, is obtained. This second source code is then identified as the source code corresponding to the list-class basic component of the web frontend and stored in the source code database. The difference between the first and second source codes can be as follows:

[0137] The original first part of the source code:

[0138] import React form 'react'

[0139] import{ View, Text, StyleSheet}form 'react-native'

[0140] XXXXXXX

[0141] XXXXXXX

[0142] <view data-class=""compa-view”style={style.view}">

[0143] XXX

[0144] The corresponding second source code after conversion:

[0145] import React form 'react'

[0146] import{ View, Text, StyleSheet}form 'xxx-xp-components-sdk'

[0147] The xxx-xp-components-sdk package contains implementations of components or APIs (functions) such as View, Text, and StyleSheet for web front-end platforms.

[0148] XXXXXXX

[0149] XXXXXXX

[0150] <view classname=""compa-view”style={style.view}">

[0151] XXX

[0152] (ii) The source code stored in the source code database for use on the RN platform and the web front-end platform is used in page generation.

[0153] like Figure 6 As shown, a page generation method has the following specific process:

[0154] 201. The server obtains the source code call request sent by the terminal.

[0155] For example, a terminal can directly send a source code call request to the server, which can then directly receive the request. Alternatively, the terminal can send the source code call request directly to the server, but store the identity and code execution platform information carried in the request in a third-party database, and include the storage address in the request. Upon receiving the request, the server retrieves the identity and execution platform information from the third-party database based on the storage address. After obtaining the identity and execution platform information, the server can also send feedback to the terminal to indicate that the service has successfully received the source code call request, identity, and execution platform information.

[0156] 202. The server determines the code execution platform of the source code based on the code execution platform information.

[0157] For example, if the server obtains specific information about the code's execution platform, and the specific information indicates that the source code is used on the React Native (RN) platform, then it can be determined that the source code's execution platform is the RN platform. If the specific information indicates that the source code is used on a web front-end platform, then it can be determined that the source code's execution platform is the web front-end platform.

[0158] 203. When the source code is used on the RN platform, the server filters out the first source code corresponding to the identity in the source code database and uses the first source code as the target source code.

[0159] For example, since the target component is a list component, the source code identifier can be the source code corresponding to the basic list component. The first source code of the basic list component applied to the RN platform can be filtered out from the source code database, and the filtered first source code can be used as the target source code.

[0160] 204. When the source code is used on the web front-end platform, the server filters out the second source code corresponding to the identity identifier in the source code database and uses the second source code as the target source code.

[0161] For example, since the source code identifier can be the source code corresponding to the list class basic component, the second source code of the list class basic component applied to the web front-end platform can be filtered out from the source code database, and the filtered second source code can be used as the target source code.

[0162] 205. The server sends the target source code to the terminal and obtains the modified source code after the terminal has made adjustments to the target source code.

[0163] For example, the server sends the target source code to the terminal. After receiving the target source code, the terminal makes appropriate adjustments to the target source code according to the development needs. For instance, the basic list component has 2 columns, but the terminal needs to develop a list component with 5 columns. Therefore, the terminal only needs to modify the parameters corresponding to the number of columns in the list based on the target source code. After modifying the parameters in the target source code, the adjusted source code is obtained. The terminal sends the adjusted source code to the page generation device, and the server obtains the adjusted source code sent by the terminal.

[0164] 206. The target components corresponding to the source code after the server build and adjustment.

[0165] For example, rendering the adjusted source code will yield the target component corresponding to the adjusted source code. However, due to different code execution platforms, the rendering methods for the target component differ between React Native and web front-end platforms. Therefore, rendering needs to be performed according to the actual code execution platform on which the adjusted source code is used, as detailed below:

[0166] (1) When the adjusted source code is the first adjusted code obtained by adjusting the first source code, construct the list component corresponding to the first adjusted source code.

[0167] For example, when the target source code is the first source code, the terminal adjusts the first source code to obtain the adjusted source code, which is the first adjusted source code. The RN component library of the encapsulated RN platform is queried in the first adjusted source code, and the FlatList or ScrollView corresponding to the first adjusted source code is selected in the RN component library. The list component corresponding to the first adjusted source code is directly rendered based on the FlatList or ScrollView.

[0168] (2) When the adjusted source code is the second adjusted code obtained by adjusting the second source code, construct the list component corresponding to the second adjusted source code.

[0169] For example, when the target source code is the second source code, the terminal adjusts the second source code to obtain the adjusted source code, which is the second adjusted source code. The terminal queries the H5 version library of the RN component of the encapsulated web front-end platform in the first adjusted source code, filters out the FlatList or ScrollView corresponding to the first adjusted source code in the H5 version library of the RN component, and directly renders the list component corresponding to the second adjusted source code based on the FlatList or ScrollView.

[0170] 207. The server generates the target page based on the target component.

[0171] For example, when the target page contains multiple components, such as a list component, an animation component, and an input component, the client develops the target page to create the animation and input components. For the list component, the source code of the basic list component can be directly called, and the source code of the basic list component can be adjusted based on the specific parameters of the list component in the target page to obtain the list component required by the target page. This list component is then directly added to the initial page that already contains the animation and input components, thus obtaining the target page. The specific process of generating the target page is as follows:

[0172] (1) The server receives the initial page information sent by the terminal.

[0173] For example, when the target page has multiple components, the server receives initial page information from the terminal. This initial page information includes all components except the target component, as well as page template information, such as the position of each component, the layout size of each component, and / or the settings information of each component. When the target page has only one component, the server receives initial page information from the terminal, which includes page template information, such as the position of the target component, the layout size of the target component, and / or the settings information of the target component.

[0174] (2) The server constructs the initial page based on the initial page information.

[0175] For example, when the target page contains multiple components, the server generates an initial page according to the page template information and adds all components except the list component to the initial page. The initial page can be like this: Figure 3 As shown. When adding other components to the initial page, each component needs to be added to its corresponding position according to the page template information and layout size, and configured according to the settings. For example, taking the input component, the font size and format can be set. When the target component only includes a list component, a blank page of the corresponding size and layout is generated according to the page template information. This blank page is used as the initial page, reserving a blank area for the list component layout size. The blank area for drawing the list component can also be pre-configured, including parameters such as the brightness of the displayed data, the font format, and the font size.

[0176] (3) The server draws the target component on the initial page to obtain the target page.

[0177] For example, the server can find the `render` component, the component's exported interface, in the component reference library within the list component. It then calls the `render` component to draw the list component in the reserved position on the initial page, refreshes the entire initial page, and obtains the updated initial page. This updated initial page is then used as the target page. The entire update process is as follows: Figure 4 As shown. After the server generates the target page, it can send the target page to the terminal for display, or display the target page in the terminal's application.

[0178] As can be seen from the above, after receiving the source code call request sent by the terminal, the server in this embodiment carries the source code's identity identifier and code execution platform information. Based on the code execution platform information, the server filters out the target source code corresponding to the identity identifier, sends the target source code to the terminal, and receives the modified source code after the terminal adjusts the target source code. The server then constructs the target component corresponding to the modified source code and generates the target page based on the target component. Since this solution adopts component-level source code reuse, cross-platform components can be developed, and pages can be generated using these components on different platforms, which can greatly increase the application scope of reusing source code to generate pages.

[0179] To better implement the above methods, embodiments of the present invention also provide a page generation device, which can be integrated into electronic devices, such as servers.

[0180] For example, such as Figure 7 As shown, the page generation device may include an acquisition unit 301, a filtering unit 302, a sending unit 303, a construction unit 304, and a generation unit 305, as follows:

[0181] (1) Obtain unit 301;

[0182] The acquisition unit 301 is used to receive a source code call request sent by the terminal. The source code call request carries the identity of the source code and the code execution platform information, which is information indicating the specific code execution platform used by the source code.

[0183] For example, the acquisition unit 301 can be used to allow the terminal to directly send source code call requests to the page generation device, which can then directly acquire the source code call requests. Alternatively, third-party tools can be used to acquire the source code call requests sent by the terminal.

[0184] (2) Screening unit 302;

[0185] The filtering unit 302 is used to filter out the target source code corresponding to the identity identifier based on the code running platform information.

[0186] The filtering unit 302 may include a determining subunit 3021, a first filtering subunit 3022, and a second filtering subunit 3023, such as... Figure 8 As shown, the details are as follows:

[0187] The determination subunit 3021 is used to determine the code execution platform of the source code based on the code execution platform information. The code execution platform includes a first code execution platform and a second code execution platform.

[0188] The first filtering subunit 3022 is used to filter out the first source code corresponding to the identity identifier in the source code database when the source code is applied to the first code execution platform, and use the first source code as the target source code, which is then applied to the first code execution platform.

[0189] The second filtering subunit 3023 is used to filter out the second source code corresponding to the identity identifier in the source code database when the source code is applied to the second code execution platform, and use the second source code as the target source code. The second source code is applied to the second code execution platform and is converted from the first source code.

[0190] For example, the determining subunit 3021 determines the code execution platform of the source code based on the code execution platform information. The code execution platform includes a first code execution platform and a second code execution platform. When the source code is applied to the first code execution platform, the first filtering subunit 3022 filters out the first source code corresponding to the identity identifier in the source code database and uses the first source code as the target source code. The first source code is applied to the first code execution platform. When the source code is applied to the second code execution platform, the second filtering subunit 3023 filters out the second source code corresponding to the identity identifier in the source code database and uses the second source code as the target source code. The second source code is applied to the second code execution platform. The second source code is converted from the first source code.

[0191] (3) Transmitting unit 303;

[0192] The sending unit 303 is used to send the target source code to the terminal and obtain the modified source code after the terminal has adjusted the target source code.

[0193] For example, the sending unit 303 can be used to send the target source code to the terminal. After receiving the target source code, the terminal can make appropriate adjustments to the target source code according to the development needs and obtain the adjusted source code after the terminal has made the adjustments.

[0194] (4) Constructing unit 304;

[0195] Build unit 304 is used to build the target component corresponding to the adjusted source code.

[0196] For example, construction unit 304 can be used to: when the adjusted source code is a first adjusted source code obtained by adjusting the first source code, query the first reference component library of the first code execution platform in the first adjusted source code, filter out the first rendering component in the first reference component library, render the first component corresponding to the first adjusted source code based on the first rendering component, and use the first component as the target component; when the adjusted source code is a second adjusted source code obtained by adjusting the second source code, query the second reference component library of the second code execution platform in the second adjusted source code, filter out the second rendering component in the second reference component library, render the second component corresponding to the second adjusted source code based on the second rendering component, and use the second component as the target component.

[0197] (5) Generation unit 305;

[0198] The generation unit 305 is used to generate a target page based on the target component.

[0199] The generation unit 305 may include a receiving subunit 3051, a construction subunit 3052, and a drawing subunit 3053, such as... Figure 9 As shown, the details are as follows:

[0200] The receiving subunit 3051 is used to receive initial page information sent by the terminal;

[0201] Construct subunit 3052 to build the initial page based on the initial page information;

[0202] The drawing sub-unit 3053 is used to draw the target component on the initial page to obtain the target page.

[0203] For example, receiving subunit 3051 receives initial page information sent by the terminal, constructing subunit 3052 constructs an initial page based on the initial page information, and drawing subunit 3053 draws the target component on the initial page to obtain the target page.

[0204] Optionally, the page generation apparatus may also include a conversion unit 306, such as Figure 10 As shown, the conversion unit 306 is used to convert the first source code into the second source code.

[0205] The conversion unit 306 may further include an acquisition subunit 3061, a parsing subunit 3062, an adjustment subunit 3063, and a generation subunit 3064, such as Figure 11 As shown, the details are as follows:

[0206] Get subunit 3061, used to get the source code of the basic component corresponding to the identity identifier, and use the source code of the basic component as the first source code;

[0207] Parsing subunit 3062 is used to parse the first source code to construct a syntax tree corresponding to the first source code, the syntax tree including at least one node;

[0208] Adjustment subunit 3063 is used to adjust the nodes of the syntax tree according to the standard information of the second code execution platform;

[0209] Generating subunit 3064 is used to generate the second source code of the basic components based on the adjusted syntax tree.

[0210] In practice, each of the above units can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units, please refer to the previous method embodiments, which will not be repeated here.

[0211] As can be seen from the above, in this embodiment, after the receiving unit 301 obtains the source code call request sent by the terminal, the source code call request carries the identity identifier of the source code and the code execution platform information. The filtering unit 302 filters out the target source code corresponding to the identity identifier according to the code execution platform information. The sending unit 303 sends the target source code to the terminal and obtains the modified source code after the terminal has adjusted the target source code. The construction unit 304 constructs the target component corresponding to the modified source code. The generation unit 305 generates the target page based on the target component. Since this scheme adopts component-level source code reuse, cross-platform components can be developed, and the components can be used to generate pages on different platforms, which can greatly increase the application scope of reusing source code to generate pages.

[0212] This invention also provides an electronic device, such as... Figure 12 As shown, it illustrates a structural schematic diagram of the electronic device involved in an embodiment of the present invention, specifically:

[0213] The electronic device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will understand that... Figure 12 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:

[0214] The processor 401 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 402, and by calling data stored in the memory 402, it performs various functions and processes data, thereby providing overall monitoring of the electronic device. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 401.

[0215] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.

[0216] The electronic device also includes a power supply 403 that supplies power to the various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 403 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0217] The electronic device may also include an input unit 404, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0218] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 401 runs the applications stored in the memory 402 to realize various functions, as follows:

[0219] The system obtains the source code call request sent by the terminal. This source code call request carries the identity identifier of the source code and the code execution platform information. Based on the code execution platform information, the system filters out the target source code corresponding to the identity identifier, sends the target source code to the terminal, obtains the modified source code after the terminal modifies the target source code, constructs the target component corresponding to the modified source code, and generates the target page based on the target component.

[0220] For example, an electronic device directly or through third-party tools receives a source code call request sent by a terminal. Based on the code execution platform information, it determines the code execution platform for the source code. This platform includes a first code execution platform and a second code execution platform. When the source code is applied to the first code execution platform, the first source code corresponding to an identity identifier is selected from the source code database and used as the target source code. This first source code is then applied to the first code execution platform. When the source code is applied to the second code execution platform, the second source code corresponding to an identity identifier is selected from the source code database and used as the target source code. This second source code is then applied to the second code execution platform, and it is derived from the first source code. The target source code is then sent to the terminal. After receiving the target source code, the terminal makes appropriate adjustments to it according to development needs and obtains the adjusted source code. When the adjusted source code is a first adjusted source code obtained by adjusting the first source code, the first reference component library of the first code execution platform is queried in the first adjusted source code. The first rendering component is selected from the first reference component library. Based on the first rendering component, the first component corresponding to the first adjusted source code is rendered, and the first component is used as the target component. When the adjusted source code is a second adjusted source code obtained by adjusting the second source code, the second reference component library of the second code execution platform is queried in the second adjusted source code. The second rendering component is selected from the second reference component library. Based on the second rendering component, the second component corresponding to the second adjusted source code is rendered, and the second component is used as the target component. The initial page information sent by the receiving terminal is received. Based on the initial page information, an initial page is constructed, and the target component is drawn on the initial page to obtain the target page.

[0221] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0222] As can be seen from the above, after obtaining the source code call request sent by the terminal, the source code call request carries the identity identifier of the source code and the code execution platform information. Based on the code execution platform information, the target source code corresponding to the identity identifier is selected, the target source code is sent to the terminal, and the modified source code after the terminal modifies the target source code is obtained. The target component corresponding to the modified source code is constructed, and the target page is generated based on the target component. Since this solution adopts component-level source code reuse, cross-platform components can be developed, and the components can be used to generate pages on different platforms, which can greatly increase the application scope of reusing source code to generate pages.

[0223] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0224] Therefore, embodiments of the present invention provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the page generation methods provided in the embodiments of the present invention. For example, the instructions can execute the following steps:

[0225] The system obtains the source code call request sent by the terminal. This source code call request carries the identity identifier of the source code and the code execution platform information. Based on the code execution platform information, the system filters out the target source code corresponding to the identity identifier, sends the target source code to the terminal, obtains the modified source code after the terminal modifies the target source code, constructs the target component corresponding to the modified source code, and generates the target page based on the target component.

[0226] For example, an electronic device directly or through third-party tools receives a source code call request sent by a terminal. Based on the code execution platform information, it determines the code execution platform for the source code. This platform includes a first code execution platform and a second code execution platform. When the source code is applied to the first code execution platform, the first source code corresponding to an identity identifier is selected from the source code database and used as the target source code. This first source code is then applied to the first code execution platform. When the source code is applied to the second code execution platform, the second source code corresponding to an identity identifier is selected from the source code database and used as the target source code. This second source code is then applied to the second code execution platform, and it is derived from the first source code. The target source code is then sent to the terminal. After receiving the target source code, the terminal makes appropriate adjustments to it according to development needs and obtains the adjusted source code. When the adjusted source code is a first adjusted source code obtained by adjusting the first source code, the first reference component library of the first code execution platform is queried in the first adjusted source code. The first rendering component is selected from the first reference component library. Based on the first rendering component, the first component corresponding to the first adjusted source code is rendered, and the first component is used as the target component. When the adjusted source code is a second adjusted source code obtained by adjusting the second source code, the second reference component library of the second code execution platform is queried in the second adjusted source code. The second rendering component is selected from the second reference component library. Based on the second rendering component, the second component corresponding to the second adjusted source code is rendered, and the second component is used as the target component. The initial page information sent by the receiving terminal is received. Based on the initial page information, an initial page is constructed, and the target component is drawn on the initial page to obtain the target page.

[0227] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0228] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0229] Since the instructions stored in the computer-readable storage medium can execute the steps in any of the page generation methods provided in the embodiments of the present invention, the beneficial effects that any of the page generation methods provided in the embodiments of the present invention can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.

[0230] The foregoing has provided a detailed description of a page generation method, apparatus, and computer-readable storage medium provided by embodiments of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.< / view> < / view> < / view> < / view>

Claims

1. A page generation method, characterized in that, include: Obtain a source code call request sent by the terminal. The source code call request carries the identity of the source code and the code execution platform information, wherein the code execution platform information is information indicating the specific code execution platform on which the source code is applied. Based on the code execution platform information, the code execution platform of the source code is determined, and the code execution platform includes a first code execution platform and a second code execution platform; When the source code is applied to the first code execution platform, the first source code corresponding to the identity identifier is filtered out from the source code database, and the first source code is used as the target source code. The first source code is then applied to the first code execution platform. When the source code is applied to the second code execution platform, the second source code corresponding to the identity is filtered out in the source code database, and the second source code is used as the target source code. The second source code is applied to the second code execution platform. The second source code is converted from the first source code, and the first source code is the source code of the basic component corresponding to the identity. The target source code is sent to the terminal, and the modified source code after the terminal has made adjustments to the target source code is obtained; Constructing the target component corresponding to the adjusted source code includes: when the adjusted source code is a first adjusted source code obtained by adjusting the first source code, querying the first reference component library of the first code running platform in the first adjusted source code, filtering out the first rendering component in the first reference component library, rendering the first component corresponding to the first adjusted source code based on the first rendering component, and taking the first component as the target component; Based on the target component, the target page is generated.

2. The page generation method according to claim 1, characterized in that, include: Obtain the source code of the basic component corresponding to the identity identifier, and use the source code of the basic component as the first source code; The first source code is parsed to construct a syntax tree corresponding to the first source code, and the syntax tree includes at least one node; The nodes of the syntax tree are adjusted according to the standard information of the second code execution platform; Based on the adjusted syntax tree, a second source code for the underlying components is generated.

3. The page generation method according to claim 2, characterized in that, The step of adjusting the nodes of the syntax tree according to the standard information of the second code execution platform includes: The nodes of the syntax tree are examined to obtain the node information of the syntax tree; Filter out the node standard information from the standard information of the second code execution platform; Compare the node standard information with the node information; Based on the comparison results, the nodes of the syntax tree are adjusted.

4. The page generation method according to claim 3, characterized in that, The step of adjusting the nodes of the syntax tree based on the comparison results includes: Based on the comparison results, determine the target nodes of the syntax tree that need to be adjusted; The target nodes are classified; Based on the classification results, different types of target nodes are adjusted according to preset rules to obtain the adjusted syntax tree.

5. The page generation method according to claim 1, characterized in that, The construction of the target component corresponding to the adjusted source code also includes: When the adjusted source code is the second adjusted source code obtained by adjusting the second source code, the second reference component library of the second code execution platform is found in the second adjusted source code; Select the second rendering component from the second reference component library; Based on the second rendering component, the second component corresponding to the second adjusted source code is rendered, and the second component is used as the target component.

6. The page generation method according to claim 1, characterized in that, The step of generating the target page based on the target component includes: Receive initial page information sent by the terminal; Based on the initial page information, construct the initial page; The target component is drawn on the initial page to obtain the target page.

7. A page generation apparatus, characterized in that, include: The acquisition unit is used to receive a source code call request sent by the terminal, wherein the source code call request carries the identity identifier of the source code and the code execution platform information of the source code; A filtering unit is used to determine the code execution platform of the source code based on the code execution platform information, wherein the code execution platform includes a first code execution platform and a second code execution platform; When the source code is applied to the first code execution platform, the first source code corresponding to the identity identifier is filtered out from the source code database, and the first source code is used as the target source code. The first source code is then applied to the first code execution platform. When the source code is applied to the second code execution platform, the second source code corresponding to the identity is filtered out in the source code database, and the second source code is used as the target source code. The second source code is applied to the second code execution platform. The second source code is converted from the first source code, and the first source code is the source code of the basic component corresponding to the identity. A sending unit is configured to send the target source code to the terminal and obtain the modified source code after the terminal has adjusted the target source code; The construction unit is used to construct the target component corresponding to the adjusted source code, including: when the adjusted source code is a first adjusted source code obtained by adjusting the first source code, querying the first reference component library of the first code running platform in the first adjusted source code, filtering out the first rendering component in the first reference component library, rendering the first component corresponding to the first adjusted source code based on the first rendering component, and taking the first component as the target component; The generation unit generates the target page based on the target component.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the page generation method according to any one of claims 1 to 6.

9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing an application program, and the processor running the application program within the memory to implement the steps of the page generation method according to any one of claims 1 to 6.