Redundant function optimization method and device, electronic equipment and storage medium
By obtaining and comparing interactive function files, determining redundant functions and optimizing them, the problem of function redundancy in front-end code is solved, and access speed and user experience is improved.
Patent Information
- Application Number
- CN202410990275.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-11-22
AI Technical Summary
There is function redundancy in the front-end code, which leads to an increase in the number of codes, slowing access speed, and affecting the user experience. Webpack's Tree-Shaking function cannot effectively handle interactive listening functions.
By obtaining the interactive function file based on the target ref attribute and the target method type, reading and comparing the corresponding interactive function files, determining the redundant function, and writing and introducing the preset component scripts according to the preset module specifications, implementing the redundant function optimization.
It effectively reduces redundant functions, improves the simplification of code and access speed, and improves the user experience.
Smart Images

Figure CN119002875A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a method and device for optimizing a redundant function, an electronic device, and a storage medium. Background Art
[0002] With the development of front-end modularization, JavaScript can also undertake more complex application service development. What comes with it is a sudden increase in project code volume and complex architecture, so the optimization, packaging and compression of front-end code has become a new problem.
[0003] Since the front-end code includes three parts: Html, Css, and JavaScript, it not only includes JavaScript pure functions, but also page interaction monitoring functions. However, the Tree-Shaking function in the above-mentioned Webpack cannot handle interaction monitoring functions. Such functions in the entire code project cannot be marked for streamlining and deletion, which will lead to redundant functions, increased code volume, slower access speed, and affected user experience. Summary of the invention
[0004] The present invention provides a redundant function optimization method, device, electronic device and storage medium, which are mainly intended to solve the problem of redundant functions, increased code volume, slow access speed and affected user experience.
[0005] According to a first aspect of the present disclosure, a method for optimizing a redundant function is provided, comprising:
[0006] Based on the target ref attribute and the target method type, a first interactive function file is obtained in the instance; wherein the name of the interactive function includes the target ref attribute and the target method type;
[0007] Based on the name of the first interactive function file, reading the corresponding second interactive function file in the script module;
[0008] The first interactive function file and the second interactive function file are compared to optimize redundant functions.
[0009] Optionally, before obtaining the first interactive function file in the instance based on the target ref attribute and the target method type, the method further includes:
[0010] Add a ref attribute and a method type to the interaction function name; wherein the ref attribute corresponds to at least one interaction function.
[0011] Optionally, comparing the first interactive function file with the second interactive file and optimizing redundant functions includes:
[0012] Determine an interaction function in the intersection of the first interaction function file and the second interaction function file as a valid interaction function;
[0013] Determining that an interaction function in a difference set of the first interaction function file with respect to the second interaction file is an abnormal interaction function;
[0014] Determine that the interaction functions in the difference set of the second interaction function file with respect to the first interaction file are redundant interaction functions.
[0015] Optionally, after determining that the interaction function in the difference set of the second interaction function file with respect to the first interaction file is a redundant interaction function, the method further includes:
[0016] Compile the redundant interactive function according to the preset module specification to obtain a redundant function file;
[0017] The residual function file is introduced into the script of the preset component.
[0018] Optionally, comparing the first interactive function file with the second interactive file and optimizing redundant functions includes:
[0019] The first interaction function file and the second interaction file are compared and verified based on a preset verification function.
[0020] According to a second aspect of the present disclosure, there is provided a redundant function optimization device, comprising:
[0021] An acquisition unit, configured to acquire a first interactive function file in an instance based on a target ref attribute and a target method type; wherein the name of the interactive function includes the target ref attribute and the target method type;
[0022] A reading unit, configured to read a corresponding second interactive function file in a script module based on the name of the first interactive function file;
[0023] The optimization unit is used to compare the first interactive function file and the second interactive function file and optimize redundant functions.
[0024] Optionally, the device further comprises:
[0025] An adding unit is used to add a ref attribute and a method type to an interactive function name before the acquiring unit acquires the first interactive function file in the instance based on the target ref attribute and the target method type; wherein the ref attribute corresponds to at least one interactive function.
[0026] Optionally, the optimization unit is further used for:
[0027] Determine an interaction function in the intersection of the first interaction function file and the second interaction function file as a valid interaction function;
[0028] Determining that an interaction function in a difference set of the first interaction function file with respect to the second interaction file is an abnormal interaction function;
[0029] Determine that the interaction functions in the difference set of the second interaction function file with respect to the first interaction file are redundant interaction functions.
[0030] Optionally, the device further comprises:
[0031] a writing unit, configured to write the redundant interaction function according to a preset module specification to obtain a redundant function file after the optimization unit determines that the interaction function in the difference set of the second interaction function file with respect to the first interaction file is a redundant interaction function;
[0032] The arrangement unit is used to introduce the redundant function file into the script of the preset component.
[0033] Optionally, the optimization unit is further used for:
[0034] The first interaction function file and the second interaction file are compared and verified based on a preset verification function.
[0035] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0036] at least one processor; and
[0037] a memory communicatively connected to the at least one processor; wherein,
[0038] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect.
[0039] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the first aspect.
[0040] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method as described in the first aspect above.
[0041] The present disclosure provides a method, device, electronic device and storage medium for optimizing redundant functions. The main technical solutions include: based on the target ref attribute and the target method type, obtaining a first interactive function file in an instance; wherein the name of the interactive function includes the target ref attribute and the target method type; based on the name of the first interactive function file, reading the corresponding second interactive function file in the script module; comparing the first interactive function file and the second interactive file to optimize the redundant function. Compared with the related art, the embodiment of the present application obtains an interactive function set by combining the monitoring characteristics of the function in vue, and then verifies and compares to obtain a new redundant function reference, thereby optimizing the redundant function.
[0042] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0044] Figure 1 A schematic diagram of a flow chart of a redundant function optimization method provided by an embodiment of the present disclosure;
[0045] Figure 2 A schematic diagram of a flow chart of a redundant function optimization method provided by an embodiment of the present disclosure;
[0046] Figure 3 A schematic diagram of the structure of a redundant function optimization device provided in an embodiment of the present disclosure;
[0047] Figure 4 A schematic diagram of the structure of a redundant function optimization device provided in an embodiment of the present disclosure;
[0048] Figure 5 A schematic block diagram of an exemplary electronic device provided for an embodiment of the present disclosure. DETAILED DESCRIPTION
[0049] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0050] The following describes the optimization method, device, electronic device and storage medium of the redundant function according to the embodiments of the present disclosure with reference to the accompanying drawings.
[0051] Figure 1 A flowchart of a redundant function optimization method provided in an embodiment of the present disclosure.
[0052] like Figure 1 As shown, the method comprises the following steps:
[0053] Step 101, based on the target ref attribute and the target method type, obtain a first interactive function file in the instance; wherein the name of the interactive function includes the target ref attribute and the target method type.
[0054] In some embodiments, since the front-end code includes three major parts: Html, Css, and JavaScript, it not only includes JavaScript pure functions, but also includes page interaction listening functions; in the Vue development project, the interactive functions in the HTML template are all represented by v:on or @ symbols, including Html's own click, input, blur, focus and other functions, as well as user-defined functions.
[0055] In some embodiments, during the interaction function definition stage, a ref attribute and a method type are added to the template. After the interaction function definition is completed, the target ref attribute and the target method type can be used to directly search and determine the required first interaction function file, which contains the interaction function corresponding to the target ref attribute and the target method type.
[0056] Step 102: Based on the name of the first interactive function file, read the corresponding second interactive function file in the script module.
[0057] In some embodiments, the first interactive function file is the interactive function in the user interaction page, and the form of the first interactive function in the user interaction page may be an input box, a link, a button, etc. Specifically, the embodiments of the present application do not limit this.
[0058] In some embodiments, the second interactive function file is the interactive function in the bottom layer, which is used to respond to user operations on input boxes, links, and buttons in the user interaction page, such as jumping to a specified page, performing calculations based on user input, or retrieving certain data, etc. Specifically, the embodiments of the present application are not limited to this.
[0059] Step 103: compare the first interactive function file and the second interactive function file, and optimize redundant functions.
[0060] Following the description of the above application embodiment, the functions in the first interactive function file correspond to the functions in the second interactive file one by one. When the user's operation in the user interaction page triggers the function in the first interactive function file, if the function exists in the second interactive file, feedback can be given to the operation. When the function in the first interactive file does not have a corresponding function in the second interactive file, the function cannot be implemented normally, such as retrieving data, performing calculations, etc. In the embodiment of the present application, the function in the second interactive file that does not have a corresponding matching function in the first interactive file is optimized.
[0061] The optimization method of redundant functions provided by the present disclosure mainly includes the following technical solutions: based on the target ref attribute and the target method type, obtaining the first interactive function file in the instance; wherein the name of the interactive function includes the target ref attribute and the target method type; based on the name of the first interactive function file, reading the corresponding second interactive function file in the script module; comparing the first interactive function file and the second interactive file, and optimizing the redundant function. Compared with the related art, the embodiment of the present application obtains the interactive function set by combining the monitoring characteristics of the function in vue, and then verifies and compares to obtain a new redundant function reference, thereby optimizing the redundant function.
[0062] In some embodiments, before obtaining the first interactive function file in the instance based on the target ref attribute and the target method type in step 101, the method further includes:
[0063] Add a ref attribute and a method type to the interaction function name; wherein the ref attribute corresponds to at least one interaction function.
[0064] Add the ref attribute to the HTML template element that needs a custom interaction function. This attribute is the attribute of the element itself in the Vue template, which is an object containing all the attributes of the element. For example:
[0065] <el-button ref=“testButton”@cl ick=“testBtn” / >
[0066] Then customize the attribute [type]_funcName of the interaction function, where type indicates the type of interaction method. For example:
[0067] <el-buttonref=“testButton”click_funcName=“testBtn”@click=“testBtn” / >.
[0068] After completing the above steps, you can get the name of the interactive function testBtn in the vue instance vm, and the attribute path is: vm.$refs.testButton[0].$attrs.click_funcName
[0069] After getting the interactive function, output the [componentName]_eventFunctions.json file. Because Vue is a component-based development, all files have a component name. When naming the interactive function, include componentName to facilitate the next step of matching verification. The content of this file is an object, containing the key-value pair of the interactive function {key: function name, value: function type}, where the function name is the user-defined method name for interaction, and the function type is used to distinguish whether the function is a user-defined function or a JavaScript built-in function.
[0070] In some embodiments, when the comparison is performed in step 103, a plurality of comparison results may appear, and the comparison results represent the state information of the function; Figure 2 , Figure 2 A flowchart of a redundant function optimization method provided by an embodiment of the present disclosure includes:
[0071] Step 201: Determine that an interaction function in the intersection of the first interaction function file and the second interaction file is a valid interaction function.
[0072] In some embodiments, the intersection includes some functions that are associated with the functions in the first interactive function file and the functions in the second interactive file, that is, the functions can receive the interactive instructions issued by the user in the user interaction interface and can make correct feedback. That is, the interactive functions in the intersection are determined to be valid interactive functions.
[0073] Step 202: Determine that an interaction function in a difference set between the first interaction function file and the second interaction file is an abnormal interaction function.
[0074] In some embodiments, the difference number between the first interactive function file and the second interactive file is a set of functions in the first interactive function file that have no associated functions in the second interactive file, that is, it exists in the user interface but does not exist in the underlying logic. It can receive interactive instructions issued by the user in the user interaction interface, but cannot make correct feedback for the interactive instructions, that is, it marks this part of the interactive function as an abnormal interactive function to remind subsequent maintenance changes to this part of the function.
[0075] Step 203: Determine that the interaction functions in the difference set of the second interaction function file with respect to the first interaction file are redundant interaction functions.
[0076] In some embodiments, the second interactive function file is a difference set of the first interactive file, that is, a set of functions in the second interactive function file that are not associated with the first interactive file, that is, it exists in the user interface part but exists in the underlying logic, and cannot receive interactive instructions issued by the user in the user interaction interface, but has the function of providing feedback on the interactive instructions; that is, this part of the interactive function is marked as a redundant interactive function to remind subsequent optimization and deletion of this part of the function.
[0077] In some embodiments, after determining that the interaction function in the difference set of the second interaction function file with respect to the first interaction file is a redundant interaction function, the method further includes:
[0078] Compile the redundant interactive function according to the preset module specification to obtain a redundant function file;
[0079] The residual function file is introduced into the script of the preset component.
[0080] Combined with the Tree-Shaking principle of webpack, the target function is output in a standardized manner, and these invalid functions are deleted without affecting the code logic. The specific process is as follows: After obtaining the invalid function, output [component]_invalid_eventFuncs.js, which writes each function according to the module specification of ES6; introduce the output invalid function js file into the script of the component component. Next, webpack will mark it as an invalid reference during the static analysis code packaging process and compress and delete the invalid function.
[0081] Optionally, comparing the first interactive function file with the second interactive file and optimizing redundant functions includes:
[0082] The first interaction function file and the second interaction file are compared and verified based on a preset verification function.
[0083] According to the component name of the interactive function, the corresponding json file can be read in the script module of the vue file, and the verification function checkEventFunctions in the tool class can be called to perform function comparison verification on the specified file.
[0084] Corresponding to the above-mentioned redundant function optimization method, the present invention also provides a redundant function optimization device. Since the device embodiment of the present invention corresponds to the above-mentioned method embodiment, details not disclosed in the device embodiment can be referred to the above-mentioned method embodiment, and will not be repeated in the present invention.
[0085] Figure 3A schematic diagram of a redundant function optimization device provided by an embodiment of the present disclosure is shown in FIG. Figure 3 As shown, including:
[0086] The acquisition unit 31 is used to acquire a first interactive function file in the instance based on a target ref attribute and a target method type; wherein the name of the interactive function includes the target ref attribute and the target method type;
[0087] A reading unit 32, configured to read a corresponding second interactive function file in a script module based on the name of the first interactive function file;
[0088] The optimization unit 33 is used to compare the first interaction function file and the second interaction file, and optimize redundant functions.
[0089] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 4 As shown, the device also includes:
[0090] The adding unit 34 is used to add a ref attribute and a method type to the interactive function name before the acquiring unit 31 acquires the first interactive function file in the instance based on the target ref attribute and the target method type; wherein the ref attribute corresponds to at least one interactive function.
[0091] The redundant function optimization device provided by the present disclosure has the following main technical solutions: based on the target ref attribute and the target method type, a first interactive function file is obtained in an instance; wherein the name of the interactive function contains the target ref attribute and the target method type; based on the name of the first interactive function file, a corresponding second interactive function file is read in a script module; the first interactive function file and the second interactive file are compared to optimize the redundant function. Compared with the related art, the embodiment of the present application obtains an interactive function set by combining the monitoring characteristics of the function in vue, and then verifies and compares to obtain a new redundant function reference, thereby optimizing the redundant function.
[0092] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 4 As shown, the optimization unit 33 is also used for:
[0093] Determine an interaction function in the intersection of the first interaction function file and the second interaction function file as a valid interaction function;
[0094] Determining that an interaction function in a difference set of the first interaction function file with respect to the second interaction file is an abnormal interaction function;
[0095] Determine that the interaction functions in the difference set of the second interaction function file with respect to the first interaction file are redundant interaction functions.
[0096] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 4 As shown, the device also includes:
[0097] A writing unit 35 is used to write the redundant interaction function according to a preset module specification to obtain a redundant function file after the optimization unit 33 determines that the interaction function in the difference set of the second interaction function file with respect to the first interaction file is a redundant interaction function;
[0098] The arrangement unit 36 is used to introduce the redundant function file into the script of the preset component.
[0099] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 4 As shown, the optimization unit 33 is also used for:
[0100] The first interaction function file and the second interaction file are compared and verified based on a preset verification function.
[0101] It should be noted that the above explanation of the method embodiment is also applicable to the device of the embodiment of the present disclosure, and the principle is the same, which is no longer limited in the embodiment of the present disclosure.
[0102] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0103] Figure 5 A schematic block diagram of an example electronic device 400 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0104] like Figure 5As shown, the device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 402 or a computer program loaded from a storage unit 408 to a RAM (Random Access Memory) 403. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An I / O (Input / Output) interface 405 is also connected to the bus 404.
[0105] A number of components in the device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0106] The computing unit 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 401 performs the various methods and processes described above, such as the optimization method of the redundant function. For example, in some embodiments, the optimization method of the redundant function may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the computing unit 401, one or more steps of the method described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to execute the aforementioned optimization method of the redundant function in any other appropriate manner (for example, by means of firmware).
[0107] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0108] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0109] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a RAM, a ROM, an EPROM (Electrically Programmable Read-Only-Memory) or a flash memory, an optical fiber, a CD-ROM (Compact Dis sc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0110] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0111] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.
[0112] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0113] It should be noted that artificial intelligence is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), and includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.
[0114] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0115] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for optimizing redundant functions, characterized in that: include: Based on the target ref attribute and the target method type, a first interactive function file is obtained in the instance; wherein the name of the interactive function includes the target ref attribute and the target method type; Based on the name of the first interactive function file, reading the corresponding second interactive function file in the script module; The first interactive function file and the second interactive function file are compared to optimize redundant functions.
2. The method according to claim 1, characterized in that Before obtaining the first interactive function file in the instance based on the target ref attribute and the target method type, the method further includes: Add the ref attribute and method type to the interactive function name; The property corresponds to at least one interaction function.
3. The method according to claim 1, characterized in that The comparing the first interactive function file and the second interactive file to optimize the redundant functions includes: Determine an interaction function in the intersection of the first interaction function file and the second interaction function file as a valid interaction function; Determining that an interaction function in a difference set of the first interaction function file with respect to the second interaction file is an abnormal interaction function; Determine that the interaction functions in the difference set of the second interaction function file with respect to the first interaction file are redundant interaction functions.
4. The method according to claim 3, characterized in that After determining that the interaction function in the difference set of the second interaction function file with respect to the first interaction file is a redundant interaction function, the method further includes: Compile the redundant interactive function according to the preset module specification to obtain a redundant function file; The residual function file is introduced into the script of the preset component.
5. The method according to claim 1, characterized in that The comparing the first interactive function file and the second interactive file to optimize the redundant functions includes: The first interaction function file and the second interaction file are compared and verified based on a preset verification function.
6. A redundant function optimization device, characterized in that: include: An acquisition unit, configured to acquire a first interactive function file in an instance based on a target ref attribute and a target method type; wherein the name of the interactive function includes the target ref attribute and the target method type; A reading unit, configured to read a corresponding second interactive function file in a script module based on the name of the first interactive function file; The optimization unit is used to compare the first interactive function file and the second interactive function file and optimize redundant functions.
7. The device according to claim 6, characterized in that The device also includes: An adding unit is used to add a ref attribute and a method type to an interactive function name before the acquiring unit acquires the first interactive function file in the instance based on the target ref attribute and the target method type; wherein the ref attribute corresponds to at least one interactive function.
8. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.
9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-5.
10. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 5.
