Page processing method and device of a guest program, medium and electronic device
Patent Information
- Application Number
- CN202310806947.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-03
- Publication Date
- 2026-10-13
- Estimated Expiration
- 2043-07-03
AI Technical Summary
然而,目前的小程序界面渲染引擎使用的是WebView(网页试图),页面路由(即从一个页面跳转到另一个页面的路由规则(路径))只能采用默认路由方式,即从界面右端向左端推入页面,这种路由方式的页面展示效果单一,不仅难以满足开发者进行高度定制和深度优化的需求,也难以满足用户对于自然流畅的交互体验的需求
[0021]在本申请的一些实施例所提供的技术方案中,通过获取寄宿程序的页面跳转参数,且在需要跳转到的第一目标页面由支持自定义路由的第一渲染引擎进行渲染时,确定第一目标页面对应的渲染引擎标识及页面标识,然后根据页面标识建立寄宿程序对应的页面树,并调用与该渲染引擎标识对应的渲染引擎基于该页面树及页面跳转参数对第一目标页面进行渲染处理,使得开发者可以利用第一渲染引擎实现页面的自定义路由方式,进而可以满足开发者进行高度定制和深度优化的需求,提高了页面路由的个性化、精细化及灵活性,同时也满足了用户对于自然流畅的交互体验的需求。
Smart Images

