Method, device, electronic device, and storage medium for rendering user interface components

By obtaining the material information of the user interface component and the width of the window to be rendered, the display accuracy problem caused by different container sizes is solved, and the reuse rate and code maintenance efficiency of the user interface component are improved.

CN111324835BActive Publication Date: 2024-11-19DOUYIN VISION CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202010081399.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-02-06
Publication Date
2024-11-19
Estimated Expiration
2040-08-05

AI Technical Summary

Technical Problem

When using the same web page resource in different places, the container sizes of the encapsulated web page resource are inconsistent, resulting in different display accuracy of elements in the page resource, and the settings are cumbersome and inefficient.

Method used

By obtaining the material information of the target user interface component and the width of the window to be rendered, a REM-style HTML file is generated. The font size attribute value is determined based on the width. The HTML file is mounted inside the predetermined web page file, so that the browser can render it to the waiting time when parsing. Render window.

Benefits of technology

It realizes dynamic rendering of user interface components according to different sizes of windows to be rendered, which improves the reuse rate of user interface components and facilitates code maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111324835B_ABST
    Figure CN111324835B_ABST
Patent Text Reader

Abstract

The disclosed embodiment discloses a method, device, electronic device, and storage medium for rendering a user interface component, the method comprising: obtaining material information of a target user interface component; determining the width of a window to be rendered of the target user interface component; generating an HTML file according to the material information and the width, wherein the elements of the HTML file use REM as a size unit, and the font size attribute value of the HTML file is determined according to the width; mounting the HTML file inside a predetermined web page file, so that the browser renders the target user interface component to the window to be rendered when parsing the HTML file. The technical solution of the disclosed embodiment can dynamically render user interface components according to windows to be rendered of different sizes, can improve the reuse rate of user interface components, and facilitate code maintenance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of computer network applications, and in particular to a method, device, electronic device, and storage medium for rendering a user interface component. Background Art

[0002] The same web page resource (user experience UE, user interface UI) can be used as an H5 page, an embedded page, or a page pop-up window, which can achieve resource reuse on the one hand and facilitate code maintenance on the other hand. However, when the web page resource is used in different places, the size of the container encapsulating the web page resource may be inconsistent, resulting in different display accuracy of the elements contained in the page resource.

[0003] If different settings are made according to the container size based on the page resources used in different places, it will be cumbersome and inefficient. Summary of the invention

[0004] In view of this, the embodiments of the present disclosure provide a method, device, electronic device, and storage medium for rendering user interface components, so as to dynamically render user interface components according to windows to be rendered of different sizes, improve the reuse rate of user interface components, and facilitate code maintenance.

[0005] Other features and advantages of the embodiments of the present disclosure will become apparent from the following detailed description or may be learned in part by the practice of the embodiments of the present disclosure.

[0006] In a first aspect, an embodiment of the present disclosure provides a method for rendering a user interface component, comprising:

[0007] Get the material information of the target user interface component;

[0008] Determine the width of the window to be rendered of the target user interface component;

[0009] Generate an HTML file according to the material information and the width, wherein the elements of the HTML file use REM (font size of the root element, which refers to the unit of font size relative to the root element) as a size unit, and the font size attribute value of the HTML file is determined according to the width;

[0010] The HTML file is mounted inside a predetermined web page file, so that the browser renders the target user interface component to the window to be rendered when parsing the HTML file.

[0011] In a second aspect, an embodiment of the present disclosure further provides a device for rendering a user interface component, including:

[0012] A material information acquisition unit, used to acquire material information of a target user interface component;

[0013] A width determination unit, used to determine the width of the to-be-rendered window of the target user interface component;

[0014] A file generating unit, configured to generate an HTML file according to the material information and the width, wherein the elements of the HTML file use REM as a size unit, and a font size attribute value of the HTML file is determined according to the width;

[0015] The file mounting unit is used to mount the HTML file into a predetermined web page file, so that the browser renders the target user interface component to the to-be-rendered window when parsing the HTML file.

[0016] In a third aspect, an embodiment of the present disclosure further provides an electronic device, including:

[0017] one or more processors;

[0018] A memory for storing one or more programs;

