Component processing method, device and equipment
By sharing engine instances created in the host application in the applet, the problem of high resource consumption of applets is solved and the page loading speed is improved.
Patent Information
- Application Number
- CN202110875159.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-30
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2041-07-30
AI Technical Summary
When applets include map components, they need to create multiple map engine instances, resulting in large resource consumption and slow page loading.
By creating an engine instance of the target view in the host application and sharing the engine instance between different pages of the parasitic application, ensuring that the engine instance is consistent with the target component types, such as map components, reduce resource consumption of native components.
It effectively reduces the resource consumption of native components in parasitic applications, improves page loading speed, and improves user experience.
Smart Images

Figure CN113741764B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a component processing method, device and equipment. Background Art
[0002] A mini program is an application that does not need to be downloaded and installed and relies on a host application to run.
[0003] Currently, the pages of mini programs can include native components that require the host application to participate in processing. For example, if a native component is a map component, a map engine instance needs to be created when displaying the page. And if another page in the mini program also includes a map component, another map engine instance needs to be created when displaying the other page.
[0004] However, the above method has the problem that the mini program consumes a lot of resources and the page loads slowly. Summary of the invention
[0005] The embodiments of the present application provide a component processing method, device and equipment to solve the problems of large resource consumption and slow page loading of mini programs in the prior art.
[0006] In a first aspect, an embodiment of the present application provides a component processing method, including:
[0007] Creating a corresponding engine instance for a target view; the target view is a view of a component in a host application, or a view of a first native component in a first page of a parasitic application;
[0008] When the parasitic application needs to display the second page of the second native component, a native view of the second native component is created, and the engine instance is shared with the second native component through the native view; the first native component and the second native component are both native target components, and the target component is consistent with the type of the target view.
[0009] In a second aspect, an embodiment of the present application provides a component processing device, including:
[0010] A creation module, used to create a corresponding engine instance for a target view; the target view is a view of a component in a host application, or a view of a first native component in a first page of a parasitic application;
[0011] A sharing module is used to create a native view of the second native component when the parasitic application needs to display a second page including a second native component, and share the engine instance to the second native component through the native view; the first native component and the second native component are both native target components, and the target component is consistent with the type of the target view.
[0012] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory, and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method described in any one of the first aspects.
[0013] In a fourth aspect, an embodiment of the present application provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the steps of any method described in the first aspect.
[0014] An embodiment of the present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, the computer program includes at least one section of code, and the at least one section of code can be executed by a computer to control the computer to execute the method as described in any one of the first aspects.
[0015] In an embodiment of the present application, a native target component in a page of a parasitic application can share an engine instance created for a target view of a component in a host application, or a target view of a native target component in another page of a parasitic application, and the target view is consistent with the type of the target component. For example, a native map component in a page of a parasitic application can share an engine instance created for a map view of a component in a host application, or a map view of a native map component in another page of a parasitic application. By sharing the engine instance created for the target view of other components through the native target component in the parasitic application, the resource consumption of the native components in the parasitic application is reduced, and the page loading speed of the parasitic application is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0017] Figure 1 A schematic diagram of a flow chart of a component processing method provided in an embodiment of the present application;
[0018] Figure 2A schematic diagram of the home page of a charging station applet provided in an embodiment of the present application;
[0019] Figure 3 An embodiment of the present application provides Figure 2 A schematic diagram of the layers of the home page shown;
[0020] Figure 4 A schematic diagram of the structure of a component processing device provided in one embodiment of the present application;
[0021] Figure 5 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0023] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms of "a", "said", and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two, but does not exclude the inclusion of at least one.
[0024] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0025] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0026] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such a product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including the elements.
[0027] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0028] In order to facilitate those skilled in the art to understand the technical solution provided by the embodiments of the present application, the technical environment in which the technical solution is implemented is described below.
[0029] Taking the native component as an example, the processing method of the native component in the mini-program that is more commonly used in the related art mainly includes that if a page of the mini-program includes a map component, a map engine instance needs to be created when the page is displayed. And, if another page in the mini-program also includes a map component, another map engine instance needs to be created when the other page is displayed. However, creating a map engine instance consumes more resources, resulting in slower loading of the mini-program page. Therefore, a component processing method that can reduce the resource consumption of the mini-program and increase the page loading speed of the mini-program is urgently needed in the related art.
[0030] Based on actual technical requirements similar to those described above, the component processing method provided in this application can use technical means to reduce the resource consumption of the mini program and improve the page loading speed of the mini program.
[0031] The component processing method provided in the embodiment of the present application can be applied to any type of electronic device capable of deploying an application (Application, APP). An application capable of serving as a host for other applications, i.e., a host application, can be deployed in an electronic device. An application that is parasitic in a host application and relies on the host application to run is a parasitic application. Among them, the parasitic application includes native components that require the host application to participate in processing, and the parasitic application may also include non-native components that do not require the host application to participate in processing. In one embodiment, the parasitic application may specifically be a mini-program.
[0032] It should be noted that the component in the embodiment of the present application refers to a simple encapsulation of data and methods. In other specific application scenarios, it can also be called a control, a part, etc.
[0033] In order to reduce the resource consumption of parasitic applications and improve the page loading speed of parasitic applications, in an embodiment of the present application, a native target component in a page of a parasitic application can share an engine instance created for a target view of a component in a host application, or a target view of a native target component in another page of the parasitic application, and the target view is consistent with the type of the target component. For example, a native map component in a page of a parasitic application can share an engine instance created for a map view of a component in a host application, or a map view of a native map component in another page of the parasitic application. By sharing the engine instance created for the target view of other components through the native target component in the parasitic application, the resource consumption of the native components in the parasitic application is reduced and the page loading speed of the parasitic application is improved.
[0034] It should be noted that the embodiments of the present application are mainly illustrated by taking the parasitic application as a mini-program as an example.
[0035] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0036] Figure 1 This is a flow chart of a component processing method provided by an embodiment of the present application. The execution subject of this embodiment may be the aforementioned electronic device. Figure 1 As shown, the method of this embodiment may include:
[0037] Step 11, creating a corresponding engine instance for a target view; the target view is a view of a component in a host application, or a view of a first native component in a first page of a parasitic application;
[0038] Step 12, when the parasitic application needs to display a second page including a second native component, a native view of the second native component is created, and the engine instance is shared to the second native component through the native view; the first native component and the second native component are both native target components, and the target component is of the same type as the target view.
[0039] In an embodiment of the present application, a native target component in the second page of a parasitic application can share an engine instance created for a target view of a component in the host application of the parasitic application, or can share an engine instance created for a target view of a native target component in the first page of the parasitic application, and the target view is of the same type as the target component. The engine instance is used to provide engine services, and it can be understood that after the engine instance created for the target view is shared with the second native component, the engine instance created for the target view can be used to provide engine services to the second native component.
[0040] Among them, the target component can be flexibly selected according to the needs. In one embodiment, a native component whose corresponding engine instance consumes more resources in the parasitic application can be selected as the target component. Exemplarily, the target component can be a map component. Based on this, the native map component in the second page of a parasitic application can share the engine instance created for the map view (MapView) of the component in the host application of the parasitic application, or can share the engine instance created for the map view of the native map component in the first page of the parasitic application. In this case, the engine instance created corresponding to the target view is a map engine instance for providing map engine services. It should be noted that for the sake of convenience, the following mainly takes the target component as a map component as an example for illustration.
[0041] When the target view is a view of a component in the host application, the engine instance created for the target view of the component in the host application can be shared with the native target component (ie, the second native component) in the second page of the parasitic application.
[0042] Example 1: When a map application needs to display its homepage, it can create a map view of a component in the homepage, and create a corresponding map engine instance for the map view. Later, when the charging station applet that is parasitic in the map application needs to display a homepage including a native map component, it can create a native view of the map component, and share the map engine instance created for the map view with the map component through the native view. Among them, the map application is the host application, the charging station applet is the parasitic application, the homepage of the charging station applet is the second page, and the native map component included in the homepage of the charging station applet is the second native component.
[0043] When the target view is the view of the first native component in the first page of the parasitic application, it is possible to share the engine instance created for the native target component (i.e., the first native component) in the first page of the parasitic application with the native target component (i.e., the second native component) in the second page of the parasitic application.
[0044] Example 2: When a map-related applet in a host application needs to display page a including a native map component 1, a native view of the map component 1 can be created, a map view can be further created under the native view, and a corresponding map engine instance can be created for the map view. Afterwards, when the map-related applet needs to display page b including a native map component 2, a native view of the map component 2 can be created, and the map engine instance created for the map view of the map component 1 can be shared with the map component 2 through the native view of the map component 2. Among them, the map-related applet is a parasitic application, page a of the map-related applet is recorded as the first page, the map component 1 in page a is the first native component, page b of the map-related applet is the second page, and the map component 2 in page b is the second native component.
[0045] In one embodiment, the engine instance created corresponding to the target view is shared with the second native component through the native view of the second native component, which may specifically include: directly sharing the engine instance created corresponding to the target view with the second native component through the native view of the second native component.
[0046] In another embodiment, the engine instance created for the target view is shared with the second native component through the native view of the second native component, which may specifically include: adapting the target view to the second native component through the native view of the second native component to achieve sharing of the engine instance created for the target view with the second native component. It should be noted that the relationship between the engine instance and the target view is that the target view is the encapsulation of the engine instance, and the engine is at a lower level. Taking the map engine and the map instance as an example, the map view is the encapsulation of the map engine. The target view is adapted to the second native component through the native view, so that when the engine instance is shared, there is no need to rewrite the encapsulation of the engine instance, which is conducive to simplifying the implementation.
[0047] Exemplarily, adapting the target view to the second native component through the native view of the second native component may specifically include: establishing a transfer relationship between the target view and the second native component through the native view of the second native component to pass component parameters for the second native component to the target view, so as to trigger the engine instance to provide engine services to the second native component according to the component parameters of the second native component. Since the engine instance is created for the target view, the target view and the engine instance have the ability to pass parameters, so by establishing a transfer relationship between the target view and the second native component, the component parameters for the second native component can be passed to the target view, so that the target view passes them to the engine instance created for the target view, so as to trigger the engine instance to provide engine services to the second native component according to the component parameters of the second native component, thereby achieving the sharing of the engine instance created for the target view with the second native component.
[0048] The component parameters of the second native component may be any type of parameters that the second native component needs to pass to the engine instance, and may be flexibly implemented according to requirements. Exemplarily, the component parameters of the second native component may include any one or more of the following: component parameters triggered by an event, component parameters triggered by a function call, or component parameters triggered by an initial display.
[0049] For example, based on Example 1, assuming that when the homepage of the charging station applet is displayed, a gesture event of the user for the native map component in the homepage of the charging station applet is obtained, then the response process to the gesture event can be, for example: the native map component in the homepage of the charging station applet can pass the gesture parameters corresponding to the obtained gesture event to the map view of the component in the page of the map application through the native view of the map component. The map view can convert the gesture parameters into parameters recognizable by the engine instance, and pass the converted parameters recognizable by the engine instance to the map engine instance created for the map view. The map engine instance can convert the received parameters recognizable by the engine instance into real longitude and latitude parameters, and render and display the map according to the longitude and latitude parameters.
[0050] For another example, based on Example 2, assuming that when displaying page b of a map-related applet, a route query operation from location A to location B input by the user is obtained, the response process for the route query operation can be, for example: the map-related applet can calculate a series of longitude and latitude coordinates of the corresponding route based on the route query operation, and pass this series of longitude and latitude coordinates and parameters such as line width to the native map component 2 in page b through a function call. The map component 2 passes it to the map view of the native map component 1 in page a of the map-related applet through its native view. The map view can pass these parameters to the map engine instance created for the map view, and the map engine instance can render and display the map according to these parameters.
[0051] Optionally, the transfer relationship between the target view and the second native component established by the native view of the second native component can also be used for the target view to obtain the parameters returned by the engine instance established for it, and pass the parameters to the second native component. Thus, a parameter transfer relationship from the engine instance of the target view to the second target component is provided, so that the parasitic application can obtain the parameters returned by the engine instance of the target view.
[0052] It should be noted that since the engine instance is created for the target view, the content that the engine instance needs to display can be presented on the component to which the target view belongs. Therefore, after the engine instance created corresponding to the target view is shared with the second native component, the display content that should have been presented by the second native component can be converted to be presented by the component to which the target view belongs.
[0053] Based on this, when the layer of the native view of the second native component is located above the layer of the target view, and the area of the native view at least partially overlaps with the area of the target view, the method provided by the embodiment of the present application may also include: setting the background of the native view of the second native component to be transparent. This can avoid the problem that the user cannot clearly see the content presented on the component to which the target view belongs due to the non-transparent background of the native view of the second native component, which is conducive to improving the user experience.
[0054] Further optionally, when there are other views between the native view of the second native component and the target view, the method provided in the embodiment of the present application may also include: setting the background of the other views to be transparent. Taking the parasitic application as a small program implemented based on web development technology as an example, the other views between the native view of the second native component and the target view may include a web view (WebView). By setting the other views between the native view of the second native component and the target view to be transparent, the problem that the user cannot see the content presented on the component to which the target view belongs due to the non-transparent background of the other views between the native view of the second native component and the target view can be avoided, which is conducive to improving the user experience.
[0055] Optionally, the method of the embodiment of the present application may also include: when jumping from the page displaying the component to which the target view belongs to to the second page, saving the current component parameters of the component to which the target view belongs; and, when jumping from the second page displaying the page displaying the component to which the target view belongs to, triggering the engine instance created corresponding to the target view to provide engine services to the component to which the target view belongs according to the component parameters of the component to which the target view belongs. Thereby, when jumping back to displaying the page including the component to which the target view belongs, the display content of the component to which the target view belongs can remain unchanged. Among them, the saved component parameters of the component to which the target view belongs can be regarded as the component parameters of the component to which the target view belongs triggered by the initial display. When the target view is a view of a component in the host application, the page of the component to which the target view belongs can specifically be a page of the host application including the component; when the target view is a view of the first native component in the first page of the parasitic application, the page of the component to which the target view belongs can specifically be the first page.
[0056] Similarly, the method provided by the embodiment of the present application may also include: when jumping back from the second page to display the page including the component to which the target view belongs, saving the current component parameters of the second native component; and, when jumping again from the page including the component to which the target view belongs to display the second page, triggering the engine instance created corresponding to the target view to provide engine services to the second native component according to the saved component parameters of the second native component. Thereby, when jumping back to display the second page, the display content of the second native component can remain unchanged. Among them, the saved component parameters of the second native component can be regarded as the component parameters of the second native component triggered by the initial display.
[0057] Assume that the host application is a map application, the parasitic application is a charging station applet that is parasitic in the map application, and the homepage of the charging station applet includes a native map component. If the user opens the charging station applet in the map application, the charging station applet page displayed to the user may be, for example, as follows: Figure 2 As shown, Figure 2 The layer structure can be as follows Figure 3 Reference Figure 2 and Figure 3 , the map view (referred to as the MainMap) layer 31 of the component in the map application can be located at the bottom of the page stack, the web view layer 32 of the charging station applet homepage can be located above the MainMap layer 31, the native view 33 of the map component of the charging station applet homepage can be located above the web view layer 32, and the views 34 of other components in the charging station applet homepage can be located above the native view 33 of the map component in the charging station applet homepage. Combined Figure 2 and Figure 3 It can be seen that after the engine instance of the main image is shared with the map component of the charging station applet, the display content that should have been presented by the map component of the charging station applet is changed to be presented by the component to which the main image of the map application belongs.
[0058] It should be noted that Figure 3 The example below takes the same-layer rendering technology to render native components in a mini program.
[0059] In the component processing method provided in the embodiment of the present application, a native target component in a page of a parasitic application can share an engine instance created for a target view of a component in a host application, or a target view of a native target component in another page of a parasitic application, and the target view is consistent with the type of the target component. For example, a native map component in a page of a parasitic application can share an engine instance created for a map view of a component in a host application, or a map view of a native map component in another page of a parasitic application. By sharing the engine instance created for the target view of other components through the native target component in the parasitic application, the resource consumption of the native components in the parasitic application is reduced, and the page loading speed of the parasitic application is improved.
[0060] Figure 4 A schematic diagram of the structure of a component processing device provided in an embodiment of the present application; see attached Figure 4 As shown, this embodiment provides a component processing device, which can execute the above-mentioned component processing method. Specifically, the component processing device may include:
[0061] A creation module 41 is used to create a corresponding engine instance for a target view; the target view is a view of a component in a host application, or a view of a first native component in a first page of a parasitic application;
[0062] The sharing module 42 is used to create a native view of the second native component and share the engine instance to the second native component through the native view when the parasitic application needs to display a second page including the second native component; the first native component and the second native component are both native target components, and the target component is consistent with the type of the target view.
[0063] Optionally, the sharing module 42 is used to share the engine instance with the second native component through the native view, specifically including: adapting the target view to the second native component through the native view to achieve sharing of the engine instance with the second native component.
[0064] Optionally, the sharing module 42 is used to adapt the target view to the second native component through the native view, specifically including: establishing a transfer relationship between the target view and the second native component through the native view to pass component parameters for the second native component to the target view to trigger the engine instance to provide engine services to the second native component according to the component parameters.
[0065] Optionally, the component parameters may include any one or more of the following: component parameters triggered by an event, component parameters triggered by a function call, or component parameters triggered by an initial display.
[0066] Optionally, the layer of the native view is located above the layer of the target view, and the area of the native view at least partially overlaps with the area of the target view; the sharing module 42 is also used to: and set the background of the native view to be transparent.
[0067] Optionally, there are other views between the native view and the target view; the sharing module 42 is further used to: set the background of the other views to be transparent.
[0068] Optionally, the device further includes a jump module, configured to:
[0069] When jumping from displaying the page including the component to which the target view belongs to to displaying the second page, saving the current component parameters of the component to which the target view belongs; and when jumping back from displaying the second page to displaying the page including the component to which the target view belongs, triggering the engine instance to provide engine services to the component to which the target view belongs according to the saved component parameters of the component to which the target view belongs.
[0070] Optionally, the target view is a map view, the target component is a map component, and the engine instance is a map engine instance for providing map engine services.
[0071] Figure 4 The device shown can perform Figure 1 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figure 1 The implementation process and technical effects of this technical solution refer to Figure 1 The description in the illustrated embodiment will not be repeated here.
[0072] In one possible implementation, Figure 4 The structure of the decision-making device shown can be implemented as an electronic device. Figure 5 As shown, the electronic device may include: a processor 51 and a memory 52. The memory 52 is used to store the electronic device to perform the above Figure 1 The processor 51 is configured to execute the program stored in the memory 52 for the component processing method provided in the illustrated embodiment.
[0073] The program includes one or more computer instructions, wherein when the one or more computer instructions are executed by the processor 51, the following steps can be implemented:
[0074] Creating a corresponding engine instance for a target view; the target view is a view of a component in a host application, or a view of a first native component in a first page of a parasitic application;
[0075] When the parasitic application needs to display a second page including a second native component, a native view of the second native component is created, and the engine instance is shared with the second native component through the native view; the first native component and the second native component are both native target components, and the target component is of the same type as the target view.
[0076] Optionally, the processor 51 is further configured to execute the aforementioned Figure 1 All or part of the steps in the illustrated embodiments.
[0077] The structure of the electronic device may further include a communication interface 53 for the electronic device to communicate with other devices or a communication network.
[0078] In addition, the present application embodiment provides a computer storage medium for storing computer software instructions used by the electronic device, which includes instructions for executing the above Figure 1 The procedures involved in the component processing method in the method embodiment shown.
[0079] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0080] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a computer product, and the present application can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0081] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processor of the computer or other programmable device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0082] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0083] These computer program instructions may also be loaded onto a computer or other programmable device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0084] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0085] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0086] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media 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 disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0087] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A component processing method, wherein: The method comprises: Creating a corresponding engine instance for a target view; the target view is a view of a component in a host application, or a view of a first native component in a first page of a parasitic application; When the parasitic application needs to display a second page including a second native component, a native view of the second native component is created, and the engine instance is shared with the second native component through the native view, and the engine instance created corresponding to the target view can be used to provide engine services to the second native component, wherein the relationship between the engine instance and the target view is that the target view is an encapsulation of the engine instance, and a transfer relationship between the target view and the second native component is established through the native view to achieve sharing of the engine instance with the second native component; The first native component and the second native component are both native target components, and the target component is of the same type as the target view.
2. The method according to claim 1, wherein: The step of sharing the engine instance with the second native component through the native view includes: The target view is adapted to the second native component through the native view, so as to share the engine instance with the second native component.
3. The method according to claim 2, wherein: Adapting the target view to the second native component through the native view includes: A transfer relationship is established between the target view and the second native component through the native view to pass component parameters for the second native component to the target view to trigger the engine instance to provide engine services to the second native component according to the component parameters.
4. The method according to claim 3, wherein: The component parameters include any one or more of the following: component parameters triggered by an event, component parameters triggered by a function call, or component parameters triggered by an initial display.
5. The method according to claim 3, wherein the layer of the native view is located above the layer of the target view, and an area of the native view at least partially overlaps an area of the target view; The method further comprises: Sets the background of the native view to be transparent.
6. The method according to claim 5, wherein: There are other views between the native view and the target view; The method further includes: setting the background of the other view to be transparent.
7. The method according to any one of claims 1 to 6, wherein: The method further comprises: When jumping from displaying a page including the component to which the target view belongs to displaying the second page, saving current component parameters of the component to which the target view belongs; When jumping back from displaying the second page to displaying the page including the component to which the target view belongs, the engine instance is triggered to provide engine services to the component to which the target view belongs according to the saved component parameters of the component to which the target view belongs.
8. The method according to any one of claims 1 to 6, wherein: The target view is a map view, the target component is a map component, and the engine instance is a map engine instance for providing map engine services.
9. A component processing device, wherein: The device comprises: A creation module, used to create a corresponding engine instance for a target view; the target view is a view of a component in a host application, or a view of a first native component in a first page of a parasitic application; A sharing module, used for creating a native view of the second native component when the parasitic application needs to display a second page including a second native component, and sharing the engine instance with the second native component through the native view, wherein the engine instance created corresponding to the target view can be used to provide engine services to the second native component, wherein the relationship between the engine instance and the target view is that the target view is an encapsulation of the engine instance, and a transfer relationship between the target view and the second native component is established through the native view to achieve sharing of the engine instance with the second native component; The first native component and the second native component are both native target components, and the target component is of the same type as the target view.
10. A computer program product comprising computer instructions, wherein: When the computer instructions are executed by a processor, the steps of the method described in any one of claims 1 to 8 are implemented.
