Mini-program page parameter control method, device, medium and electronic device
By creating applet management components in the applet and adjusting the page parameters of the window container, the problem of single display of applets is solved, and a more flexible and diverse display method is achieved, improving the user experience.
Patent Information
- Application Number
- CN202110080516.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-21
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2041-01-21
AI Technical Summary
The display method of existing applets is single, and the size and position cannot be adjusted, resulting in the user's display method being dull.
By obtaining the interface components of the host application, creating applet management components, and setting the target applet window container in the layout file, controlling its display, and adjusting the page parameters of the window container.
It realizes the diversified display methods and flexible display methods of mini programs, improving the user experience.
Smart Images

Figure CN113821205B_ABST
Abstract
Description
Background Art
[0002] With the development of the Internet and smart terminal technologies, more and more applications are appearing on smart terminals, and their forms are becoming more and more diverse.
[0003] The mini-programs that have emerged are a form of application function implementation. For users, they can be used without downloading and installing, which can save time and storage space of terminal devices. For developers, mini-programs can save development costs and promotion costs. As an Internet platform product, mini-programs have good development prospects.
[0004] However, existing mini programs are usually displayed in full screen, and the size and position of the mini programs cannot be adjusted, which makes the display method of the mini programs relatively simple and the way of displaying the mini programs to users is relatively dull.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0006] The purpose of the present disclosure is to provide a method for controlling mini-program page parameters, a device for controlling mini-program page parameters, a computer-readable storage medium, and an electronic device, which can solve the problem that the mini-program display method is single and the mini-program display method is relatively dull.
[0007] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0008] According to a first aspect of the present disclosure, a method for controlling mini-program page parameters is provided, comprising: obtaining an interface component of a host application and creating a mini-program management component in the interface component; obtaining a layout file of the interface component and setting a first target mini-program window container in the layout file; controlling the first target mini-program window container to display the target mini-program through the mini-program management component; wherein the first target mini-program window container has preset page parameters.
[0009] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, obtaining the interface component of the host application includes: starting the host application and obtaining the application file loaded by the host application; and determining the interface component to be run from multiple candidate components according to the application file.
[0010] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, the target applet is controlled by the applet management component to display the target applet in the target applet window container, including: the applet management component obtains the stack of the target applet window container; the applet management component controls the target applet at the top of the stack to be displayed in the first target applet window container.
[0011] According to a second aspect of the present disclosure, a method for controlling mini-program page parameters is provided, including: in response to a target mini-program startup instruction, obtaining a configuration file of the target mini-program and initializing it to a reset state; generating a target mini-program view according to the configuration file, and obtaining a pre-created first target mini-program window container in a layout file of a host application; and a mini-program management component controlling the target mini-program view to be displayed in the first target mini-program window container having preset page parameters.
[0012] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, obtaining the configuration file of the target applet and initializing it to a reset state includes: obtaining the target applet startup instruction, wherein the target applet startup instruction includes the storage path of the target applet; searching for the configuration file of the target applet according to the storage path of the target applet, and initializing the configuration file to a reset state.
[0013] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, obtaining the configuration file of the target applet and initializing it to a reset state includes: obtaining the configuration file of the target applet and the loading method of the target applet; initializing the target applet to a reset state according to the loading method of the target applet.
[0014] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, the applet management component controls the applet view to be displayed in the applet window container, including: determining whether there is a second applet window container in the layout file of the host application; when the second applet window container does not exist in the layout file, the applet management component controls the target applet view to be displayed in the first target applet window container; when the second applet window container exists in the layout file, comparing whether the applet view of the second applet window container is consistent with the target applet view; when the applet view is consistent with the target applet view, Figure 1 When the applet view is inconsistent with the target applet view, the applet management component reloads the target applet and displays it in the second applet window container; when the applet view is inconsistent with the target applet view, the applet management component controls the target applet view to be displayed in the first target applet window container.
[0015] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, when the applet view is inconsistent with the target applet view, the applet management component controls the target applet view to be displayed in the first target applet window container, including: when the applet view is inconsistent with the target applet view, the applet management component controls the applet to pause; the applet management component controls the target applet view to be displayed in the first target applet window container.
[0016] According to a third aspect of the present disclosure, a device for controlling mini-program page parameters is provided, the device comprising: an instruction acquisition module, for responding to a target mini-program startup instruction, acquiring a configuration file of the target mini-program and initializing it; a container acquisition module, for generating a target mini-program view according to the configuration file, and acquiring a pre-created first target mini-program window container in a layout file of a host application; and a program display module, for the mini-program management component to control the target mini-program view to be displayed in the first target mini-program window container with preset page parameters.
[0017] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method for controlling the mini-program page parameters as described in the first aspect of the above embodiment is implemented.
[0018] According to a fifth aspect of the present disclosure, there is provided an electronic device, including:
[0019] Processor; and
[0020] A storage device is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the control method of the mini-program page parameters as described in the first aspect of the above embodiment.
[0021] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0022] In a method for controlling the mini-program page parameters provided in an embodiment of the present disclosure, after obtaining the interface component of the host application, a mini-program management component can be created in the interface component, and then the layout file of the interface component is obtained, and a first target mini-program window container is set in the layout file, and then the first target mini-program window container is controlled by the mini-program management component to display the target mini-program. In an embodiment of the present disclosure, the page parameters of the window container used to display the mini-program can be adjusted, so that the display method of the mini-program is more diversified and the display method of the mini-program is more flexible, thereby improving the user experience.
[0023] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0025] Figure 1 A flowchart schematically shows a method for controlling a mini-program page parameter to which the present disclosure embodiment can be applied;
[0026] Figure 2 A flowchart schematically illustrates determining an interface component to be run from among multiple candidate components according to an application file loaded by a host application in an exemplary embodiment of the present disclosure;
[0027] Figure 3 A flowchart schematically shows the applet management component in the exemplary embodiment of the present disclosure controlling the target applet window container located at the top of the stack to display the target applet;
[0028] Figure 4 A flowchart schematically illustrating the control of applet page parameters in an exemplary embodiment of the present disclosure;
[0029] Figure 5 A flowchart schematically illustrates searching for a configuration file of a target applet according to a storage path of the target applet in an exemplary embodiment of the present disclosure;
[0030] Figure 6 A flowchart schematically illustrates initializing a target applet to a reset state according to a method for loading a target applet in an exemplary embodiment of the present disclosure;
[0031] Figure 7 A schematic diagram schematically showing the adjustment position of the first target applet window container in an exemplary embodiment of the present disclosure;
[0032] Figure 8 Schematically showing a flow chart for determining whether a second applet window container exists in a layout file of a host application in an exemplary embodiment of the present disclosure;
[0033] Fig. 9 Schematically showing a flow chart of the applet management component controlling the applet to pause and displaying the target applet view in the first target applet window container in an exemplary embodiment of the present disclosure;
[0034] Fig.10 A schematic diagram schematically illustrates the composition of a device for controlling a mini-program page parameter in an exemplary embodiment of the present disclosure;
[0035] Fig.11 The structure diagram of a computer system suitable for implementing the electronic device of the exemplary embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0036] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In addition, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known structures, methods, devices, implementations, materials, or operations are not shown or described in detail to avoid blurring various aspects of the present disclosure.
[0037] 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 may be implemented in software form, or these functional entities or parts of functional entities may be implemented in one or more software hardened modules, or these functional entities may be implemented in different networks and / or processor devices and / or microcontroller devices.
[0038] The control scheme of the mini-program page parameters in the present disclosure can be used to control various mini-programs. For different applications, the page parameters of the mini-program can be specifically adjusted according to the usage. For example, for a certain e-commerce application software, merchants can adjust the layout parameters of the mini-program according to their own business needs; for another example, for a certain travel application software, the customer service department can adjust the layout parameters of the mini-program according to their own business needs; for another example, for a certain chat and communication application software, users can adjust the layout parameters of the mini-program according to their own business needs. When opening the mini-program through the host application, the user can obtain the mini-program by scanning a QR code or searching. The present disclosure does not specifically limit the application scenarios of the control of the mini-program page parameters.
[0039] According to the method for controlling the applet page parameters provided in this exemplary embodiment, when the interface component of the host application is obtained, and the applet management component is created in the interface component, then the layout file of the interface component is obtained, and the first target applet window container is set in the layout file, and then the first target applet window container is controlled by the applet management component to display the target applet, wherein the first target applet window container has preset page parameters. Figure 1 As shown, the method for controlling the mini program page parameters may include the following steps:
[0040] Step S110: obtaining the interface component of the host application and creating a small program management component in the interface component;
[0041] Step S120: obtaining a layout file of the interface component, and setting a first target applet window container in the layout file, wherein the first target applet window container has preset page parameters;
[0042] Step S130: Control the first target applet window container to display the target applet through the applet management component.
[0043] In the method for controlling the mini-program page parameters provided in the present example implementation, the page parameters of the window container used to display the mini-program can be adjusted according to the first target mini-program window container having a preset parameter layout controlled by the management component, thereby making the display method of the mini-program more diversified and the display method of the mini-program more flexible, thereby improving the user experience.
[0044] Next, steps S110 to S130 of the method for controlling the mini-program page parameters in this exemplary embodiment will be described in more detail with reference to the accompanying drawings and embodiments.
[0045] Step S110, obtaining the interface component of the host application, and creating a mini-program management component in the interface component;
[0046] In an exemplary embodiment of the present disclosure, the host application is an application used based on a smart terminal, various programming languages that users can use, and application software compiled in various programming languages. The host application may include software installed on a smart phone, running based on a corresponding system, such as an iOS system, an Android system, a Windows mobile system, a Symbian system, a BlackBerry OS system, etc. The host application may include an office application, an Internet application, a multimedia application, a data analysis application, a work collaboration application, and a business application. It should be noted that the present disclosure does not specifically limit the type of the host application.
[0047] In an exemplary embodiment of the present disclosure, a host application may include an interface component, which may be used to form a host application. Generally speaking, a host application may include multiple components, and the interface component is used to display a screen. When a user uses a terminal device, he or she may interact with the content in the interface component to complete a task.
[0048] In an exemplary embodiment of the present disclosure, the interface component may include an activity component in an Android component. An activity component may provide a screen, and may interact with a user through the activity component. Different activity components may communicate through intents. Activity represents a screen that a user can see, and is mainly used to handle the overall work of an application, such as monitoring system events, displaying a specified View for the user, and starting other Activities. All application Activities inherit from the android.app.Activity class, which is a base class provided by Android. After other Activities inherit from this parent class, they implement various functions through the methods of the parent class.
[0049] Furthermore, the activity component has the following four states, including the Active / Running state. When a new Activity is launched and stacked, it is at the forefront of the screen and at the top of the stack. At this time, it is in an activated state that is visible and can interact with the user; it also includes the Paused state, which is the state when the Activity is covered by another transparent or Dialog-style Activity. At this time, it still maintains a connection with the window manager, and the system continues to maintain its internal state, so it is still visible, but it has lost focus and cannot interact with the user; it also includes the Stopped state, which is when the Activity is covered by another Activity, loses focus and is not visible; it also includes the Killed state, which is when the Activity is recycled by the system or is not started. When an Activity instance is created, destroyed, or another Activity is started, it switches between these four states, and the occurrence of this transition depends on the actions of the user program.
[0050] In an example embodiment of the present disclosure, a mini program is an application that can be used without downloading and is created based on a host application. Compared with general applications, the development cost of mini programs is lower, and mini programs can share the traffic of the host application to which they are attached, saving promotion costs; general applications call the core processor of the mobile phone to run, so whether it is APP, H5 or SAAS, there will often be problems such as delays and visual deformation, and in different mobile phone systems, different APPs and H5s will have problems such as incompatibility with the new system and incomplete function display, which will not appear in mini programs. Mini programs have a relatively unified development framework during their development stage. A large number of bugs caused during development are reduced. This allows mini programs to have a better user experience.
[0051] In an example embodiment of the present disclosure, the mini-program management component can complete functions such as managing the opening, closing, and rollback events of the mini-program. The mini-program management component is a common object associated with the component interface, and various objects in the interface component can be managed through the mini-program management component. In the scheme of the present disclosure, the mini-program management component can be used to control the mini-program to open in a specified container. The mini-program management component may include AppManager. It should be noted that the present disclosure does not specifically limit the specific form of the mini-program management component, as long as it can manage the mini-program.
[0052] In an exemplary embodiment of the present disclosure, the interface component of the host application can be obtained in advance, and the mini-program management component can be created in the interface component of the host application. Specifically, when obtaining the interface component of the host application, the storage path of the host application can be obtained first, and multiple components corresponding to the host application can be searched according to the storage path, and the interface component can be searched in the multiple components, and then the mini-program management component can be added to the interface component.
[0053] In an exemplary embodiment of the present disclosure, a host application may be started and an application file loaded by the host application may be obtained, and then an interface component to be run may be determined from a plurality of candidate components according to the application file. Figure 2 As shown, determining an interface component to be run from multiple candidate components according to an application file loaded by a host application may include the following steps S210 to S220:
[0054] Step S210, starting the host application and obtaining the application file loaded by the host application;
[0055] In an exemplary embodiment of the present disclosure, when it is necessary to obtain the interface component of the host application, the host application can be started first, and then the application file required to be loaded by the host application can be obtained. Specifically, a host application startup command can be sent, and at this time, the host application can call the host application application startup method to load the application file required for the host application startup, and the application file of the host application constitutes the host application.
[0056] Step S220: determining the interface component to be run from among multiple candidate components according to the application file.
[0057] In an exemplary embodiment of the present disclosure, after obtaining the application file of the host application, multiple candidate components in the application file can be obtained, and then the interface component to be run is determined from the multiple candidate components. For example, for the Android system, it includes an activity component, which is a visual interface for user operations. It provides a window for users to complete operation instructions and an entry point for users to interact; a Service component, which is usually used to process time-consuming logic in the background; a Broadcast Receive component, a broadcast receiver is a type of component that filters, accepts and responds to the broadcasts sent out, and a broadcast receiver can be used to allow an application to respond to an external time; a Content Provider component, which provides a specified data set to other applications. At this time, the candidate components are the activity component, the Service component, the Broadcast Receive component, and the Content Provider component, and the activity component can be obtained from these components.
[0058] Through the above steps S210 to S220, the host application can be started and the application file loaded by the host application can be obtained, and then the interface component to be run is determined from multiple candidate components according to the application file, which makes it convenient for developers to find and configure the interface component.
[0059] Step S120, obtaining a layout file of the interface component, and setting a first target applet window container in the layout file;
[0060] In an exemplary embodiment of the present disclosure, a layout file determines the state and elements to be displayed by a certain application. For example, for the Android system, the layout file can be a layout file, which can be declared in two ways: (1) defining UI elements in an XML file: Android provides tags related to the View class and its subclasses; (2) defining the layout at runtime, that is, completing the layout in code.
[0061] In an example embodiment of the present disclosure, the first target applet window container can be used to display the applet. Specifically, the first target applet window container has preset page parameters, and the page parameters include the position, size and other parameters of the first target applet window container. For the Android system, the life cycle of the applet can be defined as follows: onStart: indicates that the applet is started, and the real view and business logic of the applet are initialized here; OnResume: indicates that the applet enters the foreground, is visible to the user, and is the focus of the user's current operation, and is used to notify and wake up the applet business logic, such as continuing audio and video playback; OnPause: indicates that the applet enters the background, is temporarily invisible to the user, and is used to notify and pause the applet business logic, such as pausing background audio and video playback; OnRemove: indicates that the applet is deleted, and is used to destroy, stop, and destroy the applet business logic. The system will also clean up and update the App stack and view container.
[0062] In an exemplary embodiment of the present disclosure, after obtaining the interface component of the host application and creating a small program management component in the interface component, the layout file of the interface component can be obtained, and then the first target small program window container can be set in the layout file.
[0063] Step S130, controlling the first target applet window container to display the target applet through the applet management component;
[0064] In an exemplary embodiment of the present disclosure, after creating a mini-program management component in an interface component and setting a first target mini-program window container in a layout file, the mini-program management component can be used to control the first target mini-program window container to display the target mini-program. Specifically, the interface component can be controlled by the management component so that the mini-program is opened in the layout file in the interface component, thereby causing the target mini-program to be displayed in the first target mini-program window container. Furthermore, the page parameters of the first target mini-program window container can be adjusted in the interface component to facilitate control of the display status of the first target mini-program window container.
[0065] In an exemplary embodiment of the present disclosure, the applet management component may obtain a stack of target applet window containers, and then the applet management component controls the target applet window container at the top of the stack to display the target applet. Figure 3 As shown, the applet management component controls the target applet window container at the top of the stack to display the target applet, which may include the following steps S310-S320:
[0066] Step S310, the applet management component obtains the stack of the target applet window container;
[0067] In an example embodiment of the present disclosure, the applet management component can obtain the stack of the target applet window container. Specifically, a stack is a data structure, which is a linear list that can perform insertion or deletion operations at the end of the table. Data is stored according to the last-in-first-out principle. The first data entered is pushed to the bottom of the stack, and the last data is at the top of the stack. When data needs to be read, data is popped from the top of the stack. A stack is a special linear list that can only be inserted and deleted at one end. The first data that is piled in is pressed at the bottom, and then piled up one by one. When taking away, you can only take one by one from the top. Reading and taking are both performed at the top, and the bottom is generally immobile. A stack is a data structure similar to a bucket that stacks items. The end where deletion and insertion are performed is called the top of the stack, and the other end is called the bottom of the stack. Insertion is generally called pushing, and deletion is called popping.
[0068] Step S320: the applet management component controls the target applet at the top of the stack to be displayed in the first target applet window container.
[0069] In an exemplary embodiment of the present disclosure, after the stack of the target applet window container is obtained through the above steps, the applet management component can be used to control the target applet at the top of the stack. Specifically, the target applet at the top of the stack can be obtained. At this time, the target applet is located at the top layer of the first target applet window container, and the target applet can be displayed through the first target applet window container. Furthermore, in response to the user's rollback event, the first target applet window container can determine whether the target applet at the current top of the stack can roll back. If it can, it will roll back one page. If not, it will pop out the applet at the top of the stack and remove it. At the same time, it determines whether there is a new applet at the top of the stack. If so, it will wake up the new applet at the top of the stack and call the life cycle of the applet at the top of the stack.
[0070] Through the above steps S310 to S320, the applet management component can obtain the stack of the first target applet window container, and then the applet management component controls the target applet at the top of the stack to be displayed in the first target applet window container.
[0071] In an example embodiment of the present disclosure, by creating a mini-program management component in an interface component in a host application and setting a first target mini-program window container in a layout file, and then controlling the first target mini-program window container to display the target mini-program through the mini-program management component, the page parameters of the window container used to display the mini-program can be adjusted, making the display method of the mini-program more diversified and the display method of the mini-program more flexible, thereby improving the user experience.
[0072] In an exemplary embodiment of the present disclosure, a method for controlling a mini-program page parameter is also provided. Figure 4As shown, a method for controlling the parameters of a mini program page may include the following steps:
[0073] S410: In response to the target applet start instruction, obtain the configuration file of the target applet and initialize it to a reset state;
[0074] S420: Generate a target applet view according to the configuration file, and obtain a pre-created first target applet window container in the layout file of the host application;
[0075] S430: The applet management component controls the target applet view to be displayed in a first target applet window container having preset page parameters.
[0076] In the method for controlling the mini-program page parameters provided in the present example implementation, the page parameters of the window container used to display the mini-program can be adjusted according to the first target mini-program window container having a preset parameter layout controlled by the management component, thereby making the display method of the mini-program more diversified and the display method of the mini-program more flexible, thereby improving the user experience.
[0077] Next, steps S410 to S430 of the method for controlling the mini-program page parameters in this exemplary embodiment will be described in more detail with reference to the accompanying drawings and embodiments.
[0078] Step S410, in response to the target applet start instruction, obtain the configuration file of the target applet and initialize it to a reset state;
[0079] In an example embodiment of the present disclosure, a user can input the target mini-program startup instruction by clicking on the screen of a terminal device or scanning a QR code. The mini-program includes the following life cycle events, including onStart: obtaining mini-program information, mini-program package management, startup page, jumping to error page, initializing mini-program view AppView, initializing runtime, binding data and other operations. onResume: Notify the runtime to enter the foreground, so that it calls back to the mini-program business wake-up related logic. onPause: Notify the runtime to enter the background, so that it calls back to the mini-program business pause related logic. onRemove: Mainly cleans up the mini-program data and mini-program view, stops and destroys the runtime, so that it calls back to the mini-program business stop and destruction related logic.
[0080] After obtaining the target applet startup instruction, the configuration file of the target applet can be obtained. The configuration file of the target applet may include various component files of the target applet, and the on Start and on Resume life cycles of the target applet are executed to initialize the target applet to a reset state.
[0081] In an exemplary embodiment of the present disclosure, a target applet startup instruction may be obtained, and then a configuration file of the target applet is searched according to the storage path of the target applet, and the configuration file is initialized to a reset state. Figure 5 As shown, searching for the configuration file of the target applet according to the storage path of the target applet may include the following steps S510 to S520:
[0082] Step S510, obtaining a target applet startup instruction, wherein the target applet startup instruction includes a storage path of the target applet;
[0083] In an exemplary embodiment of the present disclosure, after obtaining the target applet startup instruction, the storage path of the target applet included in the target applet startup instruction can be obtained. Specifically, the storage path of the target applet can be set in advance to facilitate searching for the target applet based on the storage path.
[0084] Step S520, searching for a configuration file of the target applet according to the storage path of the target applet, and initializing the configuration file to a reset state. The file and / or folder line of the configuration file of the target applet can be searched in the terminal device or the server.
[0085] In an exemplary embodiment of the present disclosure, after obtaining the storage path of the target applet in the above step, the configuration file of the target applet can be searched through the storage path of the target applet, and then the configuration file of the target applet is initialized to a reset state.
[0086] For example, when the storage path of the target applet is l1-l2-l3, it means that the configuration file of the target applet is stored in the folder l3 in the subfolder l2 in the folder l1; or, it can also mean that the configuration file of the target applet is a file named l3 in the subfolder l2 stored in the folder l1. It should be noted that the present disclosure does not specifically limit the form of the storage path, as long as the configuration file of the target applet can be found according to the storage path.
[0087] Through the above steps S510 to S520, the target applet startup instruction can be obtained, and then the configuration file of the target applet is searched according to the storage path of the target applet, and the configuration file is initialized to a reset state, which can facilitate the search for the configuration file of the target applet.
[0088] In an exemplary embodiment of the present disclosure, a configuration file of a target applet and a loading method of the target applet may be obtained, and the target applet may be initialized to a reset state according to the loading method of the target applet. Figure 6As shown, initializing the target applet to a reset state according to the target applet loading method may include the following steps S610-S620:
[0089] Step S610, obtaining a configuration file of a target applet and a method for loading the target applet;
[0090] In an example embodiment of the present disclosure, a configuration file of a target applet can be obtained, and a loading method of the target applet can be obtained. Specifically, when starting the target applet, the configuration file of the target applet needs to be loaded through the loading method. The loading method of the target applet can be stored in the configuration file of the host application, or can be stored separately in the terminal device or server. When the target applet needs to be started, the loading method of these target applet can be called in the terminal device or server.
[0091] Step S620: Initialize the target applet to a reset state according to the target applet loading method.
[0092] In an exemplary embodiment of the present disclosure, after obtaining the configuration file of the target applet and the loading method of the target applet, the target applet can be initialized to a reset state according to the loading method of the target applet. Specifically, the loading method of the target applet can load relevant information of the target applet. For example, the name of the applet, user data, applet ID, etc., and assign this information to the target applet, and initialize the target applet to a reset state.
[0093] Through the above steps S610 to S620, the configuration file of the target applet and the loading method of the target applet can be obtained, and the target applet can be initialized to a reset state according to the loading method of the target applet.
[0094] Step S420, generating a target applet view according to the configuration file, and obtaining a pre-created first target applet window container in the layout file of the host application;
[0095] In an exemplary embodiment of the present disclosure, a target applet view can be generated according to the configuration file of the target applet obtained in the above steps. For example, for an Android system, an appView can be generated according to the configuration file of the target applet, and the appView mainly displays views and data and responds to user operations, such as navigation bar, menu bar, back events, etc. After the target applet view is generated according to the configuration file, the pre-created first target applet window container can be obtained in the layout file of the host application.
[0096] Step S430: the applet management component controls the target applet view to be displayed in a first target applet window container having preset page parameters.
[0097] In an exemplary embodiment of the present disclosure, after the configuration file of the target applet is initialized to a reset state, a target applet view is generated according to the configuration file, and a first target applet window container is obtained, the target applet view can be controlled by the applet management component to be displayed in the first target applet window container with preset page parameters.
[0098] Specifically, the applet management component can control the opening and closing of the target applet. After acquiring the above items, the applet management component can control the target applet view to open in the first target applet window container, wherein the first target applet window container has preset page parameters, and the page parameters include parameters such as the position and size of the first target applet window container. The position parameter of the first target applet window container indicates the display position of the first target applet window container in the layout file of the host application, in other words, the position of the target applet on the display screen; the size parameter of the first target applet window container indicates the size parameter of the first target applet window container in the layout file of the host application, in other words, the size of the target applet on the display screen.
[0099] For example, Figure 7 As shown, the layout file of the host application 710 may include an XOY coordinate system, and the intersection point p1 of the midline of the long side and the short side of the target applet 720 may be used as the position of the target applet. The position of the target applet in the host application can be controlled by adjusting the coordinates of p1; the size of the target applet can also be controlled by adjusting the length of the long side and the short side of the first target applet window container.
[0100] In an exemplary embodiment of the present disclosure, a configuration file of a target applet is initialized to a reset state, a target applet view is generated according to the configuration file, and after obtaining a first target applet window container, it is possible to determine whether a second applet window container exists in a layout file of the host application. When the second applet window container does not exist in the layout file, the applet management component controls the target applet view to be displayed in the first target applet window container. When the second applet window container exists in the layout file, the applet view of the second applet window container is compared with the target applet view to see if they are consistent. When the applet view is consistent with the target applet view, the applet management component controls the target applet view to be displayed in the first target applet window container. Figure 1 When the applet view is inconsistent with the target applet view, the applet management component reloads the target applet and displays it in the second applet window container. When the applet view is inconsistent with the target applet view, the applet management component controls the target applet view to be displayed in the first target applet window container. Figure 8As shown, determining whether there is a second applet window container in the layout file of the host application may include the following steps S810 to S850:
[0101] Step S810, determining whether there is a second applet window container in the layout file of the host application;
[0102] In an exemplary embodiment of the present disclosure, the configuration file of the target applet is initialized to a reset state, the target applet view is generated according to the configuration file, and after obtaining the first target applet window container, the layout file of the host application can be obtained, and the layout file is searched for whether there is a second applet window container. Specifically, through this step, it can be detected whether there are other applet window containers in the current layout file.
[0103] Step S820, when the second applet window container does not exist in the layout file, the applet management component controls the target applet view to be displayed in the first target applet window container;
[0104] In an exemplary embodiment of the present disclosure, after detecting the layout file, if the second applet window container is not found in the layout file, it indicates that there are no other applet window containers in the layout file of the host application. At this time, the applet management component can control the target applet view to be displayed in the first target applet window container.
[0105] Step S830, when there is a second applet window container in the layout file, comparing whether the applet view of the second applet window container is consistent with the target applet view;
[0106] In an exemplary embodiment of the present disclosure, after the layout file is detected, when the second applet window container is found in the layout file, it means that the layout file of the host application includes other applet window containers. At this time, it can be determined whether the applet view in the second applet window container is consistent with the applet view obtained in the above step.
[0107] Step S840: When the mini-program view and the target mini-program view Figure 1 When the target applet is reached, the applet management component reloads the target applet and displays it in the second applet window container;
[0108] In an exemplary embodiment of the present disclosure, it is determined that the applet view in the second applet window container is consistent with the applet view obtained in the above step. Figure 1 When the target applet is opened, it means that a applet window container has been written into the layout file of the host application, and the target applet is opened in the applet window container. At this time, the applet management component can reload the target applet and then display it directly in the second applet window container.
[0109] Step S850: When the applet view is inconsistent with the target applet view, the applet management component controls the target applet view to be displayed in the first target applet window container.
[0110] In an exemplary embodiment of the present disclosure, when it is determined that the applet view in the second applet window container is inconsistent with the applet view obtained in the above step, it means that an applet window container has been written into the layout file of the host application, but other applet is opened in this applet window container, which is not the target applet. At this time, the applet management component can control the target applet view to be displayed in the first target applet window container.
[0111] Through the above steps S810 to S850, it can be determined whether the host application includes other mini-program window containers. When other mini-program window containers are included, the mini-program views in the other mini-program window containers can be compared with the target mini-program views obtained in the above steps, so that the target mini-program is displayed in the first target mini-program window container or the second mini-program window container.
[0112] In an exemplary embodiment of the present disclosure, when the applet view is inconsistent with the target applet view, the applet management component controls the applet to suspend, and the applet management component can control the target applet view to be displayed in the first target applet window container. Fig. 9 As shown, the applet management component controls the applet to pause and displays the target applet view in the first target applet window container, which may include the following steps S910-S920:
[0113] Step S910, when the mini-program view is inconsistent with the target mini-program view, the mini-program management component controls the mini-program to pause;
[0114] In an example embodiment of the present disclosure, after the applet view in the second applet window container is obtained, the applet view can be compared with the target second applet view. When the applet view is inconsistent with the target applet view, the pause method of the applet can be called to pause the applet in the second applet window container.
[0115] Step S920: the applet management component controls the target applet view to be displayed in the first target applet window container.
[0116] In an exemplary embodiment of the present disclosure, after pausing the applet in the second applet window container, the first target applet window container and the target applet view obtained in the above steps can be obtained, and the applet management component can be used to control the target applet view to be displayed in the first target applet window container.
[0117] Through the above steps S910 to S920, when the applet view is inconsistent with the target applet view, the applet management component controls the applet to pause, and the applet management component can control the target applet view to be displayed in the first target applet window container.
[0118] In an example embodiment of the present disclosure, after obtaining the interface component of the host application, a small program management component can be created in the interface component, and then the layout file of the interface component is obtained, and the first target small program window container is set in the layout file, and then the first target small program window container is controlled by the small program management component to display the target small program. In the embodiment of the present disclosure, the page parameters of the window container used to display the small program can be adjusted, so that the display method of the small program is more diversified and the display method of the small program is more flexible, thereby improving the user experience.
[0119] It should be noted that the above figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0120] In addition, in an exemplary embodiment of the present disclosure, a device for controlling a mini-program page parameter is also provided. Fig.10 As shown, a device 1000 for controlling mini-program page parameters includes: an instruction acquisition module 1010, a container acquisition module 1020, and a program display module 1030.
[0121] Among them, the instruction acquisition module is used to respond to the target applet startup instruction, obtain the configuration file of the target applet and initialize it; the container acquisition module is used to generate the target applet view according to the configuration file, and obtain the pre-created first target applet window container in the layout file of the host application; the program display module is used for the applet management component to control the target applet view to be displayed in the first target applet window container with preset page parameters.
[0122] In an exemplary embodiment of the present disclosure, based on the above-mentioned scheme, obtaining the interface component of the host application includes: starting the host application and obtaining the application file loaded by the host application; and determining the interface component to be run from multiple candidate components according to the application file.
[0123] In an exemplary embodiment of the present disclosure, based on the aforementioned scheme, the target applet window container is controlled by the applet management component to display the target applet, including: the applet management component obtains the stack of target applet window containers; the applet management component controls the first target applet window container at the top of the stack to display the target applet.
[0124] Since the various functional modules of the device for controlling mini-program page parameters in the example embodiment of the present disclosure correspond to the steps of the example embodiment of the method for controlling mini-program page parameters mentioned above, for details not disclosed in the device embodiment of the present disclosure, please refer to the embodiment of the method for controlling mini-program page parameters mentioned above in the present disclosure.
[0125] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0126] In addition, in an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above-mentioned subprogram generation method is also provided.
[0127] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware embodiments, complete software embodiments (including firmware, microcode, etc.), or embodiments combining hardware and software aspects, which may be collectively referred to herein as "circuits", "modules" or "systems".
[0128] Refer to the following Fig.11 1100 according to this embodiment of the present disclosure is described. Fig.11 The electronic device 1100 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0129] like Fig.11 As shown, the electronic device 1100 is in the form of a general computing device. The components of the electronic device 1100 may include, but are not limited to: the at least one processing unit 1110, the at least one storage unit 1120, a bus 1130 connecting different system components (including the storage unit 1120 and the processing unit 1110), and a display unit 1140.
[0130] The storage unit stores program codes, which can be executed by the processing unit 1110, so that the processing unit 1110 executes the steps according to various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification. For example, the processing unit 1110 can execute the following steps: Figure 1 Step S110 shown in: obtaining the interface component of the host application and creating a mini-program management component in the interface component; step S110: obtaining the layout file of the interface component and setting a first target mini-program window container in the layout file, wherein the first target mini-program window container has preset page parameters; step S130: controlling the first target mini-program window container to display the target mini-program through the mini-program management component.
[0131] For example, electronic devices can achieve Figure 1 The steps shown.
[0132] The storage unit 1120 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 1121 and / or a cache memory unit 1122 , and may further include a read-only memory unit (ROM) 1123 .
[0133] The storage unit 1120 may also include a program / utility 1124 having a set (at least one) of program modules 1125, such program modules 1125 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0134] Bus 1130 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0135] The electronic device 1100 may also communicate with one or more external devices 1170 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1100, and / or communicate with any device that enables the electronic device 1100 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1150. Furthermore, the electronic device 1100 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 1160. As shown, the network adapter 1160 communicates with other modules of the electronic device 1100 via a bus 1130. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1100, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0136] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiment of the present disclosure.
[0137] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible embodiments, various aspects of the present disclosure can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present disclosure described in the above "Exemplary Method" section of the present specification.
[0138] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0139] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0140] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0141] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0142] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0143] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for controlling parameters of a mini program page, characterized in that: include: Obtaining an interface component of a host application and creating a mini-program management component in the interface component; Obtaining a layout file of the interface component, and setting a first target applet window container in the layout file; wherein the first target applet window container has preset page parameters; Controlling the first target applet window container to display the target applet through the applet management component; The page parameters of the first target applet window container are adjusted in the interface component; the page parameters include the position and size of the first target applet window container.
2. The method according to claim 1, characterized in that The step of obtaining the interface component of the host application comprises: Starting the host application and obtaining the application file loaded by the host application; An interface component to be run is determined from a plurality of candidate components according to the application file.
3. The method according to claim 1, characterized in that Controlling the target applet window container to display the target applet according to the applet management component includes: The applet management component obtains the stack of the target applet window container; The applet management component controls the target applet located at the top of the stack to be displayed in the first target applet window container.
4. A method for controlling parameters of a mini program page, characterized in that: include: In response to a target applet start instruction, obtaining a configuration file of the target applet and initializing it to a reset state; Generate a target applet view according to the configuration file, and obtain a pre-created first target applet window container in the layout file of the host application; The applet management component controls the target applet view to be displayed in the first target applet window container having preset page parameters; The position of the target applet in the host application is controlled by adjusting the position coordinates of the first target applet window container; the size of the target applet is controlled by adjusting the lengths of the long side and the short side of the first target applet window container.
5. The method according to claim 4, characterized in that The step of obtaining the configuration file of the target applet and initializing it to a reset state includes: Obtaining the target applet startup instruction, wherein the target applet startup instruction includes a storage path of the target applet; The configuration file of the target applet is searched according to the storage path of the target applet, and the configuration file is initialized to a reset state.
6. The method according to claim 4, characterized in that The step of obtaining the configuration file of the target applet and initializing it to a reset state includes: Obtain a configuration file of the target applet and a method for loading the target applet; The target applet is initialized to a reset state according to the loading method of the target applet.
7. The method according to claim 4, characterized in that The applet management component controls the applet view to be displayed in the applet window container, including: Determine whether a second applet window container exists in the layout file of the host application; When the second applet window container does not exist in the layout file, the applet management component controls the target applet view to be displayed in the first target applet window container; When there is a second applet window container in the layout file, comparing whether the applet view of the second applet window container is consistent with the target applet view; When the applet view is consistent with the target applet view, the applet management component reloads the target applet and displays it in the second applet window container; When the applet view is inconsistent with the target applet view, the applet management component controls the target applet view to be displayed in the first target applet window container.
8. The method according to claim 7, characterized in that When the applet view is inconsistent with the target applet view, the applet management component controls the target applet view to be displayed in the first target applet window container, including: When the applet view is inconsistent with the target applet view, the applet management component controls the applet to pause; The applet management component controls the target applet view to be displayed in the first target applet window container.
9. A device for controlling parameters of a mini-program page, characterized in that: The device comprises: An instruction acquisition module, used to respond to a target applet startup instruction, acquire a configuration file of the target applet and initialize it; A container acquisition module, used to generate a target applet view according to the configuration file, and acquire a pre-created first target applet window container in the layout file of the host application; A program display module, used for the mini-program management component to control the target mini-program view to be displayed in the first target mini-program window container with preset page parameters; Among them, the position of the target applet in the host application is controlled by adjusting the position coordinates of the first target applet window container; the size of the target applet is controlled by adjusting the length of the long side and the short side of the first target applet window container.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
11. An electronic device, characterized in that: include: processor; as well as A memory, used to store one or more programs, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Applet control method and device, equipment and medium
CN111026462A
Method and device for embedding applet in browser page
CN111176752A