[0019] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of the first aspects.

[0020] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method as described in any one of the first aspects.

[0021] The disclosed embodiment generates a REM-style HTML file by acquiring the material information of the target user interface component and the width of the window to be rendered, wherein the font size attribute value is determined according to the width, and the HTML file is mounted inside a predetermined web page file so that the browser renders the target user interface component to the window to be rendered when parsing the HTML file. The user interface component can be dynamically rendered according to windows to be rendered of different sizes, which can improve the reuse rate of the user interface component and facilitate code maintenance. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the description of the embodiments of the present disclosure will be briefly introduced below. Obviously, the drawings described below are only part of the embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on the contents of the embodiments of the present disclosure and these drawings without paying any creative work.

[0023] Figure 1is a flowchart of a method for rendering a user interface component provided by an embodiment of the present disclosure;

[0024] Figure 2 It is a flowchart of generating an HTML file in another method for rendering a user interface component provided by an embodiment of the present disclosure;

[0025] Figure 3 is a structural schematic diagram of a device for rendering a user interface component provided by an embodiment of the present disclosure;

[0026] Figure 4 is a structural schematic diagram of another device for rendering a user interface component provided by an embodiment of the present disclosure;

[0027] Figure 5 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0028] In order to make the technical problems solved by the embodiments of the present disclosure, the technical solutions adopted, and the technical effects achieved more clearly, the technical solutions of the embodiments of the present disclosure will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments of the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the embodiments of the present disclosure.

[0029] It should be noted that the terms "system" and "network" in the embodiments of the present disclosure are often used interchangeably herein. The "and / or" mentioned in the embodiments of the present disclosure refers to any and all combinations including one or more of the related listed items. The terms "first", "second", etc. in the specification, claims and drawings of the present disclosure are used to distinguish different objects, rather than to limit a specific order.

[0030] It should also be noted that the following embodiments in the embodiments of the present disclosure may be executed separately, or in combination with each other, and the embodiments of the present disclosure do not impose specific limitations on this.

[0031] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0032] The technical solution of the embodiment of the present disclosure is further explained below with reference to the accompanying drawings and through specific implementation methods.

[0033] Figure 1A flow chart of a method for rendering a user interface component provided by an embodiment of the present disclosure is shown. This embodiment is applicable to the case where a user interface component is dynamically rendered according to windows to be rendered of different sizes. The method can be executed by a browser according to a specified instruction code, such as Figure 1 As shown, the method for rendering a user interface component described in this embodiment includes:

[0034] In step S110, material information of the target user interface component is obtained.

[0035] Among them, the target user interface component can be a UI interface component or a UE interface component, which can be an H5 page, an embedded page or a pop-up window of a page, etc.

[0036] This step can adopt a variety of methods, for example, the material information of the target user interface component can be obtained according to the identifier of the target user interface component. For example, the indication code can obtain the material information of the user interface component from the server according to the download address of the incoming target user interface component.

[0037] The specific organization form of the material information is not limited in this embodiment, as long as the HTML file corresponding to the user interface component can be generated by script code according to the material information. For example, the material information may include a web design draft of the target user interface, wherein the elements of the web design draft use absolute size units.

[0038] In step S120, the width of the window to be rendered of the target user interface component is determined.

[0039] For example, if the target user interface component is used as an H5 page, the window to be rendered is the visible window of the browser, and the width is the width of the visible window of the browser.

[0040] In step S130, an HTML file is generated according to the material information and the width, wherein the elements of the HTML file use REM as a size unit, and the font size attribute value of the HTML file is determined according to the width.

[0041] The specific method of this step varies depending on the way the material information of the target user interface component is organized. In addition, even if the same material information is used, the specific method of generating the HTML file may be different. As long as the HTML file can be generated based on the material information and the width, the specific method is not limited in this embodiment.

[0042] In step S140, the HTML file is mounted inside a predetermined web page file, so that the browser renders the target user interface component to the to-be-rendered window when parsing the HTML file.

[0043] We know that user interface components can be used as H5 pages, embedded pages, or pop-up windows of pages.

