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

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

Info

Publication number
CN116501317A
CN116501317A CN202310397565.7A CN202310397565A CN116501317A CN 116501317 A CN116501317 A CN 116501317A CN 202310397565 A CN202310397565 A CN 202310397565A CN 116501317 A CN116501317 A CN 116501317A
Authority
CN
China
Prior art keywords
target
code data
component
variables
page
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
CN202310397565.7A
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202310397565.7A priority Critical patent/CN116501317A/en
Publication of CN116501317A publication Critical patent/CN116501317A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Computing Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a page generation method and device, a storage medium and electronic equipment, and relates to the technical field of computers, wherein the method comprises the following steps: acquiring a page generation request of a target page, wherein the page generation request at least comprises a service function corresponding to the target page; acquiring target components and description documents of the target components from a target component library according to service functions corresponding to the target pages, wherein the target component library comprises a plurality of components and description documents corresponding to each component, the components in the target component library are obtained based on code data corresponding to historical pages, and the description documents are used for describing how the components are used; and generating a target page according to the target component and the description document of the target component. According to the method and the device for generating the front-end page, the problem that in the related art, corresponding functional components need to be manually developed in the front-end page, and therefore the efficiency of generating the front-end page is low is solved.

Description

Page generation method and device, storage medium and electronic equipment
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for generating a page, a storage medium, and an electronic device.
Background
In the prior art, low-code and code-free development platforms are explored, however, the functions and scenes often supported by the platforms are relatively single, and in the development of a complex front-end function page, the development of requirements is manually completed according to requirements by self-selected front-end frames and UI components. And if a large number of repeated codes exist in the stock codes, the current technical scheme cannot integrate the repeated codes rapidly.
In the process of developing a complex front-end page, the problem of extracting a common component is always faced, because simply stacking codes can cause the problems that the project cannot be maintained in the later period, the codes can not be shared, the readability is poor, and the like. However, if there is no standard method and standard in the process of extracting the components in the prior art, the multiplexing degree of the components is low, and the same components are repeatedly extracted.
Aiming at the problem that the efficiency of generating the front-end page is low because corresponding functional components are required to be manually developed in the front-end page in the related art, no effective solution is proposed at present.
Disclosure of Invention
The main purpose of the application is to provide a page generation method and device, a storage medium and an electronic device, so as to solve the problem that in the related art, corresponding functional components need to be manually developed in a front-end page, and therefore the efficiency of generating the front-end page is low.
In order to achieve the above object, according to one aspect of the present application, there is provided a page generation method. The method comprises the following steps: acquiring a page generation request of a target page, wherein the page generation request at least comprises a service function corresponding to the target page; acquiring a target component and a description document of the target component from a target component library according to the service function corresponding to the target page, wherein the target component library comprises a plurality of components and the description document corresponding to each component, the components in the target component library are obtained based on code data corresponding to historical pages, and the description document is used for describing how the components are used; and generating the target page according to the target component and the description document of the target component.
Further, according to the service function corresponding to the target page, obtaining the target component and the description document of the target component from the target component library includes: acquiring a plurality of first components and score values corresponding to each first component from the target component library according to the service function corresponding to the target page; and selecting the target component from the plurality of first components according to the score value corresponding to each first component, and acquiring the description document of the target component from the target component library.
Further, before acquiring the target component and the description document of the target component from the target component library according to the service function corresponding to the target page, the method further comprises: acquiring code data corresponding to a plurality of history pages; extracting code data corresponding to the target function from the code data corresponding to each history page to obtain a plurality of target code data; packaging according to the plurality of target code data to obtain a plurality of second components, and obtaining a description document corresponding to each second component according to each target code data; and constructing the target component library according to the plurality of second components and the corresponding description documents of each second component.
Further, after encapsulating according to the plurality of object code data to obtain a plurality of second components, the method further includes: according to the number of invoking hypertext transfer protocol interfaces in the object code data corresponding to each second component, scoring the independence of each second component to obtain a first score; scoring expansibility of each second component according to the number of slots in target code data corresponding to each second component, the number of variables of target attributes and the number of functions capable of being bound to obtain a second score, wherein the target attributes represent the variables capable of receiving externally input data; scoring the usability of each second component according to the number of variables of the target attribute required in the target code data corresponding to each second component and the number of functions required to be bound to obtain a third score; and calculating according to the first score, the second score and the third score to obtain a score value corresponding to each second component.
Further, extracting code data corresponding to the target function from the code data corresponding to each history page, and obtaining a plurality of target code data includes: screening the code data corresponding to each history page to obtain a plurality of initial code data in a template of the code data; for each initial code data, processing event functions and variables in the initial code data to obtain processed initial code data; and determining the plurality of target code data according to the processed initial code data.
Further, processing the event function and the variable in the initial code data to obtain processed initial code data, wherein the processing includes: counting target event functions and target variables in the initial code data, wherein the target event functions comprise first event functions bound by the template and second event functions called by the first event functions, and the target variables comprise: the variables bound in the template, the variables of the first event function call and the variables of the second event function call; screening the initial code data according to the target event function and the target variable to obtain first code data, wherein the first code data comprises the target event function and the target variable; processing the first code data according to the function type of the target event function to obtain second code data, wherein the function type at least comprises: a closed class event function and an open class event function, wherein the closed class event function is an event function called inside the first code data, and the open class event function is an event function transferred by an upper component calling the first code data; changing the attribute of the target variable in the second code data according to the variable type of the target variable to obtain the processed initial code data, wherein the variable type at least comprises: open class variables, which are modifiable variables, and closed class variables, which are read-only variables.
Further, processing the first code data according to the function type of the target event function to obtain second code data includes: acquiring the function type of the target event function and acquiring the variable called by the open class event function; deleting variables called by the open class event function in the first code data to obtain the processed first code data; and modifying the open class event function in the processed first code data to obtain the second code data.
Further, changing the attribute of the target variable in the second code data according to the variable type of the target variable, and obtaining the processed initial code data includes: obtaining the variable type of the target variable; changing the attribute of the closed class variable in the second code data into a target attribute to obtain processed second code data; classifying open class variables in the processed second code data to obtain open synchronous class variables and open closed class variables, wherein the open synchronous class variables are variables which need to be synchronized to a superior component when the open synchronous class variables change, and the open closed class variables are variables which do not need to be synchronized to the superior component when the open closed class variables change; and modifying the open synchronous class variable in the processed second code data to obtain the processed initial code data.
Further, encapsulating according to the plurality of object code data to obtain a plurality of second components includes: optimizing the plurality of target code data according to a preset rule to obtain optimized plurality of target code data; and packaging according to the optimized plurality of target code data to obtain the plurality of second components.
In order to achieve the above object, according to another aspect of the present application, there is provided a page generating apparatus. The device comprises: the first acquisition unit is used for acquiring a page generation request of a target page, wherein the page generation request at least comprises a service function corresponding to the target page; the second acquisition unit is used for acquiring a target component and a description document of the target component from a target component library according to the service function corresponding to the target page, wherein the target component library comprises a plurality of components and the description document corresponding to each component, the components in the target component library are obtained based on code data corresponding to a history page, and the description document is used for describing how the components are used; and the generating unit is used for generating the target page according to the target component and the description document of the target component.
Further, the second acquisition unit includes: the obtaining subunit is used for obtaining a plurality of first components and score values corresponding to each first component from the target component library according to the service functions corresponding to the target page; and the selecting subunit is used for selecting the target component from the plurality of first components according to the score value corresponding to each first component and acquiring the description document of the target component from the target component library.
Further, the apparatus further comprises: the third acquisition unit is used for acquiring code data corresponding to a plurality of historical pages before acquiring a target component and an explanation document of the target component from a target component library according to the service function corresponding to the target page; the extraction unit is used for extracting code data corresponding to the target function from the code data corresponding to each history page to obtain a plurality of target code data; the packaging unit is used for packaging according to the plurality of target code data to obtain a plurality of second components, and according to each target code data, obtaining a corresponding description document of each second component; and the construction unit is used for constructing the target component library according to the plurality of second components and the description documents corresponding to each second component.
Further, the apparatus further comprises: the first scoring unit is used for scoring the independence of each second component according to the number of the called hypertext transfer protocol interfaces in the target code data corresponding to each second component after the plurality of second components are obtained by packaging according to the plurality of target code data, so as to obtain a first score; the second scoring unit is used for scoring the expansibility of each second component according to the number of slots in the target code data corresponding to each second component, the number of variables of the target attribute and the number of functions capable of being bound to obtain a second score, wherein the target attribute represents the data of which the variables can receive external input; the third scoring unit is used for scoring the usability of each second component according to the number of variables of the target attribute required in the target code data corresponding to each second component and the number of functions required to be bound to obtain a third score; and the calculating unit is used for calculating according to the first score, the second score and the third score to obtain a score value corresponding to each second component.
Further, the extraction unit includes: the screening subunit is used for screening the code data corresponding to each historical page to obtain a plurality of initial code data in the code data template; the processing subunit is used for processing the event function and the variable in the initial code data to obtain processed initial code data; and the determining subunit is used for determining the plurality of target code data according to the processed initial code data.
Further, the processing subunit includes: a statistics module, configured to count a target event function and a target variable in the initial code data, where the target event function includes a first event function bound by the template and a second event function called by the first event function, and the target variable includes: the variables bound in the template, the variables of the first event function call and the variables of the second event function call; the screening module is used for screening the initial code data according to the target event function and the target variable to obtain first code data, wherein the first code data comprises the target event function and the target variable; the processing module is used for processing the first code data according to the function type of the target event function to obtain second code data, wherein the function type at least comprises: a closed class event function and an open class event function, wherein the closed class event function is an event function called inside the first code data, and the open class event function is an event function transferred by an upper component calling the first code data; the changing module is configured to change an attribute of the target variable in the second code data according to a variable type of the target variable, so as to obtain the processed initial code data, where the variable type at least includes: open class variables, which are modifiable variables, and closed class variables, which are read-only variables.
Further, the processing module includes: the first acquisition sub-module is used for acquiring the function type of the target event function and acquiring the variable called by the open class event function; the processing sub-module is used for deleting the variable called by the open class event function in the first code data to obtain the processed first code data; and the transformation submodule is used for transforming the open class event function in the processed first code data to obtain the second code data.
Further, the change module includes: the second acquisition submodule is used for acquiring the variable type of the target variable; a change sub-module, configured to change an attribute of the closed class variable in the second code data to a target attribute, so as to obtain processed second code data; the classification sub-module is used for classifying the open class variable in the processed second code data to obtain an open synchronous class variable and an open closed class variable, wherein the open synchronous class variable is a variable which needs to be synchronized to a superior component when the open synchronous class variable changes, and the open closed class variable is a variable which does not need to be synchronized to the superior component when the open closed class variable changes; and the transformation submodule is used for transforming the open synchronous class variable in the processed second code data to obtain the processed initial code data.
Further, the packaging unit includes: the optimizing subunit is used for optimizing the plurality of target code data according to a preset rule to obtain a plurality of optimized target code data; and the packaging subunit is used for packaging according to the optimized plurality of target code data to obtain the plurality of second components.
In order to achieve the above object, according to another aspect of the present application, there is also provided a computer-readable storage medium storing a program, wherein the program, when run, controls a device in which the storage medium is located to execute the page generation method of any one of the above.
To achieve the above object, according to one aspect of the present application, there is provided an electronic device, including one or more processors and a memory, where the memory is configured to store one or more processors to implement a method for generating a page according to any one of the above.
Through the application, the following steps are adopted: acquiring a page generation request of a target page, wherein the page generation request at least comprises a service function corresponding to the target page; acquiring target components and description documents of the target components from a target component library according to service functions corresponding to the target pages, wherein the target component library comprises a plurality of components and description documents corresponding to each component, the components in the target component library are obtained based on code data corresponding to historical pages, and the description documents are used for describing how the components are used; according to the target components and the description documents of the target components, the target pages are generated, and the problem that the efficiency of generating the front-end pages is low due to the fact that corresponding functional components are required to be manually developed in the front-end pages in the related technology is solved. In the scheme, when the page needs to be generated, the target component and the description document of the target component are selected from the target component library according to the service function required by the page, and then the corresponding page is generated according to the description document of the target component and the target component, so that the manual development of the corresponding functional component is avoided, and the effect of improving the efficiency of generating the front-end page is further achieved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application, illustrate and explain the application and are not to be construed as limiting the application. In the drawings:
FIG. 1 is a flow chart of a method of generating pages provided in accordance with an embodiment of the present application;
FIG. 2 is a flow chart of an alternative page generation method provided in accordance with an embodiment of the present application;
fig. 3 is a schematic diagram of a page generating apparatus provided according to an embodiment of the present application;
fig. 4 is a schematic diagram of an electronic device provided according to an embodiment of the present application.
Detailed Description
It should be noted that, in the case of no conflict, the embodiments and features in the embodiments may be combined with each other. The present application will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
In order to make the present application solution better understood by those skilled in the art, the following description will be made in detail and with reference to the accompanying drawings in the embodiments of the present application, it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate in order to describe the embodiments of the present application described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that, related information (including, but not limited to, user equipment information, user personal information, etc.) and data (including, but not limited to, data for presentation, analyzed data, etc.) related to the present disclosure are information and data authorized by a user or sufficiently authorized by each party. For example, an interface is provided between the system and the relevant user or institution, before acquiring the relevant information, the system needs to send an acquisition request to the user or institution through the interface, and acquire the relevant information after receiving the consent information fed back by the user or institution.
The present invention will be described with reference to preferred implementation steps, and fig. 1 is a flowchart of a method for generating a page according to an embodiment of the present application, as shown in fig. 1, where the method includes the following steps:
step S101, a page generation request of a target page is obtained, wherein the page generation request at least comprises a service function corresponding to the target page.
Specifically, a page generation request of a page to be generated (i.e., the target page described above) is obtained, and the service function corresponding to the page to be generated needs to be included in the page generation request, for example, the target page is a search page, and then the corresponding required service function is the search function.
It should be noted that the page may be a page based on Vue.
Step S102, acquiring target components and description documents of the target components from a target component library according to service functions corresponding to the target pages, wherein the target component library comprises a plurality of components and description documents corresponding to each component, and the components in the target component library are obtained based on code data corresponding to historical pages, and the description documents are used for describing how the components are used.
Specifically, selecting a target component corresponding to the service function from a target component library according to the service function corresponding to the target page, and selecting an explanation document of the target component. It should be noted that, the format of the description document may be a plain text format (md), and md is a markup language, so that the developer can read and understand the document conveniently. It should be noted that the description document is used to describe how the component is used, for example, the description document describes which functions of the component must be bound, which variables are required to be imported by the component of the previous stage, and so on.
It should be noted that, the target component library includes a plurality of components and description documents corresponding to each component, and the components in the target component library are extracted and packaged from code data corresponding to the existing page.
Step S103, generating a target page according to the target component and the description document of the target component.
Specifically, layout, modification, and the like are performed according to the target component and the specification document of the target component to obtain the target page described above.
In summary, when a page needs to be generated, the target component and the description document of the target component are selected from the target component library according to the service function required by the page, and then the corresponding page is generated according to the description document of the target component and the target component, so that the manual development of the corresponding functional component is avoided, and the effect of improving the efficiency of generating the front-end page is achieved.
In order to improve the rationality of selecting a target component, in the page generating method provided in the embodiment of the present application, according to a service function corresponding to the target page, obtaining a target component and an explanation document of the target component from a target component library includes: acquiring a plurality of first components and score values corresponding to each first component from a target component library according to the service functions corresponding to the target page; and selecting a target component from the plurality of first components according to the score value corresponding to each first component, and acquiring a description document of the target component from a target component library.
Specifically, a plurality of first components corresponding to the business function and score values corresponding to the first components are selected from a target component library according to the business function, and the target component is selected by the score values, for example, the first component with the highest score is selected as the target component. And finally, acquiring the description document of the target component from the target component library. And the most suitable target component is selected through the score of the component, so that the rationality of determining the target component is improved.
For the page generation method provided by the embodiment of the present application, how to obtain the target component library is crucial, so before obtaining the target component and the description document of the target component from the target component library according to the service function corresponding to the target page, the method further includes: acquiring code data corresponding to a plurality of history pages; extracting code data corresponding to the target function from the code data corresponding to each history page to obtain a plurality of target code data; packaging according to the plurality of target code data to obtain a plurality of second components, and obtaining a description document corresponding to each second component according to each target code data; and constructing a target component library according to the plurality of second components and the corresponding description document of each second component.
Specifically, the existing history pages which are realized and code data corresponding to the history pages are obtained, the code data corresponding to the target function is selected from the history pages, for example, the search function is required to be packaged into an independent component, the code data corresponding to the search function is selected from the history pages, and the code data corresponding to the target function mainly comprises js and css parts, wherein js is the processing of various dynamic effects of the pages and can be used for realizing the function of interaction between the pages and people; css is static form to the page, which can make the page display processing with certain layout.
And after obtaining a plurality of target code data corresponding to the target function, packaging the target code data to obtain a plurality of second components and explanation documents corresponding to the second components, and finally constructing the target component library according to the second components and the explanation documents.
In summary, the code data of the realized history page automatically generates the usable component meeting the requirement of the Vue grammar and the usage description document corresponding to the component, thereby improving the multiplexing capability of the component and the generation efficiency of the subsequent page.
In order to facilitate subsequent selection of higher quality components, in the method for generating a page provided in the embodiment of the present application, after packaging according to a plurality of target code data to obtain a plurality of second components, the method further includes: according to the number of invoking hypertext transfer protocol interfaces in the object code data corresponding to each second component, scoring the independence of each second component to obtain a first score; scoring expansibility of each second component according to the number of slots in the object code data corresponding to each second component, the number of variables of the object attribute and the number of functions capable of being bound to obtain a second score, wherein the object attribute represents the variables and can receive data input from the outside; scoring the usability of each second component according to the number of variables of the target attribute required in the target code data corresponding to each second component and the number of functions required to be bound to obtain a third score; and calculating according to the first score, the second score and the third score to obtain a score value corresponding to each second component.
In particular, the quality of the component is evaluated quickly and well mainly from three aspects of independence, expansibility and usability.
For independence, the number of http (hypertext transfer protocol) interfaces is mainly called from code data to evaluate, in general, the number is 0 and is optimal, the smaller the number is, the higher the score is, that is, the smaller the number of the hypertext transfer protocol interfaces is called, and the better the independence of the component is.
For extensibility, the number of slots, the number of variables of the property of tips (property of targets) and the number of functions that can be bound in the code data are mainly evaluated, and in general, the larger the number is, the higher the score is, that is, the larger the number of slots, the number of variables of the property of tips (property of targets) and the number of functions that can be bound is, the higher the extensibility of this component is.
Note that the tips attribute is used to pass data or methods in the parent component to the child component for use.
For ease of use, the number of variables of the property of tips that must be entered and the number of functions that must be bound in the code data are primarily evaluated, and in general, the fewer the data, the higher the score, i.e., the fewer the number of variables of the property of tips that must be entered and the number of functions that must be bound, the better the independence of this component.
And obtaining the independence score, the expansibility score and the usability score of the second component by calculating the quantity of the data, and accurately evaluating the quality of the current component through the scores so as to facilitate the subsequent selection of better components to generate corresponding pages.
It is very important how to accurately and quickly extract code data corresponding to a target function, so in the page generation method provided in the embodiment of the present application, extracting code data corresponding to a target function from code data corresponding to each history page, to obtain a plurality of target code data includes: screening the code data corresponding to each history page to obtain a plurality of initial code data in a template of the code data; for each initial code data, processing event functions and variables in the initial code data to obtain processed initial code data; and determining a plurality of target code data according to the processed initial code data.
Specifically, code data corresponding to each history page is screened, code data which needs to be packaged into components in a template (namely the template) is extracted to obtain the initial code data, event functions and variables in the initial code data are modified, deleted and the like to obtain the processed initial code data, and finally the target code data are obtained according to the processed initial code data. The event function and variable in the code data are the js part code and css part code. Through the steps, the efficiency of acquiring the code data corresponding to the target function is improved.
In an alternative embodiment, processing the event function and the variable in the initial code data to obtain the processed initial code data includes: counting target event functions and target variables in initial code data, wherein the target event functions comprise a first event function bound by a template and a second event function called by the first event function, and the target variables comprise: a variable bound in the template, a variable of the first event function call and a variable of the second event function call; screening the initial code data according to the target event function and the target variable to obtain first code data, wherein the first code data comprises the target event function and the target variable; processing the first code data according to the function type of the target event function to obtain second code data, wherein the function type at least comprises: a closed class event function and an open class event function, wherein the closed class event function is an event function called inside the first code data, and the open class event function is an event function transferred by an upper component calling the first code data; changing the attribute of the target variable in the second code data according to the variable type of the target variable to obtain the processed initial code data, wherein the variable type at least comprises: open class variables and closed class variables, wherein the open class variables are modifiable variables, and the closed class variables are read-only variables.
Specifically, statistics is performed on the target event function and the target variable in the initial code data, and in general, the target event function needs to count the first event function bound in the template and the second event function called by the first event function; the target variable needs to count the variables directly used in the template (i.e. the variables bound in the template), the variables of the first event function call, the variables of the second event function call, etc.
Then, other event functions and other variables in the initial code data are deleted according to the counted target event functions and target variables to obtain the first code data. It should be noted that hook functions such as create () and mount () in the template may be deleted.
After the first code data is obtained, the first code data is processed according to the function type of the target event function, and the second code data is obtained. The function types of the target event functions are mainly divided into two types: closed class event functions and open class event functions. The closed class event function refers to a function used in the template, and the open class event function refers to an event function transferred by an upper component calling the first code data, that is, when a component corresponding to the first code data is used as a sub-component, a parent component (that is, the upper component) is transferred. Generally, the closed event function is a function used in the template and does not need to be changed, but the open event function is an event function transmitted from a parent component and changes according to the parent component, so that the open event function needs to be modified to obtain the second code data.
For target variables, it is also divided into two major classes: open class variables, which refer to both readable and writable variables, and closed class variables, which refer to read-only variables. And changing the attribute of the target variable in the second code data according to the variable type of the target variable to obtain the processed initial code data.
Through the steps, simple and rapid reconstruction work is realized, the efficiency of acquiring the processed initial code data is further improved, and a standard method for extracting the components is provided through the steps, so that the possibility is provided for multiplexing the subsequent components.
In an alternative embodiment, processing the first code data according to the function type of the target event function to obtain the second code data includes: acquiring a function type of a target event function, and acquiring a variable called by an open class event function; deleting variables called by the open class event function in the first code data to obtain the processed first code data; and modifying the open class event function in the processed first code data to obtain second code data.
The closed event function is a function used in the template and does not need to be changed, but the open event function is an event function transmitted from a parent component and changes according to the parent component, so that the open event function needs to be modified to obtain the second code data.
First, variables of open class event function calls are acquired, and since the open class event functions change with the change of the parent component, the variables of the corresponding open class event function calls cannot be determined, and therefore, the variables are deleted, and the processed first code data is obtained.
Then, modifying the open class event function in the processed first code data mainly comprises the following steps: deleting the function body of the open type event function, modifying the function body into a triggering custom event so as to be triggered based on the father component later, judging whether the open type event function has the condition of transmitting multiple parameters, and if the open type event function has the condition of transmitting multiple parameters, packaging the transmitted multiple parameters so as to transmit the multiple parameters through one data packet. And finally, obtaining the transformed second code data.
In an optional embodiment, in the page generating method provided in the embodiment of the present application, the changing, according to the variable type of the target variable, the attribute of the target variable in the second code data, to obtain the processed initial code data includes: obtaining the variable type of a target variable; changing the attribute of the closed class variable in the second code data into a target attribute to obtain processed second code data; classifying open class variables in the processed second code data to obtain open synchronous class variables and open closed class variables, wherein the open synchronous class variables are variables which need to be synchronized to a superior component when the open synchronous class variables change, and the open closed class variables are variables which do not need to be synchronized to the superior component when the open closed class variables change; and modifying the open synchronous class variable in the processed second code data to obtain the processed initial code data.
Specifically, the target variables are divided into closed class variables and open class variables, and read-only variables are used for the closed class variables, so that the properties of such variables are changed to tips properties (i.e., the target properties described above).
For open class variables, the open synchronous class variables are further divided into open synchronous class variables and open closed class variables, wherein the open synchronous class variables are variables which need to be synchronized to a parent component when the open synchronous class variables change, and the open closed class variables are variables which do not need to be synchronized to the parent component when the open closed class variables change. The method mainly comprises the steps of modifying an open synchronous variable, namely changing the attribute of the open synchronous variable into a computer attribute, setting a set and a get function for the variables, assigning corresponding tips to the corresponding open synchronous variable in the get, and triggering an update event of a parent component in the set, so that the method is equivalent to splitting one variable into two variables, wherein the tips variable is used for receiving the change in the parent component and synchronizing the change in the parent component to a child component, and the computer variable is used for monitoring the change of the variable in the child component and notifying the update of the parent component through a custom event.
It should be noted that, the computed attribute is a computation attribute, which is used to compute and cache the variable.
In summary, the independence and reusability of the variables are ensured by modifying the variables.
In order to improve the quality of the target component, in the page generating method provided in the embodiment of the present application, packaging according to a plurality of target code data, to obtain a plurality of second components includes: optimizing the plurality of target code data according to a preset rule to obtain optimized plurality of target code data; and packaging according to the optimized plurality of target code data to obtain a plurality of second components.
Specifically, after obtaining the target code data corresponding to the target function, the target code data may be further optimized according to some preset rules, and then the optimized plurality of target code data are packaged into the corresponding second component. For example, limit component style: the css is not used with the importent key, the css style of style writing is not presented in the component, and the css is extracted to index. Scss, and a class attribute is-style is used to control whether default attributes are enabled or not. For another example, in order to increase the convenience of the new user-defined function, a slot may be placed in the component, so that the user may insert completely customized content.
In conclusion, the quality and usability of the component can be effectively improved by optimizing the target code data.
In an alternative embodiment, the components of the existing page may be modified and unified using the flowchart shown in fig. 2, so as to improve maintainability of the subsequent page. The method specifically comprises the following steps:
step 1, selecting a part of an original page template to be packaged into a component, deleting the rest part, copying the part of template code into an automatic generation platform, and uploading the original page to the platform;
step 2, the platform analyzes the part of the original page, which is selected by the user, according to the characteristic of the Vue, extracts js and css parts needed by the template, automatically generates a component which accords with the Vue grammar specification according to the method, and synchronously generates a matched description document;
step 3, if a plurality of different implementations of the same functions exist in the storage code in a system, the step 2 can be executed on the modules respectively to generate different components with similar functions, the platform can score according to three dimensions of independence of the generated components (the quantity of http interfaces directly called in the components is 0 and is optimal, the quantity is smaller, the score is higher), expandability (the quantity of slots, the quantity of tips, the quantity of bindable functions are all the more, the score is higher), and usability (the quantity of tips and the bound functions is smaller, the score is higher), and a user can select the component with the highest score to use. If the generated component scores are not high, the user can narrow the range of the template, and execute the step 2 again to generate a component with smaller dimension;
Step 4, step 3 has selected the good relatively better assembly of production, can use this assembly to rewrite other pages with function of this assembly at this time, make the identity function offer with a basic assembly in the system, and then promote the cohesiveness of the code, the degree of multiplexing, reduce subsequent modification difficulty and test workload.
According to the page generation method provided by the embodiment of the application, the page generation request of the target page is obtained, wherein the page generation request at least comprises the service function corresponding to the target page; acquiring target components and description documents of the target components from a target component library according to service functions corresponding to the target pages, wherein the target component library comprises a plurality of components and description documents corresponding to each component, the components in the target component library are obtained based on code data corresponding to historical pages, and the description documents are used for describing how the components are used; according to the target components and the description documents of the target components, the target pages are generated, and the problem that the efficiency of generating the front-end pages is low due to the fact that corresponding functional components are required to be manually developed in the front-end pages in the related technology is solved. In the scheme, when the page needs to be generated, the target component and the description document of the target component are selected from the target component library according to the service function required by the page, and then the corresponding page is generated according to the description document of the target component and the target component, so that the manual development of the corresponding functional component is avoided, and the effect of improving the efficiency of generating the front-end page is further achieved.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowcharts, in some cases the steps illustrated or described may be performed in an order other than that illustrated herein.
The embodiment of the application also provides a page generating device, and the page generating device of the embodiment of the application can be used for executing the page generating method provided by the embodiment of the application. The following describes a page generating device provided in the embodiment of the present application.
Fig. 3 is a schematic diagram of a page generating apparatus according to an embodiment of the present application. As shown in fig. 3, the apparatus includes: a first acquisition unit 301, a second acquisition unit 302, and a generation unit 303.
The first obtaining unit 301 is configured to obtain a page generation request of a target page, where the page generation request at least includes a service function corresponding to the target page;
a second obtaining unit 302, configured to obtain, according to a service function corresponding to a target page, a target component and a description document of the target component from a target component library, where the target component library includes a plurality of components and description documents corresponding to each component, and the components in the target component library are obtained based on code data corresponding to a history page, where the description documents are used to describe how the components are used;
The generating unit 303 is configured to generate a target page according to the target component and the description document of the target component.
According to the page generation device provided by the embodiment of the application, a page generation request of a target page is acquired through the first acquisition unit 301, wherein the page generation request at least comprises a service function corresponding to the target page; the second obtaining unit 302 obtains a target component and a description document of the target component from a target component library according to a service function corresponding to the target page, wherein the target component library comprises a plurality of components and description documents corresponding to each component, and the components in the target component library are obtained based on code data corresponding to the history page, and the description documents are used for describing how the components are used; the generating unit 303 generates the target page according to the target component and the description document of the target component, thereby solving the problem that the efficiency of generating the front-end page is relatively low because the corresponding functional component needs to be manually developed in the front-end page in the related art. In the scheme, when the page needs to be generated, the target component and the description document of the target component are selected from the target component library according to the service function required by the page, and then the corresponding page is generated according to the description document of the target component and the target component, so that the manual development of the corresponding functional component is avoided, and the effect of improving the efficiency of generating the front-end page is further achieved.
Optionally, in the page generating apparatus provided in the embodiment of the present application, the second obtaining unit includes: the acquisition subunit is used for acquiring a plurality of first components and score values corresponding to each first component from the target component library according to the service functions corresponding to the target page; and the selecting subunit is used for selecting a target component from the plurality of first components according to the score value corresponding to each first component and acquiring the description document of the target component from the target component library.
Optionally, in the page generating device provided in the embodiment of the present application, the device further includes: the third acquisition unit is used for acquiring code data corresponding to a plurality of historical pages before acquiring the target components and the description documents of the target components from the target component library according to the service functions corresponding to the target pages; the extraction unit is used for extracting code data corresponding to the target function from the code data corresponding to each history page to obtain a plurality of target code data; the packaging unit is used for packaging according to the plurality of target code data to obtain a plurality of second components, and according to each target code data, obtaining a corresponding description document of each second component; and the construction unit is used for constructing a target component library according to the plurality of second components and the corresponding description documents of each second component.
Optionally, in the page generating device provided in the embodiment of the present application, the device further includes: the first scoring unit is used for scoring the independence of each second component according to the number of the called hypertext transfer protocol interfaces in the target code data corresponding to each second component after the plurality of second components are obtained by packaging according to the plurality of target code data, so as to obtain a first score; the second scoring unit is used for scoring the expansibility of each second component according to the number of slots in the target code data corresponding to each second component, the number of variables of the target attribute and the number of functions capable of being bound to obtain a second score, wherein the target attribute represents the variables and can receive data input from the outside; the third scoring unit is used for scoring the usability of each second component according to the number of variables of the target attribute required in the target code data corresponding to each second component and the number of functions required to be bound to obtain a third score; and the calculating unit is used for calculating according to the first score, the second score and the third score to obtain a score value corresponding to each second component.
Optionally, in the page generating device provided in the embodiment of the present application, the extracting unit includes: the screening subunit is used for screening the code data corresponding to each historical page to obtain a plurality of initial code data in the code data template; the processing subunit is used for processing the event function and the variable in the initial code data to obtain processed initial code data; and the determining subunit is used for determining a plurality of target code data according to the processed initial code data.
Optionally, in the page generating device provided in the embodiment of the present application, the processing subunit includes: the statistics module is used for counting target event functions and target variables in initial code data, wherein the target event functions comprise a first event function and a second event function, the first event function is bound with a template, the second event function is called by the first event function, and the target variables comprise: a variable bound in the template, a variable of the first event function call and a variable of the second event function call; the screening module is used for screening the initial code data according to the target event function and the target variable to obtain first code data, wherein the first code data comprises the target event function and the target variable; the processing module is used for processing the first code data according to the function type of the target event function to obtain second code data, wherein the function type at least comprises: a closed class event function and an open class event function, wherein the closed class event function is an event function called inside the first code data, and the open class event function is an event function transferred by an upper component calling the first code data; the changing module is configured to change an attribute of a target variable in the second code data according to a variable type of the target variable, so as to obtain processed initial code data, where the variable type at least includes: open class variables and closed class variables, wherein the open class variables are modifiable variables, and the closed class variables are read-only variables.
Optionally, in the page generating device provided in the embodiment of the present application, the processing module includes: the first acquisition sub-module is used for acquiring the function type of the target event function and acquiring the variable called by the open class event function; the processing sub-module is used for deleting variables called by the open class event function in the first code data to obtain the processed first code data; and the transformation submodule is used for transforming the open class event function in the processed first code data to obtain second code data.
Optionally, in the page generating device provided in the embodiment of the present application, the changing module includes: the second acquisition submodule is used for acquiring the variable type of the target variable; a change sub-module, configured to change an attribute of a closed class variable in the second code data to a target attribute, so as to obtain processed second code data; the classification sub-module is used for classifying the open class variable in the processed second code data to obtain an open synchronous class variable and an open closed class variable, wherein the open synchronous class variable is a variable which needs to be synchronized to a superior component when the open synchronous class variable changes, and the open closed class variable is a variable which does not need to be synchronized to the superior component when the open closed class variable changes; and the transformation submodule is used for transforming the open synchronous class variable in the processed second code data to obtain the processed initial code data.
Optionally, in the page generating device provided in the embodiment of the present application, the packaging unit includes: the optimizing subunit is used for optimizing the plurality of target code data according to a preset rule to obtain the optimized plurality of target code data; and the packaging subunit is used for packaging according to the optimized plurality of target code data to obtain a plurality of second components.
The page generating device includes a processor and a memory, where the first acquiring unit 301, the second acquiring unit 302, the generating unit 303, and the like are stored as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel can be provided with one or more than one, and the generation of the target page is realized by adjusting kernel parameters.
The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
The embodiment of the invention provides a computer readable storage medium, on which a program is stored, which when executed by a processor, implements a method of generating pages.
The embodiment of the invention provides a processor, which is used for running a program, wherein the program runs a method for generating an execution page.
As shown in fig. 4, an embodiment of the present invention provides an electronic device, where the device includes a processor, a memory, and a program stored in the memory and executable on the processor, and when the processor executes the program, the following steps are implemented: acquiring a page generation request of a target page, wherein the page generation request at least comprises a service function corresponding to the target page; acquiring target components and description documents of the target components from a target component library according to service functions corresponding to the target pages, wherein the target component library comprises a plurality of components and description documents corresponding to each component, the components in the target component library are obtained based on code data corresponding to historical pages, and the description documents are used for describing how the components are used; and generating a target page according to the target component and the description document of the target component.
Optionally, according to the service function corresponding to the target page, obtaining the target component and the description document of the target component from the target component library includes: acquiring a plurality of first components and score values corresponding to each first component from a target component library according to the service functions corresponding to the target page; and selecting a target component from the plurality of first components according to the score value corresponding to each first component, and acquiring a description document of the target component from a target component library.
Optionally, before acquiring the target component and the description document of the target component from the target component library according to the service function corresponding to the target page, the method further includes: acquiring code data corresponding to a plurality of history pages; extracting code data corresponding to the target function from the code data corresponding to each history page to obtain a plurality of target code data; packaging according to the plurality of target code data to obtain a plurality of second components, and obtaining a description document corresponding to each second component according to each target code data; and constructing a target component library according to the plurality of second components and the corresponding description document of each second component.
Optionally, after encapsulating according to the plurality of object code data, the method further comprises: according to the number of invoking hypertext transfer protocol interfaces in the object code data corresponding to each second component, scoring the independence of each second component to obtain a first score; scoring expansibility of each second component according to the number of slots in the object code data corresponding to each second component, the number of variables of the object attribute and the number of functions capable of being bound to obtain a second score, wherein the object attribute represents the variables and can receive data input from the outside; scoring the usability of each second component according to the number of variables of the target attribute required in the target code data corresponding to each second component and the number of functions required to be bound to obtain a third score; and calculating according to the first score, the second score and the third score to obtain a score value corresponding to each second component.
Optionally, extracting code data corresponding to the target function from code data corresponding to each history page, and obtaining a plurality of target code data includes: screening the code data corresponding to each history page to obtain a plurality of initial code data in a template of the code data; for each initial code data, processing event functions and variables in the initial code data to obtain processed initial code data; and determining a plurality of target code data according to the processed initial code data.
Optionally, processing the event function and the variable in the initial code data to obtain processed initial code data includes: counting target event functions and target variables in initial code data, wherein the target event functions comprise a first event function bound by a template and a second event function called by the first event function, and the target variables comprise: a variable bound in the template, a variable of the first event function call and a variable of the second event function call; screening the initial code data according to the target event function and the target variable to obtain first code data, wherein the first code data comprises the target event function and the target variable; processing the first code data according to the function type of the target event function to obtain second code data, wherein the function type at least comprises: a closed class event function and an open class event function, wherein the closed class event function is an event function called inside the first code data, and the open class event function is an event function transferred by an upper component calling the first code data; changing the attribute of the target variable in the second code data according to the variable type of the target variable to obtain the processed initial code data, wherein the variable type at least comprises: open class variables and closed class variables, wherein the open class variables are modifiable variables, and the closed class variables are read-only variables.
Optionally, processing the first code data according to the function type of the target event function to obtain the second code data includes: acquiring a function type of a target event function, and acquiring a variable called by an open class event function; deleting variables called by the open class event function in the first code data to obtain the processed first code data; and modifying the open class event function in the processed first code data to obtain second code data.
Optionally, changing the attribute of the target variable in the second code data according to the variable type of the target variable, and obtaining the processed initial code data includes: obtaining the variable type of a target variable; changing the attribute of the closed class variable in the second code data into a target attribute to obtain processed second code data; classifying open class variables in the processed second code data to obtain open synchronous class variables and open closed class variables, wherein the open synchronous class variables are variables which need to be synchronized to a superior component when the open synchronous class variables change, and the open closed class variables are variables which do not need to be synchronized to the superior component when the open closed class variables change; and modifying the open synchronous class variable in the processed second code data to obtain the processed initial code data.
Optionally, encapsulating according to the plurality of object code data, obtaining the plurality of second components includes: optimizing the plurality of target code data according to a preset rule to obtain optimized plurality of target code data; and packaging according to the optimized plurality of target code data to obtain a plurality of second components. The device herein may be a server, PC, PAD, cell phone, etc.
The present application also provides a computer program product adapted to perform, when executed on a data processing device, a program initialized with the method steps of: acquiring a page generation request of a target page, wherein the page generation request at least comprises a service function corresponding to the target page; acquiring target components and description documents of the target components from a target component library according to service functions corresponding to the target pages, wherein the target component library comprises a plurality of components and description documents corresponding to each component, the components in the target component library are obtained based on code data corresponding to historical pages, and the description documents are used for describing how the components are used; and generating a target page according to the target component and the description document of the target component.
Optionally, according to the service function corresponding to the target page, obtaining the target component and the description document of the target component from the target component library includes: acquiring a plurality of first components and score values corresponding to each first component from a target component library according to the service functions corresponding to the target page; and selecting a target component from the plurality of first components according to the score value corresponding to each first component, and acquiring a description document of the target component from a target component library.
Optionally, before acquiring the target component and the description document of the target component from the target component library according to the service function corresponding to the target page, the method further includes: acquiring code data corresponding to a plurality of history pages; extracting code data corresponding to the target function from the code data corresponding to each history page to obtain a plurality of target code data; packaging according to the plurality of target code data to obtain a plurality of second components, and obtaining a description document corresponding to each second component according to each target code data; and constructing a target component library according to the plurality of second components and the corresponding description document of each second component.
Optionally, after encapsulating according to the plurality of object code data, the method further comprises: according to the number of invoking hypertext transfer protocol interfaces in the object code data corresponding to each second component, scoring the independence of each second component to obtain a first score; scoring expansibility of each second component according to the number of slots in the object code data corresponding to each second component, the number of variables of the object attribute and the number of functions capable of being bound to obtain a second score, wherein the object attribute represents the variables and can receive data input from the outside; scoring the usability of each second component according to the number of variables of the target attribute required in the target code data corresponding to each second component and the number of functions required to be bound to obtain a third score; and calculating according to the first score, the second score and the third score to obtain a score value corresponding to each second component.
Optionally, extracting code data corresponding to the target function from code data corresponding to each history page, and obtaining a plurality of target code data includes: screening the code data corresponding to each history page to obtain a plurality of initial code data in a template of the code data; for each initial code data, processing event functions and variables in the initial code data to obtain processed initial code data; and determining a plurality of target code data according to the processed initial code data.
Optionally, processing the event function and the variable in the initial code data to obtain processed initial code data includes: counting target event functions and target variables in initial code data, wherein the target event functions comprise a first event function bound by a template and a second event function called by the first event function, and the target variables comprise: a variable bound in the template, a variable of the first event function call and a variable of the second event function call; screening the initial code data according to the target event function and the target variable to obtain first code data, wherein the first code data comprises the target event function and the target variable; processing the first code data according to the function type of the target event function to obtain second code data, wherein the function type at least comprises: a closed class event function and an open class event function, wherein the closed class event function is an event function called inside the first code data, and the open class event function is an event function transferred by an upper component calling the first code data; changing the attribute of the target variable in the second code data according to the variable type of the target variable to obtain the processed initial code data, wherein the variable type at least comprises: open class variables and closed class variables, wherein the open class variables are modifiable variables, and the closed class variables are read-only variables.
Optionally, processing the first code data according to the function type of the target event function to obtain the second code data includes: acquiring a function type of a target event function, and acquiring a variable called by an open class event function; deleting variables called by the open class event function in the first code data to obtain the processed first code data; and modifying the open class event function in the processed first code data to obtain second code data.
Optionally, changing the attribute of the target variable in the second code data according to the variable type of the target variable, and obtaining the processed initial code data includes: obtaining the variable type of a target variable; changing the attribute of the closed class variable in the second code data into a target attribute to obtain processed second code data; classifying open class variables in the processed second code data to obtain open synchronous class variables and open closed class variables, wherein the open synchronous class variables are variables which need to be synchronized to a superior component when the open synchronous class variables change, and the open closed class variables are variables which do not need to be synchronized to the superior component when the open closed class variables change; and modifying the open synchronous class variable in the processed second code data to obtain the processed initial code data.
Optionally, encapsulating according to the plurality of object code data, obtaining the plurality of second components includes: optimizing the plurality of target code data according to a preset rule to obtain optimized plurality of target code data; and packaging according to the optimized plurality of target code data to obtain a plurality of second components.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, etc., such as Read Only Memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises an element.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and changes may be made to the present application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. which are within the spirit and principles of the present application are intended to be included within the scope of the claims of the present application.

