CN114647473A - Page display method, device and terminal device - Google Patents
Page display method, device and terminal device Download PDFInfo
- Publication number
- CN114647473A CN114647473A CN202210317302.6A CN202210317302A CN114647473A CN 114647473 A CN114647473 A CN 114647473A CN 202210317302 A CN202210317302 A CN 202210317302A CN 114647473 A CN114647473 A CN 114647473A
- Authority
- CN
- China
- Prior art keywords
- theme
- information
- page
- switched
- display
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- User Interface Of Digital Computer (AREA)
- Stored Programmes (AREA)
Abstract
本申请提供一种页面显示方法、装置及终端设备,该方法包括:接收第一应用的主题切换请求,所述主题切换请求中包括待切换主题的标识,所述第一应用中包括多个小程序;根据所述待切换主题的标识,在数据包中获取所述待切换主题的主题信息,所述数据包中包括多个主题的主题信息;根据所述待切换主题的主题信息,更新所述多个小程序的显示页面。降低小程序的复杂度。
The present application provides a page display method, device and terminal device, the method includes: receiving a theme switching request of a first application, the theme switching request includes an identifier of a theme to be switched, and the first application includes a plurality of small program; according to the identification of the to-be-switched theme, obtain the theme information of the to-be-switched theme in a data packet, and the data packet includes the theme information of a plurality of themes; update all the theme information according to the theme information of the to-be-switched theme The display pages of the multiple applets described above. Reduce the complexity of the applet.
Description
技术领域technical field
本申请涉及数据处理技术领域,尤其涉及一种页面显示方法、装置及终端设备。The present application relates to the technical field of data processing, and in particular, to a page display method, apparatus and terminal device.
背景技术Background technique
应用程序中可以包括多个小程序,通过选择小程序的主题,可以改变小程序的显示页面。An application can include multiple applets, and by selecting the theme of the applets, the display page of the applets can be changed.
目前,可以通过内联的方式,将小程序的主题写入到小程序的开发框架中,以使小程序可以更换显示的主题。例如,通过内联的方式,将需要修改的页面元素的值动态的写入到对应的页面元素的标签中,进而实现小程序的多主题切换。但是,这样需要对小程序的底层业务逻辑进行修改,进而导致小程序的复杂度较高。At present, the theme of the applet can be written into the development framework of the applet in an inline manner, so that the applet can change the displayed theme. For example, in an inline manner, the value of the page element that needs to be modified is dynamically written into the tag of the corresponding page element, thereby realizing multi-theme switching of the applet. However, in this way, the underlying business logic of the applet needs to be modified, which in turn leads to high complexity of the applet.
发明内容SUMMARY OF THE INVENTION
本申请提供一种页面显示方法、装置及终端设备,用于解决现有技术中小程序的复杂度较高的技术问题。The present application provides a page display method, device and terminal device, which are used to solve the technical problem of high complexity of small programs in the prior art.
第一方面,本申请提供一种页面显示方法,该方法包括:In a first aspect, the present application provides a method for displaying a page, the method comprising:
接收第一应用的主题切换请求,所述主题切换请求中包括待切换主题的标识,所述第一应用中包括多个小程序;receiving a theme switching request from a first application, where the theme switching request includes an identifier of a theme to be switched, and the first application includes a plurality of small programs;
根据所述待切换主题的标识,在数据包中获取所述待切换主题的主题信息,所述数据包中包括多个主题的主题信息;According to the identification of the to-be-switched theme, obtain the theme information of the to-be-switched theme in a data packet, and the data packet includes the theme information of a plurality of themes;
根据所述待切换主题的主题信息,更新所述多个小程序的显示页面。According to the theme information of the to-be-switched theme, the display pages of the plurality of small programs are updated.
在一种可能的实施方式中,针对于任意一个小程序的显示页面;根据所述待切换主题的主题信息,更新所述小程序的显示页面,包括:In a possible implementation, for the display page of any applet; according to the theme information of the theme to be switched, updating the display page of the applet includes:
获取所述显示页面的第一页面信息,所述第一页面信息包括所述显示页面中每个节点当前显示的主题样式;acquiring first page information of the display page, where the first page information includes the theme style currently displayed by each node in the display page;
根据所述待切换主题的主题信息,对所述显示页面中的每个节点进行虚拟渲染,得到第二页面信息,所述第二页面信息包括所述显示页面中每个节点虚拟渲染之后的主题样式;According to the theme information of the theme to be switched, virtual rendering is performed on each node in the display page to obtain second page information, where the second page information includes the theme after virtual rendering of each node in the display page style;
根据所述第一页面信息和所述第二页面信息,更新所述小程序的显示页面。The display page of the applet is updated according to the first page information and the second page information.
在一种可能的实施方式中,根据所述第一页面信息和所述第二页面信息,更新所述小程序的显示页面,包括:In a possible implementation manner, updating the display page of the applet according to the first page information and the second page information includes:
确定所述第一页面信息中的所述每个节点与所述第二页面信息中的所述每个节点之间的第一对应关系;determining a first correspondence between the each node in the first page information and the each node in the second page information;
根据所述第一对应关系和所述第二页面信息,在所述第一页面信息中确定目标节点,所述目标节点为待更新主题样式的节点;According to the first correspondence and the second page information, a target node is determined in the first page information, and the target node is the node of the theme style to be updated;
对所述目标节点的主题样式进行更新,以更新所述小程序的显示页面。The theme style of the target node is updated to update the display page of the applet.
在一种可能的实施方式中,所述主题样式包括至少一个主题参数;对所述目标节点的主题样式进行更新,以更新所述小程序的显示页面,包括:In a possible implementation manner, the theme style includes at least one theme parameter; the theme style of the target node is updated to update the display page of the applet, including:
在所述目标节点的主题样式中确定目标主题参数,所述目标主题参数为待更新的主题参数;Determine a target theme parameter in the theme style of the target node, and the target theme parameter is the theme parameter to be updated;
对所述目标主题参数进行更新,以更新所述小程序的显示页面。The target theme parameter is updated to update the display page of the applet.
在一种可能的实施方式中,在数据包中获取所述待切换主题的主题信息之前,所述方法还包括:In a possible implementation manner, before acquiring the topic information of the topic to be switched in the data packet, the method further includes:
获取至少一个主题的主题信息;Get topic information for at least one topic;
将所述至少一个主题的主题信息存储至所述数据包。The topic information of the at least one topic is stored to the data package.
在一种可能的实施方式中,获取至少一个主题的主题信息,包括:In a possible implementation, acquiring subject information of at least one subject includes:
获取所述至少一个主题对应的主题模板,所述主题模板中包括多个主题参数变量;Obtain a theme template corresponding to the at least one theme, where the theme template includes a plurality of theme parameter variables;
根据所述多个主题参数变量,获取所述主题的主题信息。The topic information of the topic is acquired according to the plurality of topic parameter variables.
在一种可能的实施方式中,根据所述多个主题参数变量,获取所述主题的主题信息,包括:In a possible implementation manner, acquiring topic information of the topic according to the plurality of topic parameter variables, including:
在所述主题模板的主题参数变量中添加对应的主题参数,得到主题样式;Adding corresponding theme parameters to the theme parameter variables of the theme template to obtain theme styles;
通过编译器对所述主题样式进行编译,得到所述主题的主题信息。The theme style is compiled by a compiler to obtain theme information of the theme.
第二方面,本申请提供一种页面显示装置,该页面显示装置包括接收模块、第一获取模块和更新模块,其中:In a second aspect, the present application provides a page display device, the page display device includes a receiving module, a first acquiring module and an updating module, wherein:
所述接收模块用于,接收第一应用的主题切换请求,所述主题切换请求中包括待切换主题的标识,所述第一应用中包括多个小程序;The receiving module is configured to receive a theme switching request of a first application, where the theme switching request includes an identifier of a theme to be switched, and the first application includes a plurality of small programs;
所述第一获取模块用于,根据所述待切换主题的标识,在数据包中获取所述待切换主题的主题信息,所述数据包中包括多个主题的主题信息;The first obtaining module is configured to, according to the identifier of the theme to be switched, obtain the theme information of the theme to be switched in a data package, where the data package includes theme information of a plurality of themes;
所述更新模块用于,根据所述待切换主题的主题信息,更新所述多个小程序的显示页面。The updating module is configured to update the display pages of the plurality of small programs according to the theme information of the theme to be switched.
在一种可能的实施方式中,所述更新模块具体用于:In a possible implementation, the update module is specifically used for:
获取所述显示页面的第一页面信息,所述第一页面信息包括所述显示页面中每个节点当前显示的主题样式;acquiring first page information of the display page, where the first page information includes the theme style currently displayed by each node in the display page;
根据所述待切换主题的主题信息,对所述显示页面中的每个节点进行虚拟渲染,得到第二页面信息,所述第二页面信息包括所述显示页面中每个节点虚拟渲染之后的主题样式;According to the theme information of the theme to be switched, virtual rendering is performed on each node in the display page to obtain second page information, where the second page information includes the theme after virtual rendering of each node in the display page style;
根据所述第一页面信息和所述第二页面信息,更新所述小程序的显示页面。The display page of the applet is updated according to the first page information and the second page information.
在一种可能的实施方式中,所述更新模块具体用于:In a possible implementation, the update module is specifically used for:
确定所述第一页面信息中的所述每个节点与所述第二页面信息中的所述每个节点之间的第一对应关系;determining a first correspondence between the each node in the first page information and the each node in the second page information;
根据所述第一对应关系和所述第二页面信息,在所述第一页面信息中确定目标节点,所述目标节点为待更新主题样式的节点;According to the first correspondence and the second page information, a target node is determined in the first page information, and the target node is the node of the theme style to be updated;
对所述目标节点的主题样式进行更新,以更新所述小程序的显示页面。The theme style of the target node is updated to update the display page of the applet.
在一种可能的实施方式中,所述更新模块具体用于:In a possible implementation, the update module is specifically used for:
在所述目标节点的主题样式中确定目标主题参数,所述目标主题参数为待更新的主题参数;Determine a target theme parameter in the theme style of the target node, and the target theme parameter is the theme parameter to be updated;
对所述目标主题参数进行更新,以更新所述小程序的显示页面。The target theme parameter is updated to update the display page of the applet.
在一种可能的实施方式中,所述页面显示装置还包括第二获取模块,所述第二获取模块用于:In a possible implementation manner, the page display apparatus further includes a second obtaining module, and the second obtaining module is used for:
获取至少一个主题的主题信息;Get topic information for at least one topic;
将所述至少一个主题的主题信息存储至所述数据包。The topic information of the at least one topic is stored to the data package.
在一种可能的实施方式中,所述第二获取模块具体用于:In a possible implementation manner, the second obtaining module is specifically used for:
获取所述至少一个主题对应的主题模板,所述主题模板中包括多个主题参数变量;Obtain a theme template corresponding to the at least one theme, where the theme template includes a plurality of theme parameter variables;
根据所述多个主题参数变量,获取所述主题的主题信息。The topic information of the topic is acquired according to the plurality of topic parameter variables.
在一种可能的实施方式中,所述第二获取模块具体用于:In a possible implementation manner, the second obtaining module is specifically used for:
在所述主题模板的主题参数变量中添加对应的主题参数,得到主题样式;Adding corresponding theme parameters to the theme parameter variables of the theme template to obtain theme styles;
通过编译器对所述主题样式进行编译,得到所述主题的主题信息。The theme style is compiled by a compiler to obtain theme information of the theme.
第三方面,本申请提供一种终端设备,包括:处理器、存储器;In a third aspect, the present application provides a terminal device, including: a processor and a memory;
所述存储器存储计算机执行指令;the memory stores computer-executable instructions;
所述处理器执行所述存储器存储的计算机执行指令,使得所述处理器执行如第一方面所述的页面显示方法。The processor executes the computer-executable instructions stored in the memory, so that the processor executes the page display method according to the first aspect.
第四方面,本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,当所述计算机执行指令被处理器执行时用于实现前述任一项所述的页面显示方法。In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and when the computer-executable instructions are executed by a processor, are used to implement any of the foregoing. the page display method described above.
第五方面,本申请还提供一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现如前述任一项所述的页面显示方法的步骤。In a fifth aspect, the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the page display method according to any one of the preceding items.
本申请提供一种页面显示方法、装置及终端设备,接收第一应用的主题切换请求,其中,主题切换请求中包括待切换主题的标识,第一应用中包括多个小程序,根据待切换主题的标识,在数据包中获取待切换主题的主题信息,其中,数据包中包括多个主题的主题信息,根据待切换主题的主题信息,更新多个小程序的显示页面。根据上述方法,终端设备可以直接在数据包中调用小程序的待切换主题的主题信息,进而根据待切换主题的主题信息,对小程序的显示页面进行更新,这样,在切换小程序的主题时,无需在小程序中写入对应的主题代码,进而降低小程序的复杂度。The present application provides a page display method, device and terminal device for receiving a theme switching request of a first application, wherein the theme switching request includes an identifier of a theme to be switched, and the first application includes a plurality of small programs, according to the theme to be switched The identifier of the to-be-switched theme is obtained in the data package, wherein the data package includes the theme information of multiple themes, and the display pages of the multiple applets are updated according to the theme information of the to-be-switched theme. According to the above method, the terminal device can directly call the theme information of the theme to be switched of the applet in the data packet, and then update the display page of the applet according to the theme information of the theme to be switched. In this way, when switching the theme of the applet , there is no need to write the corresponding theme code in the applet, thereby reducing the complexity of the applet.
附图说明Description of drawings
图1为本申请实施例提供的一种应用场景示意图;1 is a schematic diagram of an application scenario provided by an embodiment of the present application;
图2为本申请实施例提供的一种页面显示方法的流程示意图;2 is a schematic flowchart of a page display method provided by an embodiment of the present application;
图3为本申请实施例提供的一种接收主题切换请求的过程示意图;3 is a schematic diagram of a process for receiving a theme switching request provided by an embodiment of the present application;
图4为本申请实施例提供的一种主题的示意图;4 is a schematic diagram of a theme provided by an embodiment of the present application;
图5为本申请实施例提供的一种获取主题信息的方法流程示意图;5 is a schematic flowchart of a method for obtaining subject information provided by an embodiment of the present application;
图6为本申请实施例提供的一种更新小程序的页面的过程示意图;6 is a schematic diagram of a process for updating a page of an applet provided by an embodiment of the present application;
图7为本申请实施例提供的一种页面显示方法的过程示意图;FIG. 7 is a schematic process diagram of a page display method provided by an embodiment of the present application;
图8为本申请实施例提供的一种页面显示装置的结构示意图;FIG. 8 is a schematic structural diagram of a page display device according to an embodiment of the present application;
图9为本申请实施例提供的另一种页面显示装置的结构示意图;FIG. 9 is a schematic structural diagram of another page display device provided by an embodiment of the present application;
图10为本申请提供的终端设备的硬件结构示意图。FIG. 10 is a schematic diagram of a hardware structure of a terminal device provided by this application.
具体实施方式Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. Where the following description refers to the drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the illustrative examples below are not intended to represent all implementations consistent with this application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as recited in the appended claims.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, herein, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements, It also includes other elements not expressly listed or inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.
为了便于理解,首先对本申请实施例所涉及的概念进行说明。For ease of understanding, concepts involved in the embodiments of the present application are first described.
终端设备:是一种具有无线收发功能的设备。终端设备可以部署在陆地上,包括室内或室外、手持、穿戴或车载;也可以部署在水面上(如轮船等);还可以部署在空中(例如飞机、气球和卫星上等)。所述终端设备可以是手机(mobile phone)、平板电脑(Pad)、带无线收发功能的电脑、虚拟现实(virtual reality,VR)终端设备、增强现实(augmentedreality,AR)终端设备、工业控制(industrial control)中的无线终端、车载终端设备、无人驾驶(self driving)中的无线终端、远程医疗(remote medical)中的无线终端设备、智能电网(smart grid)中的无线终端设备、运输安全(transportation safety)中的无线终端设备、智慧城市(smart city)中的无线终端设备、智慧家庭(smart home)中的无线终端设备、可穿戴终端设备等。本申请实施例所涉及的终端设备还可以称为终端、用户设备(user equipment,UE)、接入终端设备、车载终端、工业控制终端、UE单元、UE站、移动站、移动台、远方站、远程终端设备、移动设备、UE终端设备、无线通信设备、UE代理或UE装置等。终端设备也可以是固定的或者移动的。Terminal equipment: It is a device with wireless transceiver function. Terminal equipment can be deployed on land, including indoor or outdoor, handheld, wearable or vehicle-mounted; it can also be deployed on water (such as ships, etc.); it can also be deployed in the air (such as aircraft, balloons and satellites, etc.). The terminal device may be a mobile phone (mobile phone), a tablet computer (Pad), a computer with a wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, an industrial control (industrial) terminal device. wireless terminal in control), in-vehicle terminal equipment, wireless terminal in self driving, wireless terminal equipment in remote medical, wireless terminal equipment in smart grid, transportation safety ( Wireless terminal equipment in transportation safety, wireless terminal equipment in smart city, wireless terminal equipment in smart home, wearable terminal equipment, etc. The terminal equipment involved in the embodiments of this application may also be referred to as terminal, user equipment (UE), access terminal equipment, vehicle-mounted terminal, industrial control terminal, UE unit, UE station, mobile station, mobile station, and remote station , remote terminal equipment, mobile equipment, UE terminal equipment, wireless communication equipment, UE proxy or UE device, etc. Terminal devices can also be stationary or mobile.
在相关技术中,应用程序中包括多个小程序,通过选择小程序的主题,可以改变小程序的显示页面。目前,由于小程序中没有可以加载层叠样式表(Cascading StyleSheets,CSS)文件的内核,因此,可以通过内联的方式,将小程序的主题写入到小程序的开发框架中,以使小程序可以更换显示主题。例如,通过内联的方式,预先在小程序的文本颜色标签中写入可以选择的颜色参数,进而在使用小程序时,可以将小程序的文本颜色切换为预先设置的颜色。但是,这样需要对小程序的底层业务逻辑进行修改,进而导致小程序的复杂度较高。In the related art, an application program includes a plurality of applet programs, and the display page of the applet program can be changed by selecting the theme of the applet program. At present, since there is no kernel for loading Cascading Style Sheets (CSS) files in the applet, the theme of the applet can be written into the development framework of the applet in an inline way, so that the applet can Display themes can be changed. For example, in an inline manner, selectable color parameters are written in the text color label of the applet in advance, and then when the applet is used, the text color of the applet can be switched to the preset color. However, in this way, the underlying business logic of the applet needs to be modified, which in turn leads to high complexity of the applet.
为了解决相关技术中小程序的复杂度较高的技术问题,本申请实施例提供一种页面显示方法,接收第一应用的主题切换请求,其中,主题切换请求中包括待切换主题的标识,第一应用中包括多个小程序,根据待切换主题的标识,在数据包中获取待切换主题的主题信息,并获取待切换主题的主题信息中的多个主题参数,获取每个显示页面的多个页面参数,根据多个主题参数和多个页面参数,更新多个小程序的显示页面。这样,在切换小程序的主题时,终端设备可以直接在数据包中获取对应的主题信息,并根据主题信息,更新小程序的显示页面,无需在小程序中写入对应的主题代码,进而降低小程序的复杂度。In order to solve the technical problem of high complexity of small programs in the related art, an embodiment of the present application provides a page display method, which receives a theme switching request of a first application, wherein the theme switching request includes an identifier of the theme to be switched, and the first The application includes a plurality of small programs. According to the identification of the theme to be switched, the theme information of the theme to be switched is obtained in the data package, and multiple theme parameters in the theme information of the theme to be switched are obtained, and multiple theme parameters of each display page are obtained. Page parameters, according to multiple theme parameters and multiple page parameters, update the display pages of multiple mini programs. In this way, when switching the theme of the applet, the terminal device can directly obtain the corresponding theme information in the data package, and update the display page of the applet according to the theme information, without writing the corresponding theme code in the applet, thereby reducing the The complexity of the applet.
下面,结合图1,对本申请的应用场景进行说明。Below, with reference to FIG. 1 , the application scenario of the present application will be described.
图1为本申请实施例提供的一种应用场景示意图。请参见图1,包括终端设备和数据包。其中,数据包中存储主题A、主题B等多个主题。在终端设备接收到主题切换请求时,终端设备可以获取主题切换请求中的待切换主题的标识为主题A的标识。终端设备在数据包中获取主题A,并将小程序的主题切换为主题A。这样,在切换小程序的主题时,终端设备可以直接在数据包中获取对应的主题信息,并根据主题信息,更新小程序的显示页面,无需在小程序中写入对应的主题代码,进而降低小程序的复杂度。FIG. 1 is a schematic diagram of an application scenario provided by an embodiment of the present application. See Figure 1, including end devices and packets. The data package stores multiple topics such as topic A and topic B. When the terminal device receives the theme switching request, the terminal device may obtain the identification of the theme to be switched in the theme switching request as the identification of theme A. The terminal device obtains topic A in the data package, and switches the topic of the applet to topic A. In this way, when switching the theme of the applet, the terminal device can directly obtain the corresponding theme information in the data package, and update the display page of the applet according to the theme information, without writing the corresponding theme code in the applet, thereby reducing the The complexity of the applet.
下面以具体地实施例对本申请的技术方案以及本申请的技术方案如何解决上述技术问题进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。下面将结合附图,对本申请的实施例进行描述。The technical solutions of the present application and how the technical solutions of the present application solve the above-mentioned technical problems will be described in detail below with specific examples. The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.
图2为本申请实施例提供的一种页面显示方法的流程示意图。请参见图2,该方法可以包括:FIG. 2 is a schematic flowchart of a page display method provided by an embodiment of the present application. Referring to Figure 2, the method can include:
S201、接收第一应用的主题切换请求。S201. Receive a theme switching request of a first application.
本申请的执行主题可以为终端设备,也可以为设置在终端设备中的页面显示装置。其中,页面显示装置可以通过软件实现,页面显示装置也可以通过软件和硬件的结合实现。The execution subject of this application may be a terminal device, or may be a page display apparatus provided in the terminal device. The page display device may be implemented by software, and the page display device may also be implemented by a combination of software and hardware.
可选的,第一应用中包括多个小程序。例如,第一应用可以为终端设备中包括多个小程序的应用程序。可选的,小程序可以为微应用。例如,微应用可以为无需下载安装即可使用的应用程序,微应用可以为一码通微应用、天气查询微应用、车辆信息查询微应用等。Optionally, the first application includes multiple small programs. For example, the first application may be an application program including a plurality of small programs in the terminal device. Optionally, the applet can be a micro application. For example, the micro-application can be an application program that can be used without downloading and installing, and the micro-application can be a one-code-pass micro-application, a weather query micro-application, a vehicle information query micro-application, and the like.
可选的,主题切换请求用于切换第一应用中多个小程序的主题。其中,主题可以为小程序页面的显示风格。例如,若小程序的主题不同,则小程序的页面显示的文本颜色、背景颜色、控件尺寸等信息不同。可选的,主题切换请求中包括待切换主题的标识。例如,待切换主题的标识可以为主题的名称、主题的ID等。Optionally, the theme switching request is used to switch themes of the multiple applet in the first application. The theme may be the display style of the applet page. For example, if the themes of the applet are different, information such as text color, background color, and control size displayed on the page of the applet is different. Optionally, the topic switching request includes an identifier of the topic to be switched. For example, the identifier of the theme to be switched may be the name of the theme, the ID of the theme, and the like.
下面,结合图3,对接收第一应用的主题切换请求进行说明。Hereinafter, with reference to FIG. 3 , description will be given of receiving a theme switching request of the first application.
图3为本申请实施例提供的一种接收主题切换请求的过程示意图。请参见图3,包括终端设备。终端设备的显示页面为页面101,页面101为主题控制页面,页面101中包括主题A、主题B、主题C、主题D和每个主题的控制按键。在用户点击主题C的控制按键时,终端设备的页面101跳转至页面102。页面102中包括主题A、主题B、主题C、主题D和每个主题的控制按键,主题C的控制按键为打开,终端设备接收到主题切换请求,其中,主题切换请求中包括主题C的标识。FIG. 3 is a schematic diagram of a process of receiving a theme switching request according to an embodiment of the present application. See Figure 3, including terminal equipment. The display page of the terminal device is
S202、根据待切换主题的标识,在数据包中获取待切换主题的主题信息。S202. Acquire topic information of the topic to be switched in the data packet according to the identifier of the topic to be switched.
可选的,数据包中包括多个主题的主题信息。可选的,小程序可以在数据包中获取主题信息。例如,数据包可以为bundle,终端设备可以在bundle中获取主题信息。例如,bundle用于数据传递,bundle中可以保存多个主题的主题信息,每个主题的主题信息以键值对(key-value)的形式储存。Optionally, the data package includes topic information of multiple topics. Optionally, the applet can obtain topic information in the data package. For example, the data package can be a bundle, and the terminal device can obtain theme information in the bundle. For example, bundles are used for data transfer. The bundles can store topic information of multiple topics, and the topic information of each topic is stored in the form of key-value pairs.
可选的,主题信息可以包括多个主题参数。其中,主题参数可以包括如下至少一种:主题颜色信息、主题字体信息、主题控件信息。可选的,主题颜色信息可以包括主题色、背景色、卡片背景色、辅助色、按钮色、功能色等。例如,主题色为主要颜色,背景色为所有页面的底色,卡片背景色为一组元素框在一个卡片中的卡片背景色,辅助色为次要颜色,按钮色包括正常、点击、禁用(用不透明度来表示),功能色包括荧光色、绿色、蓝色、黄色、紫色、青色、红色等。Optionally, the topic information may include multiple topic parameters. The theme parameters may include at least one of the following: theme color information, theme font information, and theme control information. Optionally, the theme color information may include theme color, background color, card background color, auxiliary color, button color, function color, and the like. For example, the theme color is the primary color, the background color is the background color of all pages, the card background color is the card background color of a group of elements framed in one card, the secondary color is the secondary color, and the button colors include normal, click, disabled ( Expressed by opacity), functional colors include fluorescent colors, green, blue, yellow, purple, cyan, red, etc.
可选的,主题字体信息可以包括字体、字号和字重。例如,字体可以包括标题和正文两种字体规范,标题包括大标题、中标题和小标题,正文包括正文、二级正文、辅助文等。可选的,字号可以为文本字体的大小。可选的,字重可以为文本字体的粗细程度。Optionally, the theme font information may include font, font size and font weight. For example, the font may include two font specifications for the title and the body. The title includes the main title, the middle title and the subtitle, and the body includes the body, secondary body, auxiliary text and so on. Optionally, the font size can be the size of the text font. Optionally, the font weight can be the thickness of the text font.
可选的,主题控件信息可以包括控件的边距、控件的间距、控件的边角和控件的线条。可选的,控件的边距可以为内容到控件边的距离。例如,若控件为查询控件,则控件的边距为控件内的文本“查询”与控件边界之间的距离。可选的,控件的间距可以为两个控件之间的距离。例如,若控件A与控件B之间的距离为1毫米。则控件的间距为1毫米。可选的,控件的边角可以为控件的边角形状。例如,控件的边角可以为直角、圆角等。可选的,控件的线条可以为控件边界的粗细。例如,若控件的线条为1毫米,则控件的边界的线条粗细为1毫米。Optionally, the theme control information may include the margins of the controls, the spacing of the controls, the corners of the controls, and the lines of the controls. Optionally, the margin of the control can be the distance from the content to the edge of the control. For example, if the control is a query control, the margin of the control is the distance between the text "query" within the control and the bounds of the control. Optionally, the spacing of controls can be the distance between two controls. For example, if the distance between control A and control B is 1 mm. The spacing of the controls is 1 mm. Optionally, the corner of the control can be the shape of the corner of the control. For example, the corners of a control can be right-angled, rounded, and so on. Optionally, the line of the control can be the thickness of the border of the control. For example, if the line of the control is 1 mm, the line thickness of the border of the control is 1 mm.
下面,结合图4,对主题进行说明。Hereinafter, the subject will be described with reference to FIG. 4 .
图4为本申请实施例提供的一种主题的示意图。请参见图4,包括主题。其中,主题包括UI框架控件和应用场景控件。文本“UI框架”“应用场景”的字体为楷体,文本“触控”的字体为宋体。文本“UI框架”与控件边缘的距离为控件的边距,UI框架控件与应用场景控件之间的距离为控件的间距,UI框架控件和应用场景控件的边角都为圆角。FIG. 4 is a schematic diagram of a theme provided by an embodiment of the present application. See Figure 4, including the subject. Among them, the theme includes UI framework controls and application scene controls. The font of the text "UI Framework" and "Application Scenario" is italic, and the font of the text "Touch" is Song. The distance between the text "UI frame" and the edge of the control is the margin of the control, the distance between the UI frame control and the application scene control is the control spacing, and the corners of the UI frame control and the application scene control are rounded.
可选的,可以根据如下可行的实现方式,获取待切换主题的主题信息:获取主题信息与标识的对应关系。其中,主题信息与标识的对应关系包括数据包中的每个主题的主题信息,以及每个主题信息对应的标识。例如,主题信息与标识的对应关系可以如表1所示:Optionally, the subject information of the subject to be switched may be acquired according to the following feasible implementation manner: acquiring the correspondence between the subject information and the identifier. The correspondence between the topic information and the identifier includes topic information of each topic in the data package, and an identifier corresponding to each topic information. For example, the corresponding relationship between topic information and identification can be as shown in Table 1:
表1Table 1
需要说明的是,表1只是以示例的形式示意主题信息与标识的对应关系,并非对主题信息与标识的对应关系的限定。It should be noted that, Table 1 only illustrates the correspondence between the subject information and the identifier in the form of an example, and does not limit the correspondence between the subject information and the identifier.
根据待切换主题的标识和主题信息与标识的对应关系,在数据包中获取待切换主题的主题信息。例如,若待切换主题的标识为标识1,则待切换主题的主题信息为主题信息1;若待切换主题的标识为标识2,则待切换主题的主题信息为主题信息2;若待切换主题的标识为标识3,则待切换主题的主题信息为主题信息3。这样,数据包中的每个主题信息都有对应的标识,终端设备可以根据待切换主题的标识,以及数据包中的标识,准确的确定待切换主题的主题标识。According to the identifier of the topic to be switched and the corresponding relationship between the topic information and the identifier, the topic information of the topic to be switched is acquired in the data package. For example, if the identifier of the topic to be switched is identifier 1, the topic information of the topic to be switched is topic information 1; if the identifier of the topic to be switched is identifier 2, the topic information of the topic to be switched is topic information 2; The identifier is identifier 3, and the topic information of the topic to be switched is topic information 3. In this way, each topic information in the data package has a corresponding identifier, and the terminal device can accurately determine the topic identifier of the topic to be switched according to the identifier of the topic to be switched and the identifier in the data package.
S203、根据待切换主题的主题信息,更新多个小程序的显示页面。S203. Update the display pages of the plurality of mini-programs according to the theme information of the theme to be switched.
可选的,针对于任意一个小程序的显示页面,可以根据如下可行的实现方式,更新多个小程序的显示页面:获取显示页面的第一页面信息。其中,第一页面信息包括显示页面中每个节点当前显示的主题样式。可选的,主题样式可以为可视化节点当前显示的主题信息。例如,可视化节点的主题样式可以为可视化节点当前显示的字体、字号、控件间距等信息。例如,显示页面中可以包括多个可视化节点,每个可视化节点按照当前的主题样式显示。例如,显示页面中包括控件A和控件B,控件A的字体格式和控件B的字体格式都是按照预先设置的主题显示。Optionally, with respect to the display page of any one applet, the display pages of a plurality of applet may be updated according to the following feasible implementation manner: obtaining the first page information of the display page. Wherein, the first page information includes the theme style currently displayed by each node in the display page. Optionally, the theme style can be the theme information currently displayed by the visualization node. For example, the theme style of the visualization node may be information such as font, font size, and control spacing currently displayed by the visualization node. For example, a display page may include multiple visualization nodes, and each visualization node is displayed according to the current theme style. For example, the display page includes control A and control B, and both the font format of control A and the font format of control B are displayed according to a preset theme.
可选的,终端设备可以获取显示页面的渲染树,进而得到第一页面信息。例如,终端设备可以根据显示页面每个可视化节点的显示格式,构建显示页面对应的渲染树,渲染树中包括显示页面当前的第一页面信息。Optionally, the terminal device may obtain the rendering tree of the displayed page, and then obtain the information of the first page. For example, the terminal device may construct a rendering tree corresponding to the display page according to the display format of each visual node of the display page, and the rendering tree includes the current first page information of the display page.
根据待切换主题的主题信息,对显示页面中的每个节点进行虚拟渲染,得到第二页面信息。其中,第二页面信息包括显示页面中每个节点虚拟渲染之后的主题样式。例如,终端设备可以通过待切换主题的主题信息,在虚拟空间中对显示页面的每个可视化节点进行虚拟渲染,进而获取虚拟渲染之后的显示页面的第二页面信息。例如,终端设备获取待切换主题的主题信息时,可以获取当前主题在文件中的位置,进而将当前主题替换为待切换主题的主题信息,并通过待切换主题的主题信息对显示页面进行模拟渲染(并未更新显示页面),进而得到显示页面模拟渲染之后的渲染树,通过该渲染树得到显示页面的第二页面信息。According to the theme information of the theme to be switched, virtual rendering is performed on each node in the display page to obtain the second page information. Wherein, the second page information includes the theme style after virtual rendering of each node in the display page. For example, the terminal device may perform virtual rendering on each visual node of the display page in the virtual space by using the theme information of the theme to be switched, and then obtain the second page information of the display page after the virtual rendering. For example, when the terminal device obtains the theme information of the theme to be switched, it can obtain the position of the current theme in the file, and then replace the current theme with the theme information of the theme to be switched, and simulate and render the display page based on the theme information of the theme to be switched. (The display page is not updated), and then the rendering tree after the display page is simulated and rendered is obtained, and the second page information of the display page is obtained through the rendering tree.
根据第一页面信息和第二页面信息,更新小程序的显示页面。可选的,可以根据如下可行的实现方式,更新小程序的显示页面:确定第一页面信息中的每个节点与第二页面信息中的每个节点之间的第一对应关系。例如,第一对应关系中包括第一页面信息中每个节点在第二页面信息中对应的节点。例如,由于第二页面信息为终端设备根据待切换主题的主题信息对显示页面的节点进行虚拟渲染得到的,因此,第一页面信息的节点和对应的第二页面信息的节点,实际为显示页面的同一个节点。例如,显示页面中包括控件A,若控件A在第一页面信息中的节点为节点A,若控件A在第二页面信息中的节点为节点B,则节点A和节点B为一组对应的节点。The display page of the applet is updated according to the first page information and the second page information. Optionally, the display page of the applet may be updated according to the following feasible implementation manner: determining the first correspondence between each node in the first page information and each node in the second page information. For example, the first correspondence includes nodes corresponding to each node in the first page information in the second page information. For example, since the second page information is obtained by the terminal device performing virtual rendering of the nodes of the display page according to the theme information of the theme to be switched, the nodes of the first page information and the corresponding nodes of the second page information are actually the display pages the same node. For example, the display page includes control A, if the node of control A in the first page information is node A, and if the node of control A in the second page information is node B, then node A and node B are a group of corresponding node.
根据第一对应关系和第二页面信息,在第一页面信息中确定目标节点。其中,目标节点为待更新主题样式的节点。例如,若进行主题切换之后,节点的主题样式会发生改变,则确定该节点为目标节点,若进行主题切换之后,节点的主题样式不会改变,则该节点不是目标节点。例如,通过显示页面当前的渲染树、以及对显示页面虚拟渲染之后得到的渲染树,可以准确的确定当前的渲染树中数据发生改变的节点,进而将该节点确定为目标节点。According to the first correspondence and the second page information, the target node is determined in the first page information. The target node is the node whose theme style is to be updated. For example, if the theme style of the node changes after the theme switching, the node is determined as the target node. If the theme style of the node does not change after the theme switching, the node is not the target node. For example, by displaying the current rendering tree of the page and the rendering tree obtained after virtual rendering of the displayed page, the node whose data has changed in the current rendering tree can be accurately determined, and then the node is determined as the target node.
可选的,由于可视化节点中待显示的内容不同(如,部分可视化节点包括大标题和小标题,而另一部分可视化节点为图像等),因此,在进行主题切换时,有些节点的主题样式并未改变(如,待切换主题只修改字体,那么显示图片的节点就无需更换),进而无需进行渲染,只针对主题样式发生改变的节点进行渲染更新,这样可以节约终端设备的资源。Optionally, since the content to be displayed in the visualization nodes is different (for example, some visualization nodes include large titles and subtitles, while other visualization nodes are images, etc.), therefore, when the theme is switched, the theme styles of some nodes may not be the same. If it is not changed (for example, if the theme to be switched only modifies the font, then the node displaying the image does not need to be replaced), and no rendering is required. Only the node whose theme style has changed will be rendered and updated, which can save the resources of the terminal device.
对目标节点的主题样式进行更新,以更新小程序的显示页面。可选的,主题样式包括至少一个主题参数,可以根据如下可行的实现方式更新显示页面:在目标节点的主题样式中确定目标主题参数,对目标主题参数进行更新,以更新小程序的显示页面。Update the theme style of the target node to update the display page of the applet. Optionally, the theme style includes at least one theme parameter, and the display page can be updated according to the following feasible implementation methods: determining the target theme parameter in the theme style of the target node, and updating the target theme parameter to update the display page of the applet.
可选的,主题样式中可以包括至少一个主题参数。例如,可视化节点的主题样式可以包括主题字体信息,也可以包括主题控件信息和主题颜色信息等。其中,目标主题参数为待更新的主题参数。例如,节点A为第一页面信息中的节点,节点A在第二页面信息中对应的节点为节点B,若节点A的主题样式A与节点B的主题样式B不同,则主题样式A中包括目标主题参数,若主题样式A中的字体与主题样式B中的字体不同,则目标主题参数为该字体。例如,可以将显示页面当前的渲染树的数据与显示页面虚拟渲染之后的渲染树的数据进行对比,进而得到目标节点,以及目标节点的主题样式中的目标主题参数。Optionally, the theme style may include at least one theme parameter. For example, the theme style of a visualization node may include theme font information, theme control information, theme color information, and so on. The target theme parameter is the theme parameter to be updated. For example, node A is a node in the first page information, and node A corresponds to a node in the second page information is node B. If the theme style A of node A is different from the theme style B of node B, the theme style A includes Target theme parameter. If the font in theme style A is different from the font in theme style B, the target theme parameter is the font. For example, the data of the current rendering tree of the display page can be compared with the data of the rendering tree after the virtual rendering of the display page, so as to obtain the target node and the target theme parameters in the theme style of the target node.
可选的,对目标主题参数进行更新,以更新小程序的显示页面,具体为:将第一页面信息中的目标主题参数,更新为对应的第二页面信息中的主题参数。例如,节点A为第一页面信息中的目标节点,节点A在第二页面信息中对应的节点为节点B,若节点A的字体参数为目标主题参数,则将节点A的字体参数更新为节点B的字体参数,进而对小程序的显示页面进行更新;若节点A的主背景颜色为灰色,节点B的主背景颜色为白色,则将节点A的主背景颜色更新为白色,进而对小程序的显示页面进行更新。可选的,可以对第一信息中所有的目标节点进行更新,进而实现对显示页面的更新。这样,可以仅对发生改变的主题参数进行更新,节约终端设备的资源。Optionally, updating the target theme parameter to update the display page of the applet, specifically: updating the target theme parameter in the first page information to the corresponding theme parameter in the second page information. For example, node A is the target node in the first page information, and the corresponding node of node A in the second page information is node B. If the font parameter of node A is the target theme parameter, update the font parameter of node A to node B B font parameters, and then update the display page of the applet; if the main background color of node A is gray, and the main background color of node B is white, then the main background color of node A is updated to white, and then the applet The display page is updated. Optionally, all target nodes in the first information may be updated, thereby implementing the update of the display page. In this way, only the changed theme parameters can be updated, thereby saving the resources of the terminal device.
可选的,终端设备在切换主题时,可以对终端设备内的每个第一应用的多个小程序进行页面更新。例如,在终端设备切换主题时,对应用A的多个小程序显示页面和应用B的多个小程序的显示页面都进行更新。Optionally, when switching themes, the terminal device may perform page update on multiple applet programs of each first application in the terminal device. For example, when the terminal device switches themes, both the display pages of multiple applets of application A and the display pages of multiple applets of application B are updated.
本申请实施例提供一种页面显示方法,接收第一应用的主题切换请求,其中,主题切换请求中包括待切换主题的标识,第一应用中包括多个小程序,根据待切换主题的标识,在数据包中获取待切换主题的主题信息,获取显示页面的第一页面信息,其中,第一页面信息包括显示页面中每个节点当前显示的主题样式,根据待切换主题的主题信息,对显示页面中的每个节点进行虚拟渲染,得到第二页面信息,其中,第二页面信息包括显示页面中每个节点虚拟渲染之后的主题样式,根据第一页面信息和第二页面信息,更新小程序的显示页面。这样,在切换小程序的主题时,终端设备可以直接在数据包中获取对应的主题信息,并根据主题信息,更新小程序的显示页面,无需在小程序中写入对应的主题代码,进而降低小程序的复杂度。An embodiment of the present application provides a page display method for receiving a theme switching request of a first application, wherein the theme switching request includes an identifier of a theme to be switched, and the first application includes a plurality of small programs. According to the identifier of the theme to be switched, Obtain the theme information of the theme to be switched in the data package, and obtain the first page information of the display page, where the first page information includes the theme style currently displayed by each node in the display page, and according to the theme information of the theme to be switched, the display Virtual rendering is performed on each node in the page to obtain second page information, wherein the second page information includes the theme style after virtual rendering of each node in the display page, and the applet is updated according to the first page information and the second page information display page. In this way, when switching the theme of the applet, the terminal device can directly obtain the corresponding theme information in the data package, and update the display page of the applet according to the theme information, without writing the corresponding theme code in the applet, thereby reducing the The complexity of the applet.
在图2所示的实施例的基础上,上述页面显示方法中还包括获取主题信息的过程,下面,结合图5,对获取主题信息的方法进行说明。On the basis of the embodiment shown in FIG. 2 , the above-mentioned page display method further includes a process of acquiring topic information. The method for acquiring topic information is described below with reference to FIG. 5 .
图5为本申请实施例提供的一种获取主题信息的方法流程示意图。请参见图5,该方法流程包括:FIG. 5 is a schematic flowchart of a method for acquiring subject information provided by an embodiment of the present application. Referring to Figure 5, the method flow includes:
S501、获取至少一个主题的主题信息。S501. Acquire topic information of at least one topic.
可选的,可以根据如下可行的实现方式,获取至少一个主题的主题信息:获取至少一个主题对应的主题模板,其中,主题模板中包括多个主题参数变量。例如,主题参数变量为可以为主题参数的变量名。Optionally, the topic information of at least one topic may be acquired according to the following feasible implementation manner: acquiring a topic template corresponding to at least one topic, wherein the topic template includes a plurality of topic parameter variables. For example, a topic parameter variable is a variable name that can be a topic parameter.
可选的,主题模板的设计符合如下预设条件:变量覆盖、样式覆盖、组件定制和全局定制。其中,变量覆盖满足全局变量覆盖和组件变量覆盖。例如,通过使用less变量机制,以调整编译主题过程中的变量决议,其中,变量覆盖的变量文件的组织结构按照预设的目录组织结构,预设的目录租住结构可以包括全局变量入口和组件变量入口。Optionally, the design of the theme template conforms to the following preset conditions: variable override, style override, component customization, and global customization. Among them, variable coverage satisfies global variable coverage and component variable coverage. For example, by using the less variable mechanism to adjust the variable resolution in the process of compiling the theme, the organization structure of variable files covered by variables is organized according to a preset directory structure, and the preset directory rental structure can include global variable entries and components variable entry.
可选的,样式覆盖满足组件级别覆盖样式。例如,通过使用less mixin机制,将部分主题参数变量以mixin覆盖的特性进行样式覆盖,这样可以通过自定义组件覆盖机制,使得主题模板支持在组件级别进行样式覆盖,并在编译过程中支持覆盖样式优先。Optionally, style overrides satisfy component-level override styles. For example, by using the less mixin mechanism, some theme parameter variables can be styled with the features covered by the mixin, so that the theme template can support style override at the component level by customizing the component override mechanism, and support style override during the compilation process. priority.
可选的,组件定制为组件内的变量覆盖。例如,通过自定义loadUIOverridesmixin机制,在组件级别通过overrides.less结尾文件约定进行样式覆盖,进而实现在组件级别通过variables.less结尾文件约定,使得组件样式编译过程中的组件内的变量覆盖。可选的,全局定制可以通过预设的接口覆盖编译过程中的全局变量。例如,通过约定入口globals/theme.varibales.less文件,可覆盖编译过程中的全局变量。Optionally, the component is customized for variable overrides within the component. For example, by customizing the loadUIOverridesmixin mechanism, the styles are covered at the component level through the overrides.less ending file convention, and then the variables.less ending file convention at the component level is implemented, so that the variables in the component are overridden during the component style compilation process. Optionally, global customization can override global variables during compilation through a preset interface. For example, global variables during compilation can be overridden by contracting the entry globals/theme.varibales.less file.
根据多个主题参数变量,获取主题的主题信息。可选的,可以根据如下可行的实现方式获取主题的主题信息:在主题模板的主题参数变量中添加对应的主题参数,得到主题模板样式。通过编译器对主题模板样式进行编译,得到主题的主题信息。例如,通过调整主题模板中的主题变量参数的数值,可以得到不同的主题模板样式,进而通过cli编译器对主题模板样式进行编译,得到小程序可识别的主题。这样,通过从组件到全局的覆盖机制可以在不同层次不同粒度定制主题,并且可以在小程序运行过程中动态切换主题的效果,提高小程序的控制灵活度,降低小程序的复杂度。Get topic information of a topic based on multiple topic parameter variables. Optionally, the theme information of the theme can be obtained according to the following feasible implementation methods: adding the corresponding theme parameter to the theme parameter variable of the theme template to obtain the theme template style. The theme template style is compiled by the compiler to obtain the theme information of the theme. For example, by adjusting the value of the theme variable parameter in the theme template, different theme template styles can be obtained, and then the theme template styles can be compiled by the cli compiler to obtain themes that can be recognized by the applet. In this way, the theme can be customized at different levels and granularities through the overlay mechanism from components to the global, and the effect of the theme can be dynamically switched during the running process of the applet, which improves the control flexibility of the applet and reduces the complexity of the applet.
S502、将至少一个主题的主题信息存储至数据包。S502. Store topic information of at least one topic in a data package.
可选的,通过主题模板和编译器可以得到多个主题的主题信息,将多个主题信息存储至数据包中,以使小程序在数据包中获取主题信息。例如,终端设备可以将用户预先设置多个主题的主题参数添加至主题模板的主题参数变量中,得到多个主题对应的主题模板样式,通过编译器对多个主题模板样式进行编译,得到多个主题的主题信息,并将多个主题信息存储至小程序的bundle中,小程序在进行主题切换时,可以在bundle中获取对应的主题信息,以更新小程序的显示页面。Optionally, the theme information of multiple themes can be obtained through the theme template and the compiler, and the multiple theme information can be stored in the data package, so that the applet can obtain the theme information in the data package. For example, the terminal device can add the theme parameters of multiple themes preset by the user to the theme parameter variable of the theme template to obtain theme template styles corresponding to the multiple themes, and compile the multiple theme template styles through the compiler to obtain multiple theme template styles. The theme information of the theme, and multiple theme information is stored in the bundle of the applet. When the applet switches the theme, it can obtain the corresponding theme information in the bundle to update the display page of the applet.
下面,结合图6,对更新小程序的页面的过程进行说明。Next, the process of updating the page of the applet will be described with reference to FIG. 6 .
图6为本申请实施例提供的一种更新小程序的页面的过程示意图。请参见图6,包括:主题编译过程和主题运行过程。其中,在进行主题编译时,自定义主题A、主题B、主题N等N个主题,并将每个主题的主题参数输入至主题模板,得到N个主题的N个主题样式。通过cli编译器对N个主题样式进行编译处理,对应用主题进行配置,并将编译后的主题A、主题B、主题N等N个主题存储至小程序的bundle中。FIG. 6 is a schematic diagram of a process for updating a page of an applet provided by an embodiment of the present application. Please refer to Figure 6, including: theme compilation process and theme running process. Wherein, during theme compilation, N themes such as theme A, theme B, and theme N are customized, and theme parameters of each theme are input into the theme template to obtain N theme styles of the N themes. The cli compiler is used to compile and process N theme styles, configure the application theme, and store the compiled theme A, theme B, theme N and other N themes in the bundle of the applet.
请参见图6,在主题运行时,小程序容器可以在bundle中获取多个主题,并在多个主题中选择待切换的主题,并对待切换主题进行解析,通过解析之后的结果,对主题进行渲染和绘制。在主题切换时,多应用全局通知切换主题机制使得终端设备中的每个应用的小程序都进行主题切换。这样,小程序可以直接在bundle中加载预先配置的主题,进而降低小程序的复杂度。Referring to Figure 6, when the theme is running, the applet container can obtain multiple themes in the bundle, select the theme to be switched from among the multiple themes, and parse the theme to be switched. Render and draw. When the theme is switched, the multi-application global notification switching theme mechanism enables the applet of each application in the terminal device to switch the theme. In this way, the applet can directly load the pre-configured theme in the bundle, thereby reducing the complexity of the applet.
本申请实施例提供一种获取主题信息的方法,获取至少一个主题对应的主题模板,在主题模板的主题参数变量中添加对应的主题参数,得到主题样式,并通过编译器对主题样式进行编译,得到至少一个主题的主题信息,将至少一个主题的主题信息存储至所述数据包,这样,可以在小程序运行过程中动态切换主题的效果,提高小程序的控制灵活度,并且小程序可以直接在数据包中加载对应的主题,无需在小程序中写入对应的主题代码,进而降低小程序的复杂度。The embodiment of the present application provides a method for obtaining theme information, obtaining a theme template corresponding to at least one theme, adding the corresponding theme parameter to the theme parameter variable of the theme template to obtain a theme style, and compiling the theme style through a compiler, Obtain the theme information of at least one theme, and store the theme information of at least one theme in the data package, so that the effect of the theme can be dynamically switched during the running process of the applet, the control flexibility of the applet is improved, and the applet can directly Loading the corresponding theme in the data package eliminates the need to write the corresponding theme code in the applet, thereby reducing the complexity of the applet.
在上述任意一个实施例的基础上,下面,结合图7,对上述页面显示方法的过程进行说明。On the basis of any one of the above-mentioned embodiments, the process of the above-mentioned page display method will be described below with reference to FIG. 7 .
图7为本申请实施例提供的一种页面显示方法的过程示意图。请参见图7,包括终端设备。终端设备的页面201为小程序页面。其中,页面201中包括绿色底的UI框架控件和应用场景控件,应用场景控件与UI框架控件之间的间距较大。终端设备切换主题时,页面202为主题页面,主题页面中包括主题A、主题B、主题C、主题D和每个主题对应的控制按键,主题A的控制按键为打开,其它的控制按键为关闭。FIG. 7 is a schematic process diagram of a page display method provided by an embodiment of the present application. See Figure 7, including terminal equipment. The
请参见图7,在用户点击主题C的控制按键时,终端设备显示页面203,在页面203中,主题A的控制按键关闭,主题C的控制按键打开。终端设备在数据包中获取主题C的主题信息,并根据主题C的主题信息对页面进行更新。在页面更新后,终端设备显示页面204,页面204为小程序页面。其中,页面204中包括UI框架控件和应用场景控件。其中,UI框架控件的背底由绿色变为白色,且UI框架控件与应用场景控件之间的距离变小。这样,可以在小程序运行过程中动态切换主题的效果,提高小程序的控制灵活度,并且小程序可以直接在数据包中加载对应的主题,无需在小程序中写入对应的主题代码,进而降低小程序的复杂度。Referring to FIG. 7 , when the user clicks the control button of topic C, the terminal device displays
图8为本申请实施例提供的一种页面显示装置的结构示意图。请参见图8,该页面显示装置10包括接收模块11、第一获取模块12和更新模块13,其中:FIG. 8 is a schematic structural diagram of a page display apparatus provided by an embodiment of the present application. Referring to FIG. 8 , the page display device 10 includes a receiving
所述接收模块11用于,接收第一应用的主题切换请求,所述主题切换请求中包括待切换主题的标识,所述第一应用中包括多个小程序;The receiving
所述第一获取模块12用于,根据所述待切换主题的标识,在数据包中获取所述待切换主题的主题信息,所述数据包中包括多个主题的主题信息;The first obtaining
所述更新模块13用于,根据所述待切换主题的主题信息,更新所述多个小程序的显示页面。The updating
在一种可能的实施方式中,所述更新模块13具体用于:In a possible implementation manner, the
获取所述显示页面的第一页面信息,所述第一页面信息包括所述显示页面中每个节点当前显示的主题样式;acquiring first page information of the display page, where the first page information includes the theme style currently displayed by each node in the display page;
根据所述待切换主题的主题信息,对所述显示页面中的每个节点进行虚拟渲染,得到第二页面信息,所述第二页面信息包括所述显示页面中每个节点虚拟渲染之后的主题样式;According to the theme information of the theme to be switched, virtual rendering is performed on each node in the display page to obtain second page information, where the second page information includes the theme after virtual rendering of each node in the display page style;
根据所述第一页面信息和所述第二页面信息,更新所述小程序的显示页面。The display page of the applet is updated according to the first page information and the second page information.
在一种可能的实施方式中,所述更新模块13具体用于:In a possible implementation manner, the
确定所述第一页面信息中的所述每个节点与所述第二页面信息中的所述每个节点之间的第一对应关系;determining a first correspondence between the each node in the first page information and the each node in the second page information;
根据所述第一对应关系和所述第二页面信息,在所述第一页面信息中确定目标节点,所述目标节点为待更新主题样式的节点;According to the first correspondence and the second page information, a target node is determined in the first page information, and the target node is the node of the theme style to be updated;
对所述目标节点的主题样式进行更新,以更新所述小程序的显示页面。The theme style of the target node is updated to update the display page of the applet.
在一种可能的实施方式中,所述更新模块13具体用于:In a possible implementation manner, the
在所述目标节点的主题样式中确定目标主题参数,所述目标主题参数为待更新的主题参数;Determine a target theme parameter in the theme style of the target node, and the target theme parameter is the theme parameter to be updated;
对所述目标主题参数进行更新,以更新所述小程序的显示页面。The target theme parameter is updated to update the display page of the applet.
本申请实施例提供的页面显示装置可以执行上述方法实施例所示的技术方案,其实现原理以及有益效果类似,此处不再进行赘述。The page display apparatus provided in the embodiments of the present application can implement the technical solutions shown in the foregoing method embodiments, and the implementation principles and beneficial effects thereof are similar, and will not be repeated here.
图9为本申请实施例提供的另一种页面显示装置的结构示意图。在图8所示的实施例的基础上,请参见图9,该页面显示装置10还包括第二获取模块14,所述第二获取模块14用于:FIG. 9 is a schematic structural diagram of another page display apparatus provided by an embodiment of the present application. On the basis of the embodiment shown in FIG. 8 , referring to FIG. 9 , the page display apparatus 10 further includes a second obtaining
获取至少一个主题的主题信息;Get topic information for at least one topic;
将所述至少一个主题的主题信息存储至所述数据包。The topic information of the at least one topic is stored to the data package.
在一种可能的实施方式中,所述第二获取模块14具体用于:In a possible implementation manner, the second obtaining
获取所述至少一个主题对应的主题模板,所述主题模板中包括多个主题参数变量;Obtain a theme template corresponding to the at least one theme, where the theme template includes a plurality of theme parameter variables;
根据所述多个主题参数变量,获取所述主题的主题信息。The topic information of the topic is acquired according to the plurality of topic parameter variables.
在一种可能的实施方式中,所述第二获取模块14具体用于:In a possible implementation manner, the second obtaining
在所述主题模板的主题参数变量中添加对应的主题参数,得到主题样式;Adding corresponding theme parameters to the theme parameter variables of the theme template to obtain theme styles;
通过编译器对所述主题样式进行编译,得到所述主题的主题信息。The theme style is compiled by a compiler to obtain theme information of the theme.
本申请实施例提供的页面显示装置可以执行上述方法实施例所示的技术方案,其实现原理以及有益效果类似,此处不再进行赘述。The page display apparatus provided in the embodiments of the present application can implement the technical solutions shown in the foregoing method embodiments, and the implementation principles and beneficial effects thereof are similar, and will not be repeated here.
图10为本申请提供的终端设备的硬件结构示意图。请参见图10,该终端设备20可以包括:处理器21和存储器22,其中,处理器21和存储器22可以通信;示例性的,处理器21和存储器22通过通信总线23通信,所述存储器22用于存储程序指令,所述处理器21用于调用存储器中的程序指令执行上述任意方法实施例所示的页面显示方法。FIG. 10 is a schematic diagram of a hardware structure of a terminal device provided by this application. Referring to FIG. 10, the terminal device 20 may include: a
可选的,终端设备20还可以包括通信接口,通信接口可以包括发送器和/或接收器。Optionally, the terminal device 20 may further include a communication interface, and the communication interface may include a transmitter and/or a receiver.
可选的,上述处理器可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。Optionally, the above-mentioned processor may be a central processing unit (Central Processing Unit, CPU), and may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC) )Wait. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps in combination with the method disclosed in the present application can be directly embodied as executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.
本申请实施例提供一种可读存储介质,所述可读存储介质上存储有计算机程序;所述计算机程序用于实现如上述任意实施例所述的页面显示方法。An embodiment of the present application provides a readable storage medium, where a computer program is stored on the readable storage medium; the computer program is used to implement the page display method described in any of the foregoing embodiments.
本申请实施例提供一种计算机程序产品,所述计算机程序产品包括指令,当所述指令被执行时,使得计算机执行上述页面显示方法。An embodiment of the present application provides a computer program product, where the computer program product includes instructions, which, when the instructions are executed, cause a computer to execute the above-mentioned page display method.
实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一可读取存储器中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储器(存储介质)包括:只读存储器(英文:read-only memory,缩写:ROM)、RAM、快闪存储器、硬盘、固态硬盘、磁带(英文:magnetic tape)、软盘(英文:floppydisk)、光盘(英文:optical disc)及其任意组合。All or part of the steps for implementing the above method embodiments may be completed by program instructions related to hardware. The aforementioned program can be stored in a readable memory. When the program is executed, the steps including the above method embodiments are executed; and the aforementioned memory (storage medium) includes: read-only memory (English: read-only memory, abbreviation: ROM), RAM, flash memory, hard disk, Solid state drive, magnetic tape (English: magnetic tape), floppy disk (English: floppydisk), optical disc (English: optical disc) and any combination thereof.
本申请实施例是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程终端设备的处理单元以产生一个机器,使得通过计算机或其他可编程终端设备的处理单元执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The embodiments of the present application are described with reference to flowcharts and/or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It will be understood that each flow and/or block in the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processing unit of a general purpose computer, special purpose computer, embedded processor or other programmable terminal device to produce a machine such that the instructions executed by the processing unit of the computer or other programmable terminal device produce a method for implementing A means for the functions specified in a flow or flows of a flowchart and/or a block or blocks of a block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable terminal device to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instruction means The functionality specified in the flow or flow of the flowchart and/or the block or blocks of the block diagram is implemented.
这些计算机程序指令也可装载到计算机或其他可编程终端设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable terminal device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions to be executed on the computer or other programmable device Steps are provided for implementing the functions specified in a flow or flows of the flowcharts and/or a block or blocks of the block diagrams.
显然,本领域的技术人员可以对本申请实施例进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请实施例的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
在本申请中,术语“包括”及其变形可以指非限制性的包括;术语“或”及其变形可以指“和/或”。本申请中术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。本申请中,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。In this application, the term "comprising" and its variants may mean non-limiting inclusion; the term "or" and its variants may mean "and/or". The terms "first", "second" and the like in this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. In this application, "plurality" means two or more. "And/or", which describes the association relationship of the associated objects, means that there can be three kinds of relationships, for example, A and/or B, which can mean that A exists alone, A and B exist at the same time, and B exists alone. The character "/" generally indicates that the associated objects are an "or" relationship.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210317302.6A CN114647473B (en) | 2022-03-28 | 2022-03-28 | Page display method, device and terminal equipment |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210317302.6A CN114647473B (en) | 2022-03-28 | 2022-03-28 | Page display method, device and terminal equipment |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN114647473A true CN114647473A (en) | 2022-06-21 |
| CN114647473B CN114647473B (en) | 2025-02-14 |
Family
ID=81994924
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210317302.6A Active CN114647473B (en) | 2022-03-28 | 2022-03-28 | Page display method, device and terminal equipment |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN114647473B (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117519859A (en) * | 2022-07-30 | 2024-02-06 | 荣耀终端有限公司 | Interface adjustment method and electronic device |
| CN119493626A (en) * | 2024-10-30 | 2025-02-21 | 深圳市瑞云科技股份有限公司 | A multi-theme application method based on cascading style sheets |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2017024144A1 (en) * | 2015-08-04 | 2017-02-09 | Google Inc. | Systems and methods for interactively presenting a visible portion of a rendering surface on a user device |
| CN112804330A (en) * | 2021-01-14 | 2021-05-14 | 京东数字科技控股股份有限公司 | Application communication method and device |
| CN113296841A (en) * | 2021-04-13 | 2021-08-24 | 京东数字科技控股股份有限公司 | Application program processing method, device, equipment and medium |
| CN113656718A (en) * | 2021-08-17 | 2021-11-16 | 北京奇艺世纪科技有限公司 | Theme switching method and device |
-
2022
- 2022-03-28 CN CN202210317302.6A patent/CN114647473B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2017024144A1 (en) * | 2015-08-04 | 2017-02-09 | Google Inc. | Systems and methods for interactively presenting a visible portion of a rendering surface on a user device |
| CN112804330A (en) * | 2021-01-14 | 2021-05-14 | 京东数字科技控股股份有限公司 | Application communication method and device |
| CN113296841A (en) * | 2021-04-13 | 2021-08-24 | 京东数字科技控股股份有限公司 | Application program processing method, device, equipment and medium |
| CN113656718A (en) * | 2021-08-17 | 2021-11-16 | 北京奇艺世纪科技有限公司 | Theme switching method and device |
Non-Patent Citations (1)
| Title |
|---|
| 陈淡;: "Android机顶盒主题切换的设计与实现", 有线电视技术, no. 12, 15 December 2014 (2014-12-15) * |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117519859A (en) * | 2022-07-30 | 2024-02-06 | 荣耀终端有限公司 | Interface adjustment method and electronic device |
| CN119493626A (en) * | 2024-10-30 | 2025-02-21 | 深圳市瑞云科技股份有限公司 | A multi-theme application method based on cascading style sheets |
Also Published As
| Publication number | Publication date |
|---|---|
| CN114647473B (en) | 2025-02-14 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US6753885B2 (en) | System and theme file format for creating visual styles | |
| US20170161032A1 (en) | Running applications using pre-generated components | |
| US20190102201A1 (en) | Component invoking method and apparatus, and component data processing method and apparatus | |
| US8004535B2 (en) | Apparatus and method for selectively double buffering portions of displayable content | |
| CN103019781B (en) | A kind of fast skin changing method based on Android system | |
| CN109725901A (en) | Development approach, device, equipment and the computer storage medium of front-end code | |
| CN114647473A (en) | Page display method, device and terminal device | |
| US10768944B2 (en) | Method and system for customizing desktop launcher of mobile terminal | |
| CN103914450A (en) | Method and device for presenting web graphics in mobile terminal platform | |
| CN113645369B (en) | Method and device for displaying multiple screens, computer readable storage medium and terminal | |
| CN115526978A (en) | Method, equipment and storage medium for realizing three-dimensional control of vehicle-mounted system user interface | |
| CN112487330A (en) | UI skin changing method, system, device and storage medium based on XML | |
| CN101246477A (en) | Method and system for modifying and indicating attribute of interface constituent | |
| CN111352665A (en) | Page loading method, device, equipment and storage medium thereof | |
| JP2007206798A (en) | Program, method and device for generating control program | |
| US20080275903A1 (en) | Flexible interface using scalable vector graphics with metalevel palette | |
| CN113076162B (en) | Processing method, device and storage medium for interactive scene plug-in half-screen display | |
| CN115495188A (en) | Theme color switching method, device, equipment and medium for hybrid development APP | |
| CN115904377A (en) | Front-end page control method and device, electronic equipment and storage medium | |
| CN112988810A (en) | Information searching method, device and equipment | |
| CN113986416B (en) | Method and system for rendering font icon based on Flutter | |
| CN116708334B (en) | A method for displaying notification message and electronic device | |
| US20250013707A1 (en) | Sub-application page processing method and apparatus, computer device, and storage medium | |
| CN113031945B (en) | Data processing method and device for web pages, electronic equipment, and medium | |
| CN110780920B (en) | Data processing method, device, client and medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| TA01 | Transfer of patent application right | ||
| TA01 | Transfer of patent application right |
Effective date of registration: 20220905 Address after: No.12 Zhuantang science and technology economic block, Xihu District, Hangzhou City, Zhejiang Province Applicant after: Aliyun Computing Co.,Ltd. Address before: 310056 room 508, floor 5, building 4, No. 699, Wangshang Road, Changhe street, Binjiang District, Hangzhou, Zhejiang Applicant before: Alibaba (China) Co.,Ltd. |
|
| GR01 | Patent grant | ||
| GR01 | Patent grant |