[0044] If the user interface component can be used as an H5 page, the window to be rendered is a visible window of the browser. In step S140, mounting the HTML file into a predetermined web page file includes: using the HTML file as the predetermined web page file.

[0045] If the user interface component can be used as an embedded page or a pop-up window of a page, the window to be rendered is an embedded window or a pop-up window. In step S140, mounting the HTML file into a predetermined web page file includes:

[0046] Creating a floating window type element, wrapping the HTML file in the floating window type element, wherein the transparency attribute value of the floating window type element is 0;

[0047] The element of the floating window type is mounted to a predetermined position of the predetermined web page file.

[0048] For example, the floating window type element may be an IFRAME type element.

[0049] If the user interface component can be used as an embedded page or a pop-up window of a page, the specified instruction code can be a script code inside the predetermined web page file. When the browser parses the predetermined web page file, it parses the script code to execute the technical solution of this embodiment.

[0050] This embodiment generates a REM-style HTML file by acquiring the material information of the target user interface component and the width of the window to be rendered, wherein the font size attribute value is determined according to the width, and mounts the HTML file inside a predetermined web page file so that the browser renders the target user interface component to the window to be rendered when parsing the HTML file. The user interface component can be dynamically rendered according to windows to be rendered of different sizes, and the target user interface component can adapt to containers of different sizes, thereby improving the reuse rate of the user interface component and facilitating code maintenance.

[0051] Figure 2 A schematic diagram of the process of generating an HTML file in another method of rendering a user interface component provided by an embodiment of the present disclosure is shown. This embodiment is based on the above embodiment and takes the web design draft of the target user interface as an example, wherein the material information includes the web design draft of the target user interface, and the elements of the web design draft use absolute size units, to provide a method for generating an HTML file according to the material information and the width of the window to be rendered. Figure 2As shown, the method for generating an HTML file described in this embodiment includes:

[0052] In step S210, the REM value of each element in the webpage design draft is determined according to the ratio of the size of each element in the webpage design draft to the design standard size of the webpage design draft.

[0053] REM (font size of the root element) refers to the unit of font size relative to the root element. In short, it is a relative unit, which refers to the unit of font size relative to the root element.

[0054] For example, if the width of the design draft is 640px, and the font size of the root element is 10px (that is, 1REM equals 10px), the size of all interface elements in the design draft is set to the size divided by 10 and converted into REM form to determine the REM value of each interface element.

[0055] Among them, the interface elements in the web page design draft of the user interface component include but are not limited to input controls, navigation controls, and information controls.

[0056] The input controls include but are not limited to buttons, text boxes, selection boxes, radio buttons, drop-down lists, list boxes, switch buttons, etc. The navigation controls include but are not limited to breadcrumb navigation, sliders, search bars, paging, labels, and icons, etc. The information controls include but are not limited to text prompt boxes, icons, progress bars, prompts, message boxes, and modal windows, etc.

[0057] In step S220, an HTML file is generated according to the web page design draft and the REM value of each element, wherein the elements of the HTML file use REM as a size unit.

[0058] According to the distribution position and REM value of each interface element in the web page design draft, a corresponding HTML file is generated.

[0059] In step S230, the font size attribute value of the HTML file is reset according to the ratio of the width of the window to be rendered to the design standard size.

[0060] REM is relative to the root element, which means that we only need to determine a px font size in the root element, that is, set FONT-SIZE, and then we can calculate the width and height of the element.

[0061] For example, if the width of the window to be rendered is 320PX, that is, the width is half of the width of the design draft, then 1REM is equal to 5PX, and the FONT-SIZE value is 5 / 10=50%.

[0062] Based on the previous embodiment, this embodiment provides a method for generating an HTML file according to the material information and the width of the window to be rendered, taking the case where the material information includes a web page design draft of the target user interface, wherein the elements of the web page design draft use absolute size units. The method can perform rendering adaptation according to the design draft of the target user interface component, thereby improving the reuse rate of the user interface design draft.

[0063] As an implementation of the methods shown in the above figures, the present application provides an embodiment of a device for rendering a user interface component. Figure 3 A schematic diagram of the structure of a device for rendering a user interface component provided by this embodiment is shown. Figure 1 and Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices. Figure 3 As shown, the apparatus for rendering a user interface component described in this embodiment includes a material information acquisition unit 310 , a width determination unit 320 , a file generation unit 330 and a file mounting unit 340 .