Claims (12)

1. The page generation method is characterized by comprising the following steps:
acquiring a page generation request of a target page, wherein the page generation request at least comprises a service function corresponding to the target page;
acquiring a target component and a description document of the target component from a target component library according to the service function corresponding to the target page, wherein the target component library comprises a plurality of components and the description document corresponding to each component, the components in the target component library are obtained based on code data corresponding to historical pages, and the description document is used for describing how the components are used;
And generating the target page according to the target component and the description document of the target component.
2. The method of claim 1, wherein obtaining the target component and the description document of the target component from the target component library according to the business function corresponding to the target page comprises:
acquiring a plurality of first components and score values corresponding to each first component from the target component library according to the service function corresponding to the target page;
and selecting the target component from the plurality of first components according to the score value corresponding to each first component, and acquiring the description document of the target component from the target component library.
3. The method of claim 1, wherein before obtaining the target component and the description document of the target component from the target component library according to the business function corresponding to the target page, the method further comprises:
acquiring code data corresponding to a plurality of history pages;
extracting code data corresponding to the target function from the code data corresponding to each history page to obtain a plurality of target code data;
packaging according to the plurality of target code data to obtain a plurality of second components, and obtaining a description document corresponding to each second component according to each target code data;
And constructing the target component library according to the plurality of second components and the corresponding description documents of each second component.
4. The method of claim 3, wherein after encapsulating according to the plurality of object code data to obtain a plurality of second components, the method further comprises:
according to the number of invoking hypertext transfer protocol interfaces in the object code data corresponding to each second component, scoring the independence of each second component to obtain a first score;
scoring expansibility of each second component according to the number of slots in target code data corresponding to each second component, the number of variables of target attributes and the number of functions capable of being bound to obtain a second score, wherein the target attributes represent the variables capable of receiving externally input data;
scoring the usability of each second component according to the number of variables of the target attribute required in the target code data corresponding to each second component and the number of functions required to be bound to obtain a third score;
and calculating according to the first score, the second score and the third score to obtain a score value corresponding to each second component.
5. A method according to claim 3, wherein extracting code data corresponding to the target function from code data corresponding to each history page to obtain a plurality of target code data comprises:
screening the code data corresponding to each history page to obtain a plurality of initial code data in a template of the code data;
for each initial code data, processing event functions and variables in the initial code data to obtain processed initial code data;
and determining the plurality of target code data according to the processed initial code data.
6. The method of claim 5, wherein processing the event functions and variables in the initial code data to obtain processed initial code data comprises:
counting target event functions and target variables in the initial code data, wherein the target event functions comprise first event functions bound by the template and second event functions called by the first event functions, and the target variables comprise: the variables bound in the template, the variables of the first event function call and the variables of the second event function call;
Screening the initial code data according to the target event function and the target variable to obtain first code data, wherein the first code data comprises the target event function and the target variable;
processing the first code data according to the function type of the target event function to obtain second code data, wherein the function type at least comprises: a closed class event function and an open class event function, wherein the closed class event function is an event function called inside the first code data, and the open class event function is an event function transferred by an upper component calling the first code data;
changing the attribute of the target variable in the second code data according to the variable type of the target variable to obtain the processed initial code data, wherein the variable type at least comprises: open class variables, which are modifiable variables, and closed class variables, which are read-only variables.
7. The method of claim 6, wherein processing the first code data according to the function type of the target event function to obtain second code data comprises:
Acquiring the function type of the target event function and acquiring the variable called by the open class event function;
deleting variables called by the open class event function in the first code data to obtain the processed first code data;
and modifying the open class event function in the processed first code data to obtain the second code data.
8. The method of claim 6, wherein altering the property of the target variable in the second code data according to the variable type of the target variable to obtain the processed initial code data comprises:
obtaining the variable type of the target variable;
changing the attribute of the closed class variable in the second code data into a target attribute to obtain processed second code data;
classifying open class variables in the processed second code data to obtain open synchronous class variables and open closed class variables, wherein the open synchronous class variables are variables which need to be synchronized to a superior component when the open synchronous class variables change, and the open closed class variables are variables which do not need to be synchronized to the superior component when the open closed class variables change;
And modifying the open synchronous class variable in the processed second code data to obtain the processed initial code data.
9. The method of claim 6, wherein encapsulating according to the plurality of object code data to obtain a plurality of second components comprises:
optimizing the plurality of target code data according to a preset rule to obtain optimized plurality of target code data;
and packaging according to the optimized plurality of target code data to obtain the plurality of second components.
10. A page generation apparatus, comprising:
the first acquisition unit is used for acquiring a page generation request of a target page, wherein the page generation request at least comprises a service function corresponding to the target page;
the second acquisition unit is used for acquiring a target component and a description document of the target component from a target component library according to the service function corresponding to the target page, wherein the target component library comprises a plurality of components and the description document corresponding to each component, the components in the target component library are obtained based on code data corresponding to a history page, and the description document is used for describing how the components are used;
And the generating unit is used for generating the target page according to the target component and the description document of the target component.
11. A computer-readable storage medium storing a program, wherein the program performs the page generation method of any one of claims 1 to 9.
12. An electronic device comprising one or more processors and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of identifying generation of pages of any of claims 1-9.
CN202310397565.7A 2023-04-12 2023-04-12 Page generation method and device, storage medium and electronic equipment Pending CN116501317A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310397565.7A CN116501317A (en) 2023-04-12 2023-04-12 Page generation method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310397565.7A CN116501317A (en) 2023-04-12 2023-04-12 Page generation method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN116501317A true CN116501317A (en) 2023-07-28

