Page dynamic attribute static processing method and device, equipment and storage medium
By receiving component configuration data and statically processing the target dynamic components, static source files are generated, which solves the problems of increasing the number of components and lagging pages, and realizes efficient component management and stable page operation.
Patent Information
- Application Number
- CN202510272836.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-06-06
AI Technical Summary
In 0-code or low-code projects, as the complexity of business demand increases, the complexity of the project functions increases simultaneously, resulting in an increase in the number of components, making it difficult for the operation or development team to find suitable components. At the same time, a single component needs to be dynamically monitored, which occupies a lot of memory, resulting in page stuttering.
By receiving component configuration data of the target page, determine the target dynamic components that need static processing, obtain their dynamic source files and parse them to generate the basic syntax tree, statically process the basic syntax tree based on component configuration data, generate a static syntax tree and convert it into a static code template, and finally compile and generate a static source file.
It effectively reduces the number of components, avoids the expansion of component libraries, improves page performance and efficiency, ensures the correct analysis of the dependencies between static components and other parts of the project, and ensures the stable operation of the target page.
Smart Images

Figure CN120104138A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software development technology, and in particular to a method, device, equipment and storage medium for statically processing dynamic attributes of a page. Background Art
[0002] In zero-code or low-code projects, as the complexity of business requirements changes, the complexity of project functions also increases. In order to support different styles and different interaction logics without affecting performance, there will be more and more project components. For operations or development teams, it is becoming increasingly difficult to find suitable components.
[0003] There are currently two common technical means. First, by establishing a user free component library, users can query components in the component library. However, this technical means has the problem of high component maintenance costs. Second, by expanding and diversifying a single component, the number of components can be reduced. However, this technical means results in a single component requiring more content to be dynamically monitored, which occupies a high amount of memory and causes page freezes. Therefore, how to reduce the continuous increase in the number of components while meeting component diversity is a problem to be solved. Summary of the invention
[0004] The embodiments of the present invention provide a method, device, equipment and storage medium for statically processing dynamic attributes of a page, so as to solve the problems in the prior art.
[0005] A method for statically processing dynamic attributes of a page, comprising: Receiving component configuration data of a target page, and determining a target dynamic component in the target page that needs to be statically processed according to the component configuration data; Obtaining a dynamic source file corresponding to the target dynamic component, and parsing the dynamic source file to generate a basic syntax tree corresponding to the target dynamic component; Performing static processing on the basic syntax tree based on the component configuration data to generate a static syntax tree; The static syntax tree is converted into a static code template, and the static code template is compiled to generate a static source file corresponding to the target dynamic component.
[0006] A device for statically processing dynamic attributes of a page, comprising: A data receiving module, used for receiving component configuration data of a target page, and determining a target dynamic component in the target page that needs to be statically processed according to the component configuration data; A file parsing module, used for acquiring a dynamic source file corresponding to the target dynamic component, parsing the dynamic source file, and generating a basic syntax tree corresponding to the target dynamic component; A static processing module, used for performing static processing on the basic syntax tree based on the component configuration data to generate a static syntax tree; The code compilation module is used to convert the static syntax tree into a static code template, and compile the static code template to generate a static source file corresponding to the target dynamic component.
[0007] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for staticizing the dynamic attributes of a page is implemented.
[0008] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for staticizing the dynamic attributes of a page is implemented.
[0009] The above-mentioned page dynamic attribute static processing method, device, computer equipment and storage medium, the method screens out the target dynamic component that needs to be statically processed according to the component configuration data, can effectively generate components on demand for the needs of operators / developers in the component configuration data, and avoid the expansion of the component library. Further, the dynamic source file of the target dynamic component is constructed by introducing the form of a basic syntax tree, and then the component is statically processed in the compilation and packaging stage based on the basic syntax tree, so that it becomes the inherent content of the component. In this way, the new component converted by the static source file finally generated does not need to perform attribute monitoring at runtime, and can be directly used in the project, thereby improving performance and efficiency. At the same time, because the static syntax tree finally generated can intuitively reflect the code hierarchy relationship between static codes, so that in the final deployment process with static source files, it can ensure that the dependency relationship between the static components generated by the static source files and other parts of the project is correctly parsed, ensuring the stable operation of the target page. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0011] Figure 1 This is a schematic diagram of an application environment of a method for staticizing dynamic attributes of a page in one embodiment of the present invention; Figure 2 is a flow chart of a method for staticizing dynamic attributes of a page in one embodiment of the present invention; Figure 3It is a principle block diagram of a device for staticizing page dynamic attributes in one embodiment of the present invention; Figure 4 is a schematic diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0012] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0013] The method for statically processing dynamic attributes of a page provided by the embodiment of the present invention can be applied as follows: Figure 1 Specifically, the method for static processing of dynamic attributes of a page is applied in a static processing system for dynamic attributes of a page, and the static processing system for dynamic attributes of a page includes: Figure 1 The client and server shown in the figure communicate with each other through the network, and a service connection is established between the server and the smart cabinet to solve the problems in the prior art. Among them, the client is also called the user end, which refers to the program corresponding to the server and providing local services to customers. The client can be installed on but not limited to various personal computers, laptops, smart phones, tablets and portable wearable devices. The server can be implemented with an independent server or a server cluster composed of multiple servers. Among them, the server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms.
[0014] In one embodiment, if Figure 2 As shown, a method for statically processing dynamic attributes of a page is provided, and the method is applied in Figure 1 The server in the example is used as an example to illustrate the process, including the following steps: S10: receiving component configuration data of a target page, and determining a target dynamic component in the target page that needs to be statically processed according to the component configuration data.
[0015] It can be understood that the target page in this application refers to the target page in a 0-code or low-code project. The so-called 0-code or low-code project generally refers to a project that only supports code generation in a single programming language. These projects mainly focus on the visual construction of business logic and simplifying the code generation process. For example, in the scenario of smart finance, it is often necessary to build some visual interfaces for users. For example, the login interface of the financial platform, the consultation and registration interface of the financial product, etc. In the scenario of smart medical care, automatic guidance interface, automatic payment interface, etc. are built for users. The target page can be a pure web page, a mobile terminal, or a page on the system.
[0016] Furthermore, the component configuration data covers the needs of operators or developers to customize the development or adjust the target page. In this way, the target dynamic component that needs to be statically processed in the target page can be determined according to the component configuration data. Among them, the target dynamic component is the component containing dynamic attribute data in the target page that the operator or developer needs to adjust.
[0017] S20: Acquire a dynamic source file corresponding to the target dynamic component, and parse the dynamic source file to generate a basic syntax tree corresponding to the target dynamic component.
[0018] It can be understood that the dynamic source file is the source code in the target dynamic component. By parsing the dynamic source file, that is, parsing the link level of the code in the dynamic source file, the basic syntax tree corresponding to the target dynamic component is generated according to the link level. In this way, all the codes contained in the dynamic source file can be represented by the basic syntax tree. The nodes on the basic syntax tree are abstract syntax structures or words, and the basic syntax tree corresponds to each syntax element of the code in the dynamic source file one by one. The code of the dynamic source file and the upper and lower link hierarchical relationship between the execution of each code can be directly obtained from the basic syntax tree.
[0019] Furthermore, the dynamic source file can be crawled by crawling the target page through crawler technology to obtain the source code of all components in the target page. After determining the target dynamic component according to the component configuration data, the source code of the specific target dynamic component can be obtained from the source code of all components, thereby constructing the dynamic source file corresponding to each target dynamic component.
[0020] S30: Staticizing the basic syntax tree based on the component configuration data to generate a static syntax tree.
[0021] It is understandable that in generating the basic syntax tree, each tree node content on the basic syntax tree may contain dynamic attributes of the target dynamic component, and these dynamic attributes are attributes that will not be re-rendered as the target web page is refreshed. Therefore, these dynamic attributes can be converted into static attributes, and after all dynamic attributes are converted into static attributes, the basic syntax tree is converted into a static syntax tree.
[0022] S40: Convert the static syntax tree into a static code template, and compile the static code template to generate a static source file corresponding to the target dynamic component.
[0023] Specifically, after the basic syntax tree is statically processed based on the component configuration data to generate a static syntax tree, the static syntax tree is converted into a static code template, that is, the static syntax tree is disassembled. After being disassembled into code, the static code template can be compiled to generate a static source file corresponding to the target dynamic component. In this way, the process of statically processing the dynamic attribute data of the target dynamic component is completed in the packaging stage of the code of the target page.
[0024] In the present embodiment, the target dynamic components that need to be statically processed are screened out according to the component configuration data, and the expansion of the component library can be avoided by generating components on demand for the needs of the operators / developers in the component configuration data. Further, the dynamic source file of the target dynamic component is constructed by introducing the form of a basic syntax tree, and then the component is statically processed in the compilation and packaging stage based on the basic syntax tree, so that it becomes the inherent content of the component. In this way, the new component converted by the static source file finally generated does not need to perform attribute monitoring at runtime, and can be directly used in the project, thereby improving performance and efficiency. At the same time, because the static syntax tree finally generated can intuitively reflect the code hierarchy relationship between the static codes, so that in the final deployment process with the static source file, it can be ensured that the dependency relationship between the static component generated with the static source file and other parts of the project is correctly parsed, ensuring the stable operation of the target page.
[0025] In a specific application scenario, for example, in a financial scenario, it is often necessary to build a visual interface with less code, such as financial product services or new financial product information introductions. These visual interfaces will serve as user guide interfaces. For this kind of guide interface, operators / developers hope to enrich the diversity of interface components without increasing the number of components (reducing component maintenance costs). At this time, some dynamic attributes in the guide interface can be statically processed by the static processing method of the page dynamic attributes of this application, so that after the static processing, when the guide interface is running, there is no need to monitor the attributes, thereby improving the page loading speed and interactive response speed. For example, general navigation items that are not related to permissions (such as "Home" and "Help Center"), general recommendations (such as "Hot-selling Financial Products"), standardized operation tutorials (such as "Financial Risk Test") and other content can be converted into static attributes.
[0026] In another specific application scenario, for example, in the smart medical scenario, it is also necessary to build visual interfaces with less code, such as smart medical guidance and online payment processes. These visual interfaces will serve as user guidance interfaces. For this kind of guidance interface, operators / developers hope to enrich the diversity of interface components without increasing the number of components (reducing component maintenance costs). At this time, some dynamic attributes in the guidance interface can be statically processed by the static processing method of page dynamic attributes of this application, so that when the guidance interface is running after static processing, there is no need to monitor the attributes, thereby improving the page loading speed and interactive response speed. For example, the hospital address, department functions, floor navigation map, registration steps, payment methods, report query path, and document templates for some medical scenarios can be converted into static attributes.
[0027] In one embodiment, step S10, i.e., determining the target dynamic component that needs to be statically processed in the target page according to the component configuration data, includes: All basic dynamic components are extracted from the target page; the basic dynamic components contain basic dynamic data.
[0028] It can be understood that basic dynamic components refer to components that can dynamically adjust their behavior, style or content according to data, user interaction or configuration. For example, image components, interactive components, table style components or layout components in the target page. Basic dynamic data refers to data in dynamic components that need to be updated, judged or classified in real time. For example, running values that change as the web page runs, data associated with the user's input binding (that is, updated in real time with the user's input), etc.
[0029] The basic dynamic data that does not match the component configuration data is removed from all the basic dynamic data, and the basic dynamic component after the removal of the unmatched basic dynamic data is recorded as the target dynamic component.
[0030] It is understandable that not all basic dynamic components in the target page can be converted into static components, such as the data associated with the user's input binding (such as search boxes, chat dialog boxes), real-time data (such as weather forecasts, time), etc. As a result, before determining the target dynamic component, these basic dynamic components that cannot be converted into static components can be eliminated, and then other basic dynamic components that the user does not need to replace or are unnecessary can be eliminated from the remaining basic dynamic components based on the component configuration data uploaded by the user, and finally the target dynamic component can be obtained.
[0031] In one embodiment, step S20, that is, parsing the dynamic source file to generate a basic syntax tree corresponding to the target dynamic component, includes: Determine the data type corresponding to the dynamic source file.
[0032] It is understandable that the target page can be constructed using different programming languages or syntaxes. Therefore, the data types of the dynamic source files obtained from different target pages are different, and the data types refer to different programming languages or syntaxes. For example, the dynamic source file can be a .vue file, or a .jsx or .tsx file.
[0033] A data processing method corresponding to the data type is selected from a preset data processing library.
[0034] It can be understood that the present embodiment is configured with corresponding data processing methods for dynamic source files of different data types, so that when the dynamic source files are parsed, the accuracy of all codes contained in the parsed dynamic source files is high, avoiding the problem of erroneous parsing or missing parsing that is easy to occur when a general or the same data processing method is used to parse dynamic source files of different programming languages or grammars. Among them, the preset data processing library covers the data processing methods corresponding to all the data types mentioned above. Each data type corresponds to at least one data processing method, which is used to parse the dynamic source files and analyze the codes of different link levels in the dynamic source files as the basis for building the basic syntax tree. For example, in the present embodiment, the vue-loader data processing method is configured for .vue files. Babel-loader and ts-loader data processing methods are configured for .jsx or .tsx files. Further, the data processing method is for dynamic source files of different data types, but its ultimate goal is to generate the basic syntax tree corresponding to the target dynamic component.
[0035] The dynamic source file is parsed using the data processing method to generate a basic syntax tree corresponding to the target dynamic component.
[0036] Specifically, after selecting a data processing method corresponding to the data type from a preset data processing library, the dynamic source file is parsed using the selected data processing method, that is, the code in the dynamic source file is parsed, and then a basic syntax tree is constructed through a depth-first search method according to different link levels between the codes.
[0037] Further, before constructing the basic syntax tree, a syntax tree style can be pre-set, for example, a basic syntax tree is constructed, and the basic syntax tree is constructed based on the code of the dynamic source file of a page, and the basic syntax tree shows the content of each tree node and how to disassemble the dynamic source file. In this way, the code of the dynamic source file and the basic syntax tree can be input to the large model, so that the large model receives and learns the construction relationship between the code of the dynamic source file and the basic syntax tree. In this way, after the dynamic source file is parsed using the data processing method to obtain the dynamic file code, the dynamic file code is input into the above-mentioned large model, so that the large model constructs the basic syntax tree corresponding to the dynamic file code based on the learned construction relationship between the dynamic source file and the basic syntax tree.
[0038] In a specific implementation, the method of parsing the dynamic source file using the data processing method to generate a basic syntax tree corresponding to the target dynamic component includes: The dynamic source file is parsed using the data processing method to obtain a dynamic file code corresponding to the dynamic source file.
[0039] Specifically, after selecting a data processing method corresponding to the data type from a preset data processing library, the selected data processing method can be used to parse the dynamic source file to parse out the dynamic file code in the dynamic source file.
[0040] Tag detection is performed on the dynamic file code to extract the dynamic template code corresponding to the target template tag from the dynamic file code.
[0041] Understandably, for dynamic file codes, there will be multiple tags in the codes at different link levels, such as , <script>,,<template>等。本实施例中主要提取的是在<template>目标模板标签下的动态模板代码,且在<template>下包含的一般是目标页面加载时不会进行渲染的内容,也即这一部分的内容可以由动态调整为静态,减少目标页面加载时的内存消耗。
[0042] 具体地,在利用数据加工方法对动态源文件进行解析,得到动态源文件对应的动态文件代码后,对动态文件代码进行标签检测,即将目标模板标签与动态文件代码中所有标签进行匹配,进而从动态文件代码中提取目标模板标签下的所有动态模板代码。
[0043] 对所述动态模板代码进行编译,生成所述目标动态组件对应的基础语法树。
[0044] 具体地,在对动态文件代码进行标签检测,以从动态文件代码中提取目标模板标签对应的动态模板代码之后,即可对动态模板代码进行编译,也即搜寻该动态模板代码之间的层级关系,构建出基础语法树。进一步地,也可以采用上述内容提及的方法,即将动态源文件的代码和基本语法树输入给大模型,使得大模型接收并学习动态源文件的代码和基本语法树之间的构建关系后,将动态模板代码输入至大模型中,使得大模型基于学习到的动态源文件的代码和基本语法树之间的构建关系,生成动态模板代码对应的基础语法树。
[0045] 在一实施例中,所述基于所述组件配置数据对所述基础语法树进行静态化处理,生成静态语法树,包括:基于所述组件配置数据识别所述基础语法树中待静态化的动态属性数据。
[0046] 具体地,在构建基础语法树后,即可根据组件配置数据对基础语法树中待静态化的动态属性数据进行筛选,从而筛选出组件配置数据中用户需要静态化处理的动态属性数据。
[0047] 获取静态调整工具,并采用所述静态调整工具将所有待静态化的动态属性数据调整为可编辑状态。
[0048] 可理解地,静态调整工具即用于将待静态化的动态属性数据的钩子(hook)转换为允许重写的可编辑状态。
[0049] 对处于所述可编辑状态下的动态属性数据进行静态化处理,以将所有所述动态属性数据转换为静态属性数据后,将所述基础语法树转换为所述静态语法树。
[0050] 具体地,在采用静态调整工具将所有待静态化的动态属性数据调整为可编辑状态之后,对处于可编辑状态下的动态属性数据进行静态化处理,从而将所有可编辑状态下的动态属性数据转换为静态属性数据后,基础语法树即转换为静态语法树。
[0051] 在一具体实施方式中,所述对处于所述可编辑状态下的动态属性数据进行静态化处理,包括:从处于所述可编辑状态下的动态属性数据中筛选出运行动态数据值,并将所述运行动态数据值转换为运行静态数据值。
[0052] 可理解地,本实施例中采用getRuntimeValue(v)方法获取可编辑状态下的动态属性数据中的运行动态数据值,并在静态化过程中,它会被用来将某些运行动态数据值转换为运行静态数据值。其中,运行动态数据值是指目标网页运行时的值,这些值往往不随着目标网页的运行而改变。
[0053] 从处于所述可编辑状态下的动态属性数据中筛选出属于动态处理样式的动态属性数据,并将所述动态属性数据的动态处理样式转换为静态处理样式。
[0054] 可理解地,在静态化过程中,本实施例中采用genStyle(node)方法将动态处理样式的动态属性数据转换为静态处理样式的动态属性数据。
[0055] 从处于所述可编辑状态下的动态属性数据中筛选出属于动态处理类的动态属性数据,并将所述动态属性数据的动态处理类转换为静态处理类。
[0056] 可理解地,在静态化过程中,本实施例中采用genClass(node)将动态处理类的动态属性数据转换为静态处理类的动态属性数据。
[0057] 在另一具体实施方式中,所述对处于所述可编辑状态下的动态属性数据进行静态化处理,还包括:从处于所述可编辑状态下的动态属性数据中筛选出动态指令数据;所述动态指令数据用于生成条件指令的动态属性数据。
[0058] 可理解地,本实施例中的动态指令数据是指动态属性数据下用于执行判断条件(条件指令)的数据,即代码中的if-else条件判断指令对应的代码。如此,即可从处于可编辑状态下的动态属性数据中筛选出包含if-else判断的动态指令数据。
[0059] 从所述组件配置数据中解析出目标条件,并将所述目标条件与每一所述动态指令数据对应的条件指令进行匹配。
[0060] 将与所述目标条件匹配的条件指令的动态指令数据记录为目标指令数据,并对所述目标指令数据进行静态化处理。
[0061] 可以理解地,组件配置数据中涵盖有用户需要静态化处理的动态属性数据,这些动态属性数据中可能不涉及到一些判断条件。即一些动态属性数据对于运营人员 / 开发人员而言不需要进行条件渲染。如此,即可从组件配置数据中解析出目标条件,进而将目标条件与每一动态指令数据对应的条件指令进行匹配。将与目标条件匹配的条件指令对应的动态指令数据记录为目标指令数据,对目标指令数据进行静态化处理即可。本实施例中采用genVIf(node)方法根据组件配置数据决定是否保留某些条件渲染的分支,即筛选出需要静态化处理的目标指令数据。
[0062] 应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本发明实施例的实施过程构成任何限定。
[0063] 在一实施例中,提供一种页面动态属性静态化处理装置,该页面动态属性静态化处理装置与上述实施例中页面动态属性静态化处理方法一一对应。如图3所示,该页面动态属性静态化处理装置包括数据接收模块10、文件解析模块20、静态化处理模块30和代码编译模块40。各功能模块详细说明如下:数据接收模块10,用于接收目标页面的组件配置数据,并根据所述组件配置数据确定所述目标页面中需要静态化处理的目标动态组件;文件解析模块20,用于获取所述目标动态组件对应的动态源文件,并对所述动态源文件进行解析,生成所述目标动态组件对应的基础语法树;静态化处理模块30,用于基于所述组件配置数据对所述基础语法树进行静态化处理,生成静态语法树;代码编译模块40,用于将所述静态语法树转换成静态代码模板,并对所述静态代码模板进行编译,生成所述目标动态组件对应的静态源文件。
[0064] 进一步地,文件解析模块20包括:数据类型确定单元,用于确定所述动态源文件对应的数据类型;加工方法选取单元,用于从预设数据加工库中选取与所述数据类型对应的数据加工方法;文件解析单元,用于利用所述数据加工方法对所述动态源文件进行解析,生成所述目标动态组件对应的基础语法树。
[0065] 进一步地,文件解析单元包括:文件解析子单元,用于利用所述数据加工方法对所述动态源文件进行解析,得到所述动态源文件对应的动态文件代码;标签检测子单元,用于对所述动态文件代码进行标签检测,以从所述动态文件代码中提取目标模板标签对应的动态模板代码;代码编译子单元,用于对所述动态模板代码进行编译,生成所述目标动态组件对应的基础语法树。
[0066] 进一步地,静态化处理模块30包括:数据识别单元,用于基于所述组件配置数据识别所述基础语法树中待静态化的动态属性数据;状态调整单元,用于获取静态调整工具,并采用所述静态调整工具将所有待静态化的动态属性数据调整为可编辑状态;静态化处理单元,用于对处于所述可编辑状态下的动态属性数据进行静态化处理,以将所有所述动态属性数据转换为静态属性数据后,将所述基础语法树转换为所述静态语法树。
[0067] 进一步地,静态化处理单元包括:第一静态化处理子单元,用于从处于所述可编辑状态下的动态属性数据中筛选出运行动态数据值,并将所述运行动态数据值转换为运行静态数据值;第二静态化处理子单元,用于从处于所述可编辑状态下的动态属性数据中筛选出属于动态处理样式的动态属性数据,并将所述动态属性数据的动态处理样式转换为静态处理样式;第三静态化处理子单元,用于从处于所述可编辑状态下的动态属性数据中筛选出属于动态处理类的动态属性数据,并将所述动态属性数据的动态处理类转换为静态处理类。
[0068] 进一步地,静态化处理单元包括:数据筛选子单元,用于从处于所述可编辑状态下的动态属性数据中筛选出动态指令数据;所述动态指令数据用于生成条件指令的动态属性数据;条件匹配子单元,用于从所述组件配置数据中解析出目标条件,并将所述目标条件与每一所述动态指令数据对应的条件指令进行匹配;第四静态化处理子单元,用于将与所述目标条件匹配的条件指令的动态指令数据记录为目标指令数据,并对所述目标指令数据进行静态化处理。
[0069] 进一步地,数据接收模块10包括:组件提取单元,用于从所述目标页面中提取所有基础动态组件;所述基础动态组件中包含基础动态数据;组件剔除单元,用于从所有所述基础动态数据中剔除与所述组件配置数据不匹配的基础动态数据,并将剔除不匹配的基础动态数据后的基础动态组件记录为所述目标动态组件。
[0070] 关于页面动态属性静态化处理装置的具体限定可以参见上文中对于页面动态属性静态化处理方法的限定,在此不再赘述。上述页面动态属性静态化处理装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
[0071] 在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图4所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储上述实施例中页面动态属性静态化处理方法所使用到的数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种页面动态属性静态化处理方法。
[0072] 在一个实施例中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现上述实施例中的页面动态属性静态化处理方法。
[0073] 在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述实施例中的页面动态属性静态化处理方法。
[0074] 本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和 / 或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink) DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。
[0075] 所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。
[0076] 以上所述实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围,均应包含在本发明的保护范围之内。< / script>
Claims
1. A method for staticizing dynamic attributes of a page, characterized in that: include: Receiving component configuration data of a target page, and determining a target dynamic component in the target page that needs to be statically processed according to the component configuration data; Obtaining a dynamic source file corresponding to the target dynamic component, and parsing the dynamic source file to generate a basic syntax tree corresponding to the target dynamic component; Performing static processing on the basic syntax tree based on the component configuration data to generate a static syntax tree; The static syntax tree is converted into a static code template, and the static code template is compiled to generate a static source file corresponding to the target dynamic component.
2. The method for staticizing dynamic attributes of a page according to claim 1, characterized in that: The step of parsing the dynamic source file to generate a basic syntax tree corresponding to the target dynamic component includes: Determine the data type corresponding to the dynamic source file; Selecting a data processing method corresponding to the data type from a preset data processing library; The dynamic source file is parsed using the data processing method to generate a basic syntax tree corresponding to the target dynamic component.
3. The method for staticizing dynamic attributes of a page according to claim 2, characterized in that: The step of parsing the dynamic source file using the data processing method to generate a basic syntax tree corresponding to the target dynamic component includes: Parsing the dynamic source file using the data processing method to obtain a dynamic file code corresponding to the dynamic source file; Performing tag detection on the dynamic file code to extract the dynamic template code corresponding to the target template tag from the dynamic file code; The dynamic template code is compiled to generate a basic syntax tree corresponding to the target dynamic component.
4. The method for staticizing dynamic attributes of a page according to claim 1, characterized in that: The static processing of the basic syntax tree based on the component configuration data to generate a static syntax tree includes: Identify dynamic attribute data to be staticized in the basic syntax tree based on the component configuration data; Obtain a static adjustment tool, and use the static adjustment tool to adjust all dynamic attribute data to be staticized to an editable state; The dynamic attribute data in the editable state is statically processed to convert all the dynamic attribute data in the editable state into static attribute data, and then the basic syntax tree is converted into the static syntax tree.
5. The method for staticizing dynamic attributes of a page according to claim 4, characterized in that: The static processing of the dynamic attribute data in the editable state includes: Filtering out operation dynamic data values from the dynamic attribute data in the editable state, and converting the operation dynamic data values into operation static data values; Filtering out dynamic attribute data belonging to a dynamic processing style from the dynamic attribute data in the editable state, and converting the dynamic processing style of the dynamic attribute data into a static processing style; Dynamic attribute data belonging to a dynamic processing class is screened out from the dynamic attribute data in the editable state, and the dynamic processing class of the dynamic attribute data is converted into a static processing class.
6. The method for staticizing dynamic attributes of a page according to claim 4, characterized in that: The static processing of the dynamic attribute data in the editable state further includes: Filtering out dynamic instruction data from the dynamic attribute data in the editable state; the dynamic instruction data is used to generate dynamic attribute data of the conditional instruction; Parsing a target condition from the component configuration data, and matching the target condition with a conditional instruction corresponding to each of the dynamic instruction data; The dynamic instruction data of the conditional instruction matching the target condition is recorded as the target instruction data, and the target instruction data is statically processed.
7. The method for staticizing dynamic attributes of a page according to claim 1, characterized in that: The step of determining the target dynamic component that needs to be statically processed in the target page according to the component configuration data includes: Extract all basic dynamic components from the target page; the basic dynamic components contain basic dynamic data; The basic dynamic data that does not match the component configuration data is removed from all the basic dynamic data, and the basic dynamic component after the removal of the unmatched basic dynamic data is recorded as the target dynamic component.
8. A device for processing dynamic attributes of a page into static state, characterized in that: include: A data receiving module, used for receiving component configuration data of a target page, and determining a target dynamic component in the target page that needs to be statically processed according to the component configuration data; A file parsing module, used for acquiring a dynamic source file corresponding to the target dynamic component, parsing the dynamic source file, and generating a basic syntax tree corresponding to the target dynamic component; A static processing module, used for performing static processing on the basic syntax tree based on the component configuration data to generate a static syntax tree; The code compilation module is used to convert the static syntax tree into a static code template, and compile the static code template to generate a static source file corresponding to the target dynamic component.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for staticizing dynamic attributes of a page as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for staticizing dynamic attributes of a page as described in any one of claims 1 to 7 is implemented.