[0064] The material information acquisition unit 310 is configured to acquire material information of a target user interface component.

[0065] The width determination unit 320 is configured to determine the width of the to-be-rendered window of the target user interface component.

[0066] The file generating unit 330 is configured to generate an HTML file according to the material information and the width, wherein the elements of the HTML file use REM as a size unit, and the font size attribute value of the HTML file is determined according to the width.

[0067] The file mounting unit 340 is configured to mount the HTML file into a predetermined web page file, so that the browser renders the target user interface component to the to-be-rendered window when parsing the HTML file.

[0068] In one embodiment, if the window to be rendered is a visible window of the browser, the file mounting unit 340 is configured to use the HTML file as the predetermined web page file.

[0069] In one embodiment, if the window to be rendered is an embedded window or a pop-up window, the file mounting unit 340 is configured to:

[0070] Creating a floating window type element, wrapping the HTML file in the floating window type element, wherein the transparency attribute value of the floating window type element is 0;

[0071] The element of the floating window type is mounted to a predetermined position of the predetermined web page file.

[0072] Furthermore, the floating window type element is an IFRAME type element.

[0073] Furthermore, the material information acquiring unit 310 is configured to acquire the material information of the target user interface component according to the identifier of the target user interface component.

[0074] The device for rendering a user interface component provided in this embodiment can execute the method for rendering a user interface component provided in the method embodiment of the present disclosure, and has functional modules and beneficial effects corresponding to the execution method.

[0075] Figure 4 A schematic diagram of the structure of another device for rendering a user interface component provided by an embodiment of the present disclosure is shown. Figure 4 As shown, the apparatus for rendering a user interface component described in this embodiment includes a material information acquisition unit 410, a width determination unit 420, a file generation unit 430, and a file mounting unit 440. The file generation unit 430 further includes a REM value determination subunit 431, a file generation subunit 432, and a size resetting subunit 433.

[0076] The material information acquisition unit 410 is configured to acquire material information of a target user interface component.

[0077] The width determination unit 420 is configured to determine the width of the to-be-rendered window of the target user interface component.

[0078] The file generating unit 430 is configured to generate an HTML file according to the material information and the width, wherein the elements of the HTML file use REM as a size unit, and the font size attribute value of the HTML file is determined according to the width.

[0079] The material information includes a web design draft of the target user interface, wherein the elements of the web design draft use absolute size units, and the file generation unit 430 further includes a REM value determination subunit 431, a file generation subunit 432 and a size resetting subunit 433.

[0080] The REM value determination subunit 431 is configured to determine the REM value of each element according to the ratio of the size of each element in the webpage design draft to the design standard size of the webpage design draft.

[0081] The file generation subunit 432 is configured to generate an HTML file according to the webpage design draft and the REM value of each element, wherein the elements of the HTML file use REM as a size unit.

[0082] The size resetting subunit 433 is configured to reset the font size attribute value of the HTML file according to the ratio of the width to the design standard size.

[0083] The file mounting unit 440 is configured to mount the HTML file into a predetermined web page file, so that the browser renders the target user interface component to the to-be-rendered window when parsing the HTML file.

[0084] In one embodiment, if the window to be rendered is a visible window of the browser, the file mounting unit 440 is configured to use the HTML file as the predetermined web page file.

[0085] In one embodiment, if the window to be rendered is an embedded window or a pop-up window, the file mounting unit 440 is configured to:

[0086] Creating a floating window type element, wrapping the HTML file in the floating window type element, wherein the transparency attribute value of the floating window type element is 0;

[0087] The element of the floating window type is mounted to a predetermined position of the predetermined web page file.

[0088] Furthermore, the floating window type element is an IFRAME type element.

[0089] Furthermore, the material information acquiring unit 410 is configured to acquire the material information of the target user interface component according to the identifier of the target user interface component.

[0090] The device for rendering a user interface component provided in this embodiment can execute the method for rendering a user interface component provided in the method embodiment of the present disclosure, and has functional modules and beneficial effects corresponding to the execution method.

[0091] Reference below Figure 5 , which shows a schematic diagram of the structure of an electronic device 500 suitable for implementing the embodiment of the present disclosure. The electronic device in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0092] like Figure 5 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0093] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0094] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 509, or installed from the storage device 508, or installed from the ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the present disclosure are executed.

[0095] It should be noted that the computer-readable medium in the embodiment of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the embodiment of the present disclosure, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In the embodiment of the present disclosure, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer 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. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0096] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0097] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:

[0098] Get the material information of the target user interface component;

[0099] Determine the width of the window to be rendered of the target user interface component;

[0100] Generate an HTML file according to the material information and the width, wherein the elements of the HTML file use REM as a size unit, and the font size attribute value of the HTML file is determined according to the width;

[0101] The HTML file is mounted inside a predetermined web page file, so that the browser renders the target user interface component to the window to be rendered when parsing the HTML file.

[0102] Computer program code for performing the operations of the disclosed embodiments may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0103] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0104] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".

[0105] According to one or more embodiments of the present disclosure, in the method of rendering a user interface component, if the window to be rendered is a visible window of the browser, mounting the HTML file into a predetermined web page file includes: using the HTML file as the predetermined web page file.

[0106] According to one or more embodiments of the present disclosure, in the method for rendering a user interface component, if the window to be rendered is an embedded window or a pop-up window, mounting the HTML file into a predetermined web page file includes:

[0107] Creating a floating window type element, wrapping the HTML file in the floating window type element, wherein the transparency attribute value of the floating window type element is 0;

[0108] The element of the floating window type is mounted to a predetermined position of the predetermined web page file.

[0109] According to one or more embodiments of the present disclosure, in the method for rendering a user interface component, the floating window type element is an IFRAME type element.

[0110] According to one or more embodiments of the present disclosure, the method for rendering a user interface component is executed by a script code of a predetermined web page file content.

[0111] According to one or more embodiments of the present disclosure, in the method for rendering a user interface component, acquiring the material information of a target user interface component includes: acquiring the material information of the target user interface component according to an identifier of the target user interface component.

[0112] According to one or more embodiments of the present disclosure, in the method for rendering a user interface component, the material information includes a web page design draft of the target user interface, wherein the elements of the web page design draft use absolute size units;

[0113] Generating an HTML file according to the material information and the width includes:

[0114] Determine the REM value of each element according to the ratio of the size of each element in the webpage design draft to the design standard size of the webpage design draft;

[0115] Generate an HTML file according to the webpage design draft and the REM value of each element, wherein the elements of the HTML file use REM as a size unit;

[0116] The font size attribute value of the HTML file is reset according to the ratio of the width to the design standard size.

[0117] According to one or more embodiments of the present disclosure, in the device for rendering a user interface component, if the window to be rendered is a visible window of the browser, the file mounting unit is used to: use the HTML file as the predetermined web page file.

[0118] According to one or more embodiments of the present disclosure, in the device for rendering a user interface component, if the window to be rendered is an embedded window or a pop-up window, the file mounting unit is used to:

[0119] Creating a floating window type element, wrapping the HTML file in the floating window type element, wherein the transparency attribute value of the floating window type element is 0;

[0120] The element of the floating window type is mounted to a predetermined position of the predetermined web page file.

[0121] According to one or more embodiments of the present disclosure, in the device for rendering a user interface component, the floating window type element is an IFRAME type element.

[0122] According to one or more embodiments of the present disclosure, in the device for rendering a user interface component, the material information acquisition unit is used to: acquire the material information of the target user interface component according to the identifier of the target user interface component.

[0123] According to one or more embodiments of the present disclosure, in the device for rendering a user interface component, the material information includes a web page design draft of the target user interface, wherein the elements of the web page design draft use absolute size units;

[0124] The file generating unit comprises:

[0125] A REM value determination subunit determines the REM value of each element according to the ratio of the size of each element in the webpage design draft to the design standard size of the webpage design draft;

[0126] A file generation subunit, configured to generate an HTML file according to the webpage design draft and the REM value of each element, wherein the elements of the HTML file use REM as a size unit;