Family

ID=87315947

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310397565.7A Pending CN116501317A (en) 2023-04-12 2023-04-12 Page generation method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN116501317A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117908867A (en) * 2023-12-24 2024-04-19 振宁(无锡)智能科技有限公司 Low-code application development system and method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117908867A (en) * 2023-12-24 2024-04-19 振宁(无锡)智能科技有限公司 Low-code application development system and method

Similar Documents

Publication Publication Date Title
CN108319547B (en) Test case generation method, device and system
US10235999B1 (en) Voice application platform
US10636425B2 (en) Voice application platform
CN105511873B (en) User interface control display method and device
CN110806863A (en) Interface document generation method and device, electronic equipment and storage medium
TWI683251B (en) Interface display method and device
US10977031B2 (en) Method for a software development system
CN106648556B (en) Method and device for front-end and back-end integrated development test
CN110968808B (en) Method and device for realizing webpage theme update
CN111414166A (en) Code generation method, device, equipment and storage medium
CN110647322B (en) List rendering method and device, electronic equipment and computer readable medium
CN109460546A (en) List generation method, device and electronic equipment
CN116501317A (en) Page generation method and device, storage medium and electronic equipment
US10567472B2 (en) Manipulation of PDF files using HTML authoring tools
CN117289905B (en) Application software development method and device, storage medium and electronic equipment
Krosnick et al. Promises and Pitfalls of Using LLMs for Scraping Web UIs
CN112597105B (en) File association object processing method, server device and storage medium
CN115048083A (en) Visualization method and device for assembly, storage medium and electronic equipment
CA3102093A1 (en) Voice application platform
CN110928540A (en) Page generation method and device
CN113485746B (en) Method and device for generating application program interface document
CN110874322A (en) Test method and test server for application program
CN112748917B (en) Graph display method and device
CN113342399A (en) Application structure configuration method and device and readable storage medium
US20240126624A1 (en) Automatically generating application programming interfaces

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