Figure CN119249012B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of computer and communication technology, and more specifically, to a method, apparatus, medium, and electronic device for page processing of a hosted program. Background Technology
[0002] Hosted applications are programs that rely on a host application and can be used without downloading or installing them. Examples include mini-programs and quick apps. Taking mini-programs as an example, with the increasing diversification of mini-program applications, developers hope to provide users with smoother and better-performing applications. However, current mini-program interface rendering engines use WebView, and page routing (i.e., the routing rules (paths) for navigating from one page to another) can only use the default routing method, which pushes the page from the right to the left. This routing method results in a monotonous page display, making it difficult to meet developers' needs for high customization and deep optimization, as well as users' demands for a natural and smooth interactive experience. Summary of the Invention
[0003] The embodiments of this application provide a page processing method, apparatus, medium, and electronic device for a hosted program, which can meet the needs of developers for high customization and deep optimization, improve the personalization, refinement, and flexibility of page routing, and also meet the user's need for a natural and smooth interactive experience.
[0004] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0005] According to one aspect of the embodiments of this application, a page processing method for a hosted program is provided. The hosted program runs in a host environment provided by a host program, and the page processing method is executed by the host program. The page processing method includes: obtaining page redirection parameters of the hosted program, the page redirection parameters including address information of a first target page to which the hosted program needs to redirect, and information of custom routing parameters of the first target page; if the first target page is rendered by a first rendering engine that supports custom routing, determining a rendering engine identifier and a page identifier corresponding to the first target page; establishing a page tree corresponding to the hosted program based on the page identifier, and calling the rendering engine corresponding to the rendering engine identifier to perform rendering processing on the first target page based on the page tree and the page redirection parameters.
[0006] According to one aspect of the embodiments of this application, a page processing apparatus for a hosted program is provided. The hosted program runs in a host environment provided by a host program, and the page processing apparatus is applied to the host program. The page processing apparatus includes: an acquisition unit configured to acquire page redirection parameters of the hosted program, the page redirection parameters including address information of a first target page to which the hosted program needs to redirect, and information of custom routing parameters of the first target page; a determination unit configured to determine a rendering engine identifier and a page identifier corresponding to the first target page if the first target page is rendered by a first rendering engine that supports custom routing; and a processing unit configured to build a page tree corresponding to the hosted program based on the page identifier, and call the rendering engine corresponding to the rendering engine identifier to perform rendering processing on the first target page based on the page tree and the page redirection parameters.
[0007] In some embodiments of this application, based on the foregoing scheme, the acquisition unit is further configured to: acquire page return parameters for the hosting program, wherein the page return parameters include the number of pages that need to be rolled back; the determination unit is further configured to: determine the target rendering engine identifier corresponding to the second target page to which the host program needs to be rolled back based on the number of pages that need to be rolled back and the page stack corresponding to the hosting program; the page processing device for the hosting program further includes: a sending unit configured to send a notification message to the rendering engine corresponding to the target rendering engine identifier to roll back the page of the hosting program to the second target page.
[0008] In some embodiments of this application, based on the foregoing scheme, the first rendering engine can render multiple pages; the determining unit is further configured to: if the rendering engine corresponding to the target rendering engine identifier is the first rendering engine, then determine the actual number of pages that need to be rolled back in the rendering engine corresponding to the target rendering engine identifier based on the number of pages that need to be rolled back and the page stack corresponding to the host program; the sending unit is further configured to: add the actual number of pages that need to be rolled back to the notification message.
[0009] In some embodiments of this application, based on the foregoing scheme, the page processing method further includes: if the current page of the hosting program and the second target page are both pages rendered in the rendering engine corresponding to the target rendering engine identifier, and the rendering engine corresponding to the target rendering engine identifier is the first rendering engine, then the notification message is further used to notify the rendering engine corresponding to the target rendering engine identifier to perform routing animation rendering processing on the second target page.
[0010] In some embodiments of this application, based on the foregoing scheme, the rendering engine used to render the page of the hosting program further includes a second rendering engine, each of which can render one page; the processing unit is further configured to: if the rendering engine corresponding to the target rendering engine identifier is the second rendering engine, then perform routing animation rendering processing on the second target page through the host program.
[0011] In some embodiments of this application, based on the foregoing scheme, the acquisition unit is configured to: in response to a trigger operation on the page return control on the hosting program, or in response to a page return gesture operation, acquire a page return parameter containing a set value of the number of pages to be returned.
[0012] In some embodiments of this application, based on the foregoing scheme, the first rendering engine can render multiple pages; the acquisition unit is further configured to: upon receiving a redirection request to redirect the current page on the hosting program to a specified page, acquire the rendering engine corresponding to the current page; the processing unit is further configured to: if the rendering engine corresponding to the current page is the first rendering engine, and the type of the specified page is a first rendering engine page, then render the specified page in the first rendering engine.
[0013] In some embodiments of this application, based on the foregoing scheme, the rendering engine used to render the pages of the hosting program further includes a second rendering engine, each of which can render one page; the processing unit is further configured to: if the rendering engine corresponding to the current page is the first rendering engine, and the type of the specified page is a page of the second rendering engine, then the specified page rendered by the second rendering engine is established at the top of the page stack of the hosting program, and the first rendering engine is notified to roll back one page.
[0014] In some embodiments of this application, based on the foregoing scheme, the rendering engine used to render the pages of the hosting program further includes a second rendering engine, each of which can render one page; the processing unit is further configured to: if the rendering engine corresponding to the current page is the second rendering engine, and the type of the specified page is a first rendering engine page, then the current page is deleted from the top of the page stack of the hosting program, and the specified page is rendered in the newly created first rendering engine.
[0015] In some embodiments of this application, based on the foregoing scheme, the process by which the processing unit obtains the page jump parameters of the hosted program includes: receiving a call request sent by the base library of the hosted program, and obtaining the page jump parameters from the call request; the process by which the processing unit establishes a page tree corresponding to the hosted program according to the page identifier, and calls the rendering engine corresponding to the rendering engine identifier to perform rendering processing on the first target page based on the page tree and the page jump parameters includes: returning the page jump parameters, the rendering engine identifier, and the page identifier to the base library, so as to establish a page tree corresponding to the hosted program through the base library, and calling the rendering engine corresponding to the rendering engine identifier to perform rendering processing on the first target page based on the page tree and the page jump parameters.
[0016] In some embodiments of this application, based on the foregoing scheme, the first rendering engine can render multiple pages; each page rendered by the hosting program through the first rendering engine corresponds to a different data isolation zone, and the routing context corresponding to each page is associated with the data isolation zone corresponding to each page, and the routing context contains a page node tree; wherein, operations on the page node tree are applied to the data isolation zone associated with the routing context.
[0017] In some embodiments of this application, based on the foregoing scheme, the page redirection parameters include a route type, which is used to call the custom route parameters of the first target page. The custom route parameters include route animation effects and animation display time.
[0018] According to one aspect of the embodiments of this application, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the page processing method of the hosting program as described in the above embodiments.
[0019] According to one aspect of the embodiments of this application, an electronic device is provided, including: one or more processors; and a storage device for storing one or more computer programs, wherein when the one or more computer programs are executed by the one or more processors, the electronic device causes the hosting program page processing method as described in the above embodiments.
[0020] According to one aspect of the embodiments of this application, a computer program product is provided, comprising a computer program stored in a computer-readable storage medium. A processor of an electronic device reads from the computer-readable storage medium and executes the computer program, causing the electronic device to perform the page processing method of the hosted program provided in the various alternative embodiments described above.
[0021] In some embodiments of this application, the technical solutions provided involve obtaining the page navigation parameters of the hosted program, and when the first target page to which the user needs to navigate is rendered by a first rendering engine that supports custom routing, determining the rendering engine identifier and page identifier corresponding to the first target page. Then, a page tree corresponding to the hosted program is built based on the page identifier, and the rendering engine corresponding to the rendering engine identifier is called to render the first target page based on the page tree and the page navigation parameters. This allows developers to use the first rendering engine to implement custom routing methods for pages, thereby meeting the needs of developers for high customization and deep optimization, improving the personalization, refinement, and flexibility of page routing, and also meeting the user's need for a natural and smooth interactive experience.
[0022] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0023] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solutions of the embodiments of this application can be applied is shown;
[0024] Figure 2 A flowchart illustrating a page processing method of a hosting program according to an embodiment of this application is shown;
[0025] Figure 3 A flowchart illustrating a page processing method of a hosting program according to an embodiment of this application is shown;
[0026] Figure 4 This diagram illustrates the page routing method rendered by the WebView engine.
[0027] Figure 5 This diagram illustrates a page routing method implemented according to an embodiment of the present application.
[0028] Figure 6 A schematic diagram of the declaration of a builder function according to an embodiment of this application is shown;
[0029] Figure 7 A schematic diagram showing the correspondence between windowID and pageID according to an embodiment of this application is shown;
[0030] Figure 8 A flowchart illustrating a page navigation process according to an embodiment of this application is shown;
[0031] Figure 9 A schematic diagram illustrating a hybrid route isolation implementation according to an embodiment of this application is shown;
[0032] Figure 10 A block diagram of a page processing apparatus for a hosting program according to an embodiment of this application is shown;
[0033] Figure 11 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown. Detailed Implementation
[0034] Exemplary embodiments will now be described in a more comprehensive manner with reference to the accompanying drawings. However, the exemplary embodiments can be implemented in various forms and should not be construed as limited to these examples; rather, these embodiments are provided so that this application will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art.
[0035] Furthermore, the features, structures, or characteristics described in this application can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to provide a full understanding of the embodiments of this application. However, those skilled in the art will recognize that when implementing the technical solutions of this application, not all detailed features in the embodiments may be used, one or more specific details may be omitted, or other methods, elements, devices, steps, etc., may be employed.
[0036] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0037] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0038] It should be noted that "multiple" in this article refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0039] The technical solutions in this application involve hosted programs and web applications. A hosted program is a program that relies on a web application and can be used without downloading or installing it; examples include mini-programs and quick apps. Taking mini-programs as an example, because the current mini-program interface rendering engine uses WebView, page navigation can only be done from right to left. This page routing method results in a monotonous page display, making it difficult to meet developers' needs for high customization and deep optimization, as well as users' needs for a natural and smooth interactive experience.
[0040] To address the aforementioned issues, this application proposes a solution for custom routing within a hosting application. Specifically, as shown in the embodiments below... Figure 1 As shown, in an exemplary system architecture of this application, a terminal device 101, a network 102, and a host application platform 103 may be included. The network 102 serves as a medium for providing a communication link between the terminal device 101 and the host application platform 103. The network 102 may include various connection types, such as wired communication links, wireless communication links, etc.
[0041] In one embodiment of this application, a host program runs on the terminal device 101. The host program can be an application client. The host program can communicate with the host program platform 103 via the network 102 to display the host program page and complete corresponding business functions (such as message sending, voice calls, etc.). The host program provides a host environment, and the hosted program can run in the host environment provided by the host program. Developers can set page jump parameters for the hosted program to perform custom routing. Then, the host program can obtain the page jump parameters of the hosted program. The page jump parameters may include the address information of the first target page that the hosted program needs to jump to, as well as the custom routing parameters of the first target page. If the first target page is rendered by a first rendering engine that supports custom routing, the rendering engine identifier and page identifier corresponding to the first target page can be determined. Then, a page tree corresponding to the hosted program is built according to the page identifier, and the rendering engine corresponding to the rendering engine identifier is called to render the first target page based on the page tree and the page jump parameters.
[0042] As can be seen, the technical solution of this application embodiment enables developers to use the first rendering engine to implement a custom routing method for the page, thereby meeting the developer's needs for high customization and deep optimization, improving the personalization, refinement and flexibility of page routing, and also meeting the user's needs for a natural and smooth interactive experience.
[0043] It should be noted that the host program platform 103 involved in this application embodiment can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal device 101 can be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smartwatch, in-vehicle terminal, smart TV, etc., but is not limited to these.
[0044] The implementation details of the technical solutions in the embodiments of this application are described in detail below:
[0045] Figure 2 A flowchart illustrating a page processing method for a hosted program according to an embodiment of this application is shown. The hosted program runs in a host environment provided by a host program, and the page processing method is executed by the host program or by an electronic device running the host program. (Refer to...) Figure 2 As shown, the page processing method of this hosting program includes at least steps S210 to S230, which are described in detail below:
[0046] In step S210, the page redirection parameters of the hosting program are obtained. These page redirection parameters include the address information of the first target page that the hosting program needs to redirect to, as well as the information of the custom routing parameters of the first target page.
[0047] In the embodiments of this application, a hosted program is a program that relies on a host program and can be used without downloading or installing it. Examples of hosted programs include mini-programs and quick apps. In a computer environment, the software environment on which a hosted program depends is called the host environment, and the program that provides the host environment can be called the host program. The host program can be, for example, an open platform, an application that can run a hosted program, or the operating system of a mobile terminal.
[0048] In some optional embodiments, the page redirection parameters may include a route type (i.e., routeType), which is used to call custom route parameters of the first target page. These custom route parameters include route animation effects and animation display time. Optionally, the route animation effect may be, for example, pulling up the page from the bottom or the page gradually expanding from a certain position (such as the side of the screen); the animation display time is used to indicate the display time of the route animation effect.
[0049] In some optional embodiments, the process by which the host program obtains the page navigation parameters of the hosted program can be as follows: receiving a call request sent by the host program's base library, and then obtaining the page navigation parameters from the call request. For example, if the hosted program is a mini-program, then the call request sent by the base library could be `navigateTo`.
[0050] It's important to note that the base library can provide fundamental code related to the VD (Virtual DOM) rendering mechanism, as well as APIs (Application Programming Interfaces) for encapsulated built-in components and logic layers. It can also provide the base code for other supplementary capabilities (such as custom components and plugins). In general, the host application's base library is primarily responsible for handling a series of framework logics, including data binding, component systems, event systems, and communication systems.
[0051] In step S220, if the first target page is rendered by a first rendering engine that supports custom routing, then the rendering engine identifier and page identifier corresponding to the first target page are determined.
[0052] In some optional embodiments, the rendering engine identifier is used to identify the rendering engine, and the page identifier is used to identify the page. Since multiple pages can be rendered in one rendering engine in this embodiment, one rendering engine identifier can correspond to one or more page identifiers. If one rendering engine identifier corresponds to one page identifier, it means that one page is rendered in that rendering engine; if one rendering engine identifier corresponds to multiple page identifiers, it means that multiple pages are rendered in that rendering engine. Therefore, if the first target page is rendered by a first rendering engine that supports custom routing, after finding the rendering engine that renders the first target page, the corresponding rendering engine identifier can be obtained, that is, the rendering engine identifier corresponding to the first target page. Then, the page identifier corresponding to the first target page can be obtained according to the page rendered in the rendering engine corresponding to that rendering engine identifier.
[0053] In step S230, a page tree corresponding to the hosting program is established based on the page identifier corresponding to the first target page, and the rendering engine corresponding to the rendering engine identifier is called to render the first target page based on the page tree and page jump parameters.
[0054] In some optional embodiments, the page tree is used to represent the navigation relationship between pages, such as navigation from page A to page B. After the rendering engine corresponding to the rendering engine identifier renders the first target page based on the page tree and page navigation parameters, the first target page can be presented in the hosting application through a custom routing method corresponding to the custom routing parameters.
[0055] In some optional embodiments, the process of the host program building a page tree corresponding to the host program based on the page identifier and calling the rendering engine corresponding to the rendering engine identifier to render the first target page based on the page tree and page jump parameters can be specifically as follows: the page jump parameters, rendering engine identifier and page identifier are returned to the base library so that the page tree corresponding to the host program can be built through the base library, and the rendering engine corresponding to the rendering engine identifier can be called to render the first target page based on the page tree and page jump parameters.
[0056] Figure 2 The technical solution of the illustrated embodiment enables developers to use the first rendering engine to implement custom routing methods for pages, thereby meeting the developers' needs for high customization and in-depth optimization, improving the personalization, refinement and flexibility of page routing, and also meeting the users' needs for a natural and smooth interactive experience.
[0057] Figure 3 A flowchart illustrating a page processing method for a hosted program according to an embodiment of this application is shown. The hosted program runs in a host environment provided by a host program, and the page processing method is executed by the host program. (Refer to...) Figure 3 As shown, the page processing method of this hosting program includes at least steps S310 to S330, which are described in detail below:
[0058] In step S310, the page return parameters for the hosting program are obtained, which contain the number of pages that need to be rolled back.
[0059] In some optional embodiments, the number of pages to be undone in the page return parameter can be set or triggered by a page return operation. Optionally, the page return operation can be triggered by a page return control on the hosting application, or it can be a page return gesture operation (such as a swipe operation on the side of the screen). If it is a page return operation, then the number of pages to be undone in the page return parameter can be a set value, such as 1, that is, undone by one page.
[0060] In step S320, based on the number of pages to be rolled back and the page stack corresponding to the host program, the target rendering engine identifier corresponding to the second target page to which the user needs to return is determined.
[0061] In some optional embodiments, the page stack corresponding to the hosted program is used to store the pages of the hosted program. These pages can be stored according to the jump order, where the first element in the page stack is the home page of the hosted program, and the last element (i.e., the element at the top of the stack) is the current page of the hosted program. Based on this, the second target page to return to can be determined by traversing backward from the current page according to the number of pages to be traversed and the page stack corresponding to the hosted program. Then, the target rendering engine identifier corresponding to the second target page can be determined, that is, the identifier of the rendering engine used to render the second target page.
[0062] In step S330, a notification message is sent to the rendering engine corresponding to the target rendering engine identifier to revert the host program's page to the second target page.
[0063] In some optional embodiments, if the first rendering engine can render multiple pages, then if the rendering engine corresponding to the target rendering engine identifier is the first rendering engine, the actual number of pages that need to be rolled back within the rendering engine corresponding to the target rendering engine identifier can be determined based on the number of pages to be rolled back and the page stack corresponding to the host application; then the actual number of pages to be rolled back is added to the notification message. This is because multiple pages are rendered in the first rendering engine, and when the second target page that needs to be rolled back falls in this rendering engine, for this rendering engine, it is actually a page rollback performed in this rendering engine, so the actual number of pages that need to be rolled back within the rendering engine corresponding to the target rendering engine identifier can be determined. Optionally, if both the current page of the host application and the second target page are pages rendered within the rendering engine corresponding to the target rendering engine identifier, and the rendering engine corresponding to the target rendering engine identifier is the first rendering engine, then it means that the second target page is another page rendered in the rendering engine corresponding to the target rendering engine identifier, that is, the rendering engine corresponding to the target rendering engine identifier renders multiple pages. Therefore, the notification message can also be used to notify the rendering engine corresponding to the target rendering engine identifier to perform routing animation rendering processing on the second target page.
[0064] In some optional embodiments, the rendering engine used to render the pages of the host program may further include a second rendering engine, each of which can render one page, i.e., one second rendering engine can only render one page. If the target rendering engine identifier corresponds to a second rendering engine, the host program can perform routing animation rendering processing on the second target page.
[0065] In some optional embodiments, if the first rendering engine is capable of rendering multiple pages, then upon receiving a redirection request to redirect the current page on the hosting application to a specified page, the rendering engine corresponding to the current page can be obtained. If the rendering engine corresponding to the current page is the first rendering engine, and the specified page is of the type of a first rendering engine page, then the first rendering engine can be directly reused to render the specified page within the first rendering engine.
[0066] In some optional embodiments, the rendering engine used to render the pages of the host program may also include a second rendering engine. Each second rendering engine can render one page, that is, a second rendering engine can only render one page. If the rendering engine corresponding to the current page is the first rendering engine, and the type of the specified page is a page of the second rendering engine, the specified page rendered by the second rendering engine can be created at the top of the page stack of the host program, and the first rendering engine is notified to roll back one page to ensure the correctness of the page stack.
[0067] In some optional embodiments, the rendering engine used to render the pages of the host program may also include a second rendering engine. Each second rendering engine can render one page, that is, a second rendering engine can only render one page. If the rendering engine corresponding to the current page is a second rendering engine, and the type of the specified page is a first rendering engine page, the current page can be deleted from the top of the page stack of the host program, and the specified page can be rendered in the newly created first rendering engine.
[0068] In some optional embodiments, if the first rendering engine can render multiple pages, then each page rendered by the hosting program through the first rendering engine corresponds to a different data isolation zone (such as Dart Isolate). The routing context corresponding to each page is associated with the data isolation zone corresponding to each page, and the routing context contains a page node tree (such as Shadow Tree). In this case, the operation on the page node tree is applied to the data isolation zone associated with the routing context, thereby ensuring data isolation between multiple pages in the first rendering engine.
[0069] The following describes in detail the implementation details of the technical solution of this application embodiment, taking the hosting program as a mini-program, the host program as an application client, the first rendering engine as Flutterengine, and the second rendering engine as WebView:
[0070] like Figure 4As shown, the current WeChat Mini Program interface rendering engine uses WebView. When navigating between pages, the page can only be pushed in from right to left. This page routing method results in a monotonous page display, failing to meet developers' needs for high customization and deep optimization, and also failing to satisfy users' demands for a natural and smooth interactive experience. However, in the embodiments of this application, custom routing provides developers with greater freedom and creativity. Developers can implement their own routing animation schemes according to their business needs, thereby creating a more personalized and refined Mini Program interactive experience. At the same time, this custom routing method also makes the page transitions in the Mini Program more natural and smooth, resulting in a smoother user experience. For example… Figure 5 As shown, the page can be pushed up from the bottom of the screen.
[0071] In some optional embodiments, the custom routes in this application can be implemented based on Skyline and Flutter. To use custom routes in consecutive Skyline pages, the renderer field can be configured as Skyline in the JSON file configured for the page.
[0072] When using custom routes, you can first declare them. For example, you can declare a custom route using the `wx.router.addRouteBuilder` interface. In one example, a custom route can be declared as follows:
[0073] wx.router.addRouteBuilder(
[0074] "HalfScreenDialog",
[0075] customRouteBuilder )
[0077] In the above statement, the first parameter "HalfScreenDialog" is the name of this custom route, and the second parameter customRouteBuilder is the builder function of the custom route. The builder function is the core of developers using custom routes, where animation effects, animation duration, and so on can be defined.
[0078] An example builder function can be as follows: Figure 6As shown, a user route configuration is defined in a builder function, where code snippet 601 shows the route context information (i.e., routeContext). Since the old page exits during the process of opening a new page, primaryAnimation is used to represent the parameters for the new page push animation; secondaryAnimation is used to represent the parameters for the old page exit animation; and userGestureInProgress is used to identify whether the page transition was triggered by a user gesture.
[0079] Figure 6 The code snippet 602 is used to define the new page push animation. The code snippet 6021 is used to set the value of the worklet animation. The default value is the value of primaryAnimation (i.e., primaryAnimation.value). If it is not triggered by a user gesture, other values will be selected. Finally, the animation style is returned. Figure 6 The code snippet 603 is used to define the animation when the old page is pushed out. The code snippet 6031 is used to set the value of the worklet animation. The default value is the value of secondaryAnimation (i.e., secondaryAnimation.value). If it is not triggered by a user gesture, other values will be selected. Finally, the animation style is returned. Figure 6 The 604 section in the code snippet is used to return the defined new page push animation and old page push animation.
[0080] After declaring a custom route, you can use it as a parameter for page navigation to achieve custom page routing. Specifically, when calling `wx.navigateTo` (the function for page navigation), you can add a second parameter, `routeType` (route type), and set it to the name of the declared custom route, "HalfScreenDialog". This way, the page navigation will follow the route animation set in the builder function. In one example, the `wx.navigateTo` function is defined as follows (where `url` is the address of the page to navigate to):
[0081] wx.navigateTo({
[0082] url:'pageB',
[0083] routeType:'HalfScreenDialog'
[0084] })
[0085] In one embodiment of this application, when performing page return processing, custom routes support gestures to complete gesture return animation effects. Specifically, a gesture component can be nested at the outermost layer of the page, and the page display state can be changed by modifying the variables of the custom route in the gesture callback. The `this.customRouteContext` (user route context) in the page contains all the variables defined when the route builder is defined on the current page, i.e., the `routeContext` in the declared builder function.
[0086] In one embodiment of this application, since Skyline serves as the rendering backend and provides rich animation support for page transitions, when a page uses an independent Flutter engine, the routing animation is controlled by the application client, and Skyline's routing animation capabilities are not used. However, when rendering consecutive pages using the same Flutter engine, Skyline's routing animation capabilities can be utilized to implement custom routing. To render multiple pages within the same Flutter engine, the Flutter engine's ID can be called the windowID, and the page's ID can be called the pageID. Each windowID may correspond to one or more pageIDs, but each pageID belongs to only one windowID. Furthermore, in embodiments of this application, WebView and Skyline can coexist within the same mini-program, i.e., a hybrid routing method using WebView and Skyline is supported. Specifically, as shown... Figure 7 As shown, the WebView engine with id=1 corresponds to the page with id=1; the Flutter engine with id=2 corresponds to the pages with id=2 and id=3; and the WebView engine with id=3 corresponds to the page with id=4.
[0087] In one embodiment of this application, it is assumed that the opening order of the mini-program pages is wa->fb->fc->wd->fe, where "w-" represents the WebView rendering page and "f-" represents the Flutter engine rendering page. In this example, two Flutter engines will be generated: Flutter engine1 contains fb and fc; Flutter engine2 contains fe. The application client is responsible for the routing animation between the WebView and the Flutter engine, while the routing of pages in the Flutter engine (such as fb->fc) is controlled by Skyline. This part can have custom routing animations. Since consecutive Flutter engine rendering pages can reuse the same Flutter engine, system memory consumption can also be reduced. At the same time, the application client has a complete page stack, and the base library keeps consistent with the client's page stack based on the onAppRoute (API triggered when switching pages) and onAppRouteDone events. When the routing animation is generated by the application client, the timing of the two events is entirely determined by the client; when custom routing is performed in the Flutter engine, the onAppRouteDone event is notified to the application client by Skyline. The following describes the page change scenarios in the embodiments of this application:
[0088] In one embodiment of this application, when page redirection is required, such as Figure 8 As shown, the navigation logic for custom routes includes: When the developer calls `wx.navigateTo` to navigate to a page, the base library calls `navigateTo`, carrying the parameters `{url, singlePageData}`. Here, `singlePageData` is the name of the defined custom route, which in the aforementioned embodiment is "HalfScreenDialog". Then, the application client triggers the `onAppRoute` event. If the new page to be navigated to is rendered by Flutter, the parameters returned to the base library include the passed-in `singlePageData`, along with the `windowID` and `pageID`. Subsequently, the base library creates a new page tree with the new `pageID`. After the page tree is created, it calls `startRender` to initiate page rendering. The rendering backend, Skyline, receives `startRender`, performs page layout and drawing, and completes the custom route according to the defined custom route parameters. After the rendering backend route is completed, it notifies the client, which triggers `onAppRouteDone` to the base library. The base library then calls back to the developer to complete the callback.
[0089] It should be noted that when navigating from the WebView engine to the Flutter engine, the page routing animation is handled by the application client. However, when navigating within the Flutter engine, i.e., to the Flutter engine rendering page, the page routing animation is handled by Skyline.
[0090] In one embodiment of this application, when page back processing is required, the base library calls the `navigateBack` function (a function used for page back), carrying the parameter `delta` (i.e., the number of pages to back). The application client calculates which rendering engine the target page will fall into based on `delta` and the page stack. If the target page falls into a certain Flutter engine, since a Flutter engine may have multiple pages, it needs to notify the Flutter engine of the actual number of pages to back within it (`calculatedDelta`), and whether page animation is required. If page animation is required, the rendering backend notifies the application client after exiting the page, and the application client triggers `onAppRouteDone` to the base library.
[0091] Assuming the opening order of the mini-program pages is wa->fb->fc->wd->fe, where "w-" represents the WebView rendering page and "f-" represents the Flutter engine rendering page, then two Flutter engines will be generated: flutterengine1 contains fb and fc; and flutterengine2 contains fe.
[0092] If the current page is fe, the base library navigateBack is passed delta:2. At this point, it is determined that it is necessary to return to the fc page. The animation is handled by the client and there is no need to notify Skyline. This is because returning from the fe page to the fc page is not a return between pages within the Flutter Engine.
[0093] If the current page is fe, the base library navigateBack is passed delta:3. At this point, it is determined that it needs to return to the fb page. Since returning from the fe page to the fb page is not a return between pages within the Flutter engine, the animation can be handled by the application client. Skyline is notified that the actual number of pages to return within flutter engine1 is calculatedDelta:1, and Skyline does not need to perform any animation.
[0094] If the current page is `fc`, and the base library `navigateBack` is passed `delta:1`, it's determined that a return to `fb` is needed. Since returning from `fc` to `fb` is a return between pages within the Flutter engine, Skyline can be notified to calculate the actual number of pages to return to within `flutter engine1` as `Delta:1`, and an animation is required. In other words, Skyline only needs to perform animations when the current page and the target page are within the same Flutter engine.
[0095] In one embodiment of this application, gesture operations can also cause page return, such as triggering the back button with a gesture or triggering page return with a swipe gesture. This is equivalent to delta:1 and can be processed as described above for page return operations. It should be noted that for the first page of the Flutter engine, when a gesture triggers a return, since it needs to return to a page in another rendering engine (such as a WebView page), the page routing animation can be handled by the application client. However, starting from the second page of the Flutter engine, if a gesture triggers a return, since the page return operation is performed within the same Flutter engine, the page routing animation can be handled by Skyline. Simultaneously, when a page return is triggered by a gesture within the Flutter engine, Skyline notifies the client of the return start and end times; that is, the onAppRouteDone event is notified to the application client by Skyline.
[0096] In one embodiment of this application, when page redirection is required, if the current page is wd and needs to be redirected to fe, the application client can delete the current top webview, create a new flutter engine, and notify Skyline NavigateTo to navigate to page fe. If the current page is fc and needs to be redirected to fe, since the page is rendered by the same flutter engine, the previous flutter engine can be reused, and the application client notifies Skyline RedirectTo to navigate to page fe. If the current page is fc and needs to be redirected to wd, the application client can create a new webview at the top of the stack and notify Skyline NavigateBack (i.e., return) to the next page, but no animation is needed, thus maintaining the correctness of the flutter engine page stack.
[0097] In one embodiment of this application, since a mixed routing method of WebView and Skyline is supported within the same mini-program, a solution for mixing WebView and the Flutter rendering framework within a mini-program can be implemented using a multi-Flutter View (i.e., Flutter page) mechanism. Developers only need to configure the renderer to be used by the page in the page.json file beforehand. During route navigation, the client will decide whether to push a WebView or a Flutter View based on the configuration in the page.json file. The multi-Flutter View mechanism is very similar to the multi-WebView mechanism, the difference being that multiple Flutter Views share some resources at the underlying level to save memory (such as texture resources and some internal objects). To support multiple Flutter Views, such as... Figure 9 As shown, an isolation mechanism can be designed within Skyline. For a Skyline page, the Context and Window in Skyline are bound to the page's Dart Isolate (each Skyline page has one Dart Isolate). A Context holds a Shadow Tree, and all operations on the Shadow Tree will be applied to its corresponding Dart Isolate, thereby achieving state isolation from the Shadow Tree to the Dart Isolate.
[0098] The technical solution of this application embodiment enables custom page routing in mini-programs, bringing a better user experience. Compared to WebView, the technical solution of this application embodiment can achieve routing animation effects that are closer to native implementations, such as sunken routing, card transitions, etc., which allow users to experience a smoother interaction. Furthermore, through custom routing, mini-programs can gain more possibilities and flexibility, further enhancing user experience and application value.
[0099] The following describes an embodiment of the apparatus described in this application, which can be used to execute the page processing method for the hosted program in the above embodiments of this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the page processing method for the hosted program described above in this application.
[0100] Figure 10 A block diagram of a page processing apparatus for a hosted program according to an embodiment of the present application is shown, wherein the hosted program runs in a host environment provided by a host program, and the page processing apparatus is applied to the host program.
[0101] Reference Figure 10As shown, a page processing apparatus 1000 for a hosting program according to an embodiment of this application includes: an acquisition unit 1002, a determination unit 1004, and a processing unit 1006.
[0102] The acquisition unit 1002 is configured to acquire the page redirection parameters of the hosting program, the page redirection parameters including the address information of the first target page to which the hosting program needs to redirect, and the information of the custom routing parameters of the first target page; the determination unit 1004 is configured to determine the rendering engine identifier and page identifier corresponding to the first target page if the first target page is rendered by a first rendering engine that supports custom routing; the processing unit 1006 is configured to build a page tree corresponding to the hosting program according to the page identifier, and call the rendering engine corresponding to the rendering engine identifier to perform rendering processing on the first target page based on the page tree and the page redirection parameters.
[0103] In some embodiments of this application, based on the foregoing scheme, the acquisition unit 1002 is further configured to: acquire page return parameters for the hosting program, wherein the page return parameters include the number of pages that need to be rolled back; the determination unit 1004 is further configured to: determine the target rendering engine identifier corresponding to the second target page to which the host program needs to be rolled back based on the number of pages that need to be rolled back and the page stack corresponding to the hosting program; the page processing device of the hosting program further includes: a sending unit configured to send a notification message to the rendering engine corresponding to the target rendering engine identifier to roll back the page of the hosting program to the second target page.
[0104] In some embodiments of this application, based on the foregoing scheme, the first rendering engine can render multiple pages; the determining unit 1004 is further configured to: if the rendering engine corresponding to the target rendering engine identifier is the first rendering engine, then determine the actual number of pages that need to be rolled back in the rendering engine corresponding to the target rendering engine identifier based on the number of pages that need to be rolled back and the page stack corresponding to the host program; the sending unit is further configured to: add the actual number of pages that need to be rolled back to the notification message.
[0105] In some embodiments of this application, based on the foregoing scheme, the page processing method further includes: if the current page of the hosting program and the second target page are both pages rendered in the rendering engine corresponding to the target rendering engine identifier, and the rendering engine corresponding to the target rendering engine identifier is the first rendering engine, then the notification message is further used to notify the rendering engine corresponding to the target rendering engine identifier to perform routing animation rendering processing on the second target page.
[0106] In some embodiments of this application, based on the foregoing scheme, the rendering engine used to render the page of the hosting program further includes a second rendering engine, each of which can render one page; the processing unit 1006 is further configured to: if the rendering engine corresponding to the target rendering engine identifier is the second rendering engine, then the second target page is rendered with a routing animation through the host program.
[0107] In some embodiments of this application, based on the foregoing scheme, the acquisition unit 1002 is configured to: in response to a trigger operation on the page return control on the hosting program, or in response to a page return gesture operation, acquire a page return parameter containing a set value of the number of pages to be returned.
[0108] In some embodiments of this application, based on the foregoing scheme, the first rendering engine can render multiple pages; the acquisition unit 1002 is further configured to: upon receiving a redirection request to redirect the current page on the hosting program to a specified page, acquire the rendering engine corresponding to the current page; the processing unit 1006 is further configured to: if the rendering engine corresponding to the current page is the first rendering engine, and the type of the specified page is a first rendering engine page, then render the specified page in the first rendering engine.
[0109] In some embodiments of this application, based on the foregoing scheme, the rendering engine used to render the pages of the hosting program further includes a second rendering engine, each of which can render one page; the processing unit 1006 is further configured to: if the rendering engine corresponding to the current page is the first rendering engine, and the type of the specified page is a page of the second rendering engine, then the specified page rendered by the second rendering engine is established at the top of the page stack of the hosting program, and the first rendering engine is notified to roll back one page.
[0110] In some embodiments of this application, based on the foregoing scheme, the rendering engine used to render the pages of the hosting program further includes a second rendering engine, each of which can render one page; the processing unit 1006 is further configured to: if the rendering engine corresponding to the current page is the second rendering engine, and the type of the specified page is a first rendering engine page, then the current page is deleted from the top of the page stack of the hosting program, and the specified page is rendered in the newly created first rendering engine.
[0111] In some embodiments of this application, based on the foregoing scheme, the process by which the processing unit 1006 obtains the page jump parameters of the hosted program includes: receiving a call request sent by the base library of the hosted program, and obtaining the page jump parameters from the call request; the process by which the processing unit 1006 establishes a page tree corresponding to the hosted program according to the page identifier, and calls the rendering engine corresponding to the rendering engine identifier to perform rendering processing on the first target page based on the page tree and the page jump parameters includes: returning the page jump parameters, the rendering engine identifier, and the page identifier to the base library, so as to establish a page tree corresponding to the hosted program through the base library, and calling the rendering engine corresponding to the rendering engine identifier to perform rendering processing on the first target page based on the page tree and the page jump parameters.
[0112] In some embodiments of this application, based on the foregoing scheme, the first rendering engine can render multiple pages; each page rendered by the hosting program through the first rendering engine corresponds to a different data isolation zone, and the routing context corresponding to each page is associated with the data isolation zone corresponding to each page, and the routing context contains a page node tree; wherein, operations on the page node tree are applied to the data isolation zone associated with the routing context.
[0113] In some embodiments of this application, based on the foregoing scheme, the page redirection parameters include a route type, which is used to call the custom route parameters of the first target page. The custom route parameters include route animation effects and animation display time.
[0114] Figure 11 A schematic diagram of a computer system suitable for implementing an electronic device according to the embodiments of this application is shown. The electronic device may be the electronic device running the host program in the foregoing embodiments.
[0115] It should be noted that, Figure 11 The computer system 1100 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0116] like Figure 11As shown, the computer system 1100 may include a Central Processing Unit (CPU) 1101, which can perform various appropriate actions and processes based on a program stored in Read-Only Memory (ROM) 1102 or a program loaded from storage portion 1108 into Random Access Memory (RAM) 1103, such as performing the methods described in the above embodiments. Various programs and data required for system operation are also stored in RAM 1103. The CPU 1101, ROM 1102, and RAM 1103 are interconnected via bus 1104. An input / output (I / O) interface 1105 is also connected to bus 1104.
[0117] The following components can be connected to I / O interface 1105: an input section 1106 including a keyboard, mouse, etc.; an output section 1107 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to I / O interface 1105 as needed. Removable media 1111, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1110 as needed so that computer programs read from them can be installed into storage section 1108 as needed.
[0118] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1109, and / or installed from removable medium 1111. When the computer program is executed by central processing unit (CPU) 1101, it performs various functions defined in the system of this application.
[0119] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a computer program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0120] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and a computer program.
[0121] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0122] In another aspect, this application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The computer-readable medium carries one or more computer programs, which, when executed by the electronic device, cause the electronic device to perform the methods described in the above embodiments.
[0123] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0124] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, and includes several instructions to cause an electronic device to execute the method according to the embodiments of this application.
[0125] For example, an electronic device can be an electronic device running a host program, then the electronic device can execute... Figure 2 or Figure 4 The page handling method of the hosting program is shown.
[0126] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0127] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for page processing in a hosted program, characterized in that, The hosting program runs in a host environment provided by the host program, and the page processing method is executed by the host program, the page processing method including: Obtain the page redirection parameters of the hosting program, which include the address information of the first target page that the hosting program needs to redirect to, and the information of the custom routing parameters of the first target page; If the first target page is rendered by a first rendering engine that supports custom routing, then determine the rendering engine identifier and page identifier corresponding to the first target page; A page tree corresponding to the hosting program is established based on the page identifier, and the rendering engine corresponding to the rendering engine identifier is called to render the first target page based on the page tree and the page jump parameters.
2. The page processing method for a hosting program according to claim 1, characterized in that, The page processing method further includes: Obtain the page return parameters for the hosting program, the page return parameters containing the number of pages that need to be rolled back; Based on the number of pages that need to be rolled back and the page stack corresponding to the host program, determine the target rendering engine identifier corresponding to the second target page to which the user needs to return. A notification message is sent to the rendering engine corresponding to the target rendering engine identifier to revert the page of the hosted program to the second target page.
3. The page processing method for a hosting program according to claim 2, characterized in that, The first rendering engine is capable of rendering multiple pages; the page processing method further includes: If the rendering engine corresponding to the target rendering engine identifier is the first rendering engine, then the actual number of pages that need to be rolled back in the rendering engine corresponding to the target rendering engine identifier is determined according to the number of pages that need to be rolled back and the page stack corresponding to the host program. Add the actual number of pages that need to be rolled back to the notification message.
4. The page processing method for a hosting program according to claim 3, characterized in that, The page processing method further includes: If both the current page of the hosting program and the second target page are pages rendered by the rendering engine corresponding to the target rendering engine identifier, and the rendering engine corresponding to the target rendering engine identifier is the first rendering engine, then the notification message is also used to notify the rendering engine corresponding to the target rendering engine identifier to perform routing animation rendering processing on the second target page.
5. The page processing method for a hosting program according to claim 2, characterized in that, The rendering engine used to render the pages of the hosting program further includes a second rendering engine, each of which is capable of rendering one page; the page processing method further includes: If the rendering engine corresponding to the target rendering engine identifier is the second rendering engine, then the host program performs routing animation rendering on the second target page.
6. The page processing method for a hosting program according to claim 2, characterized in that, Obtain the page return parameters for the hosting program, including: In response to a trigger operation on the page back control on the hosted program, or in response to a page back gesture operation, obtain a page back parameter containing a set value of the number of pages to be undone.
7. The page processing method for a hosting program according to claim 1, characterized in that, The first rendering engine is capable of rendering multiple pages; the page processing method further includes: Upon receiving a redirection request to redirect the current page on the hosted program to a specified page, obtain the rendering engine corresponding to the current page; If the rendering engine corresponding to the current page is the first rendering engine, and the type of the specified page is a first rendering engine page, then the specified page is rendered in the first rendering engine.
8. The page processing method for a hosting program according to claim 7, characterized in that, The rendering engine used to render the pages of the hosting program further includes a second rendering engine, each of which is capable of rendering one page; the page processing method further includes: If the rendering engine corresponding to the current page is the first rendering engine, and the type of the specified page is a second rendering engine page, then the specified page rendered by the second rendering engine is created at the top of the page stack of the hosting program, and the first rendering engine is notified to roll back one page.
9. The page processing method for a hosting program according to claim 7, characterized in that, The rendering engine used to render the pages of the hosting program further includes a second rendering engine, each of which is capable of rendering one page; the page processing method further includes: If the rendering engine corresponding to the current page is the second rendering engine, and the type of the specified page is a first rendering engine page, then the current page is removed from the top of the page stack of the hosting program, and the specified page is rendered in the newly created first rendering engine.
10. The page processing method for a hosting program according to claim 1, characterized in that, Obtaining the page redirection parameters of the hosted program includes: receiving a call request sent by the base library of the hosted program, and obtaining the page redirection parameters from the call request; Based on the page identifier, a page tree corresponding to the hosting program is established, and the rendering engine corresponding to the rendering engine identifier is invoked to render the first target page based on the page tree and the page jump parameters, including: The page jump parameters, the rendering engine identifier, and the page identifier are returned to the base library so that the page tree corresponding to the hosting program can be established through the base library, and the rendering engine corresponding to the rendering engine identifier can be called to render the first target page based on the page tree and the page jump parameters.
11. The page processing method for a hosting program according to any one of claims 1 to 10, characterized in that, The first rendering engine can render multiple pages; each page rendered by the hosting program through the first rendering engine corresponds to a different data isolation zone, and the routing context corresponding to each page is associated with the data isolation zone corresponding to each page. The routing context contains a page node tree; wherein, operations on the page node tree are applied to the data isolation zone associated with the routing context.
12. The page processing method for a hosting program according to any one of claims 1 to 10, characterized in that, The page redirection parameters include a route type, which is used to call the custom route parameters of the first target page. The custom route parameters include route animation effects and animation display time.
13. A page processing apparatus for a hosted program, characterized in that, The hosting program runs in a host environment provided by the host program, and the page processing device is applied to the host program. The page processing device includes: The acquisition unit is configured to acquire the page redirection parameters of the hosting program, wherein the page redirection parameters include the address information of the first target page to which the hosting program needs to redirect, and the information of the custom routing parameters of the first target page; The unit is configured to determine the rendering engine identifier and page identifier corresponding to the first target page if the first target page is rendered by a first rendering engine that supports custom routing. The processing unit is configured to establish a page tree corresponding to the hosting program based on the page identifier, and call the rendering engine corresponding to the rendering engine identifier to perform rendering processing on the first target page based on the page tree and the page jump parameters.
14. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the page processing method of the hosting program as described in any one of claims 1 to 12.
15. An electronic device, characterized in that, include: One or more processors; A memory for storing one or more computer programs, which, when executed by one or more processors, cause the electronic device to implement the page processing method of the hosted program as described in any one of claims 1 to 12.
16. A computer program product, characterized in that, The computer program product includes a computer program stored in a computer-readable storage medium, wherein a processor of an electronic device reads from and executes the computer program, causing the electronic device to perform the page processing method of the hosted program as described in any one of claims 1 to 12.
Citation Information
Patent Citations
Small program page display method and device, terminal and storage medium
CN111475246A
Page rendering method and device based on applet, equipment and storage medium
CN112861057A