[0127] The size resetting subunit is used to reset the font size attribute value of the HTML file according to the ratio of the width to the design standard size.

[0128] The above description is only a preferred embodiment of the embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the embodiment of the present disclosure is not limited to the technical solution formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned public concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiment of the present disclosure (but not limited to) to form a technical solution.

Claims

1. A method for rendering a user interface component, characterized in that: include: Acquire material information of a target user interface component, the material information including a web page design of the target user interface, wherein the elements of the web page design use absolute size units, the elements including but not limited to input controls, navigation controls and information controls, the input controls including but not limited to buttons, text boxes, selection boxes, radio buttons, drop-down lists, list boxes and switch buttons, the navigation controls including but not limited to breadcrumb navigation, sliders, search bars, paging, labels and icons, the information controls including but not limited to text prompt boxes, icons, progress bars, prompts, message boxes and modal windows; Determine the width of the window to be rendered of the target user interface component; Determine the REM value of each element according to the ratio of the size of each element in the webpage design draft to the design standard size of the webpage design draft; Generate an HTML file according to the webpage design draft and the REM value of each element, wherein the elements of the HTML file use REM as a size unit; Resetting the font size attribute value of the HTML file according to the ratio of the width to the design standard size; Mounting the HTML file into a predetermined web page file, so that the browser renders the target user interface component to the to-be-rendered window when parsing the HTML file; Mounting the HTML file into a predetermined web page file includes: If the window to be rendered is an embedded window or a pop-up window, a floating window type element is newly created, and the HTML file is wrapped in the floating window type element, wherein the transparency attribute value of the floating window type element is 0, and the floating window type element is an IFRAME type element; The element of the floating window type is mounted to a predetermined position of the predetermined web page file.

2. The method according to claim 1, characterized in that If the window to be rendered is a visible window of the browser, mounting the HTML file into a predetermined web page file includes: using the HTML file as the predetermined web page file.

3. The method according to claim 1, characterized in that The method is executed by script codes of predetermined web page file contents.

4. The method according to claim 1, characterized in that: The acquiring the material information of the target user interface component includes: acquiring the material information of the target user interface component according to the identifier of the target user interface component.

5. A device for rendering a user interface component, characterized in that: include: a material information acquisition unit, configured to acquire material information of a target user interface component, wherein the material information includes a web page design draft of the target user interface, wherein the elements of the web page design draft use absolute size units, and the elements include but are not limited to input controls, navigation controls, and information controls, wherein the input controls include but are not limited to buttons, text boxes, selection boxes, radio buttons, drop-down lists, list boxes, and switch buttons, wherein the navigation controls include but are not limited to breadcrumb navigation, sliders, search bars, paging, labels, and icons, and wherein the information controls include but are not limited to text prompt boxes, icons, progress bars, prompts, message boxes, and modal windows; A width determination unit, used to determine the width of the to-be-rendered window of the target user interface component; A file generating unit, used for determining the REM value of each element in the webpage design draft according to the ratio of the size of each element in the webpage design draft to the design standard size of the webpage design draft; Generate an HTML file according to the webpage design draft and the REM value of each element, wherein the elements of the HTML file use REM as a size unit; reset the font size attribute value of the HTML file according to the ratio of the width to the design standard size; A file mounting unit, used for mounting the HTML file into a predetermined web page file, so that the browser renders the target user interface component into the to-be-rendered window when parsing the HTML file; Mounting the HTML file into a predetermined web page file includes: If the window to be rendered is an embedded window or a pop-up window, a floating window type element is newly created, and the HTML file is wrapped in the floating window type element, wherein the transparency attribute value of the floating window type element is 0, and the floating window type element is an IFRAME type element; The element of the floating window type is mounted to a predetermined position of the predetermined web page file.

6. An electronic device, characterized in that: include: one or more processors; A memory for storing 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 method according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Page rendering method and device

    CN107402757A

  • Interactive page editing method and terminal

    CN107463584A

  • Page generation method and device

    CN109614568A

  • Dynamic page display method and device, electronic device and storage medium

    CN110096277A

  • Page rendering method and device

    CN110263287A