Method and device for adjusting component level
By binding components and component arrays, the conversion level is adjusted to array position movement, which solves the problems of confusing component level relationships and high storage costs, and achieves component level continuity and low-cost network transmission.
Patent Information
- Application Number
- CN201810442258.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-05-10
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2038-05-10
AI Technical Summary
When adjusting the component hierarchy in a web page editor with the existing technology, it is easy to cause discontinuous z-index values, confusing hierarchical relationships, and high storage and network transmission costs.
By binding the components in the canvas to the elements in the component array, the component level is converted into the position movement of the array elements, and the array characteristics are used to achieve continuity and consistency at the component level, avoiding reliance on the z-index attribute.
It achieves the continuity and uniqueness of component hierarchical relationships, reduces storage and network transmission costs, and improves adjustment efficiency.
Smart Images

Figure CN110471656B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a component level adjustment method and device. Background Art
[0002] In the process of implementing a web page editor based on a browser, multiple components in the canvas will overlap each other, so the hierarchical relationship of the components needs to be adjusted. In existing technical solutions, the component hierarchy is generally adjusted by simply adding or subtracting the z-index value of the component stacking order: the larger the z-index value, the closer the component is to the user; otherwise, the farther it is from the user.
[0003] In the process of implementing the present invention, the inventors found that the prior art has at least the following problems:
[0004] 1. The existing technology easily causes the z-index value of the component to be discontinuous, and the maximum z-index value is generally much larger than the number of components. This results in that when adjusting the hierarchy of a component, the component often needs to be triggered multiple times to achieve the expected effect.
[0005] 2. In the prior art, when the z-index values of components are the same, their hierarchical relationship depends on the order in which the components are loaded, which in fact makes it impossible to control the actual hierarchy of the components in this case.
[0006] 3. The existing technology needs to record the instantaneous z-index value of each component, which increases the cost of component storage and network transmission. Summary of the invention
[0007] In view of this, an embodiment of the present invention provides a method and device for adjusting component hierarchy, which can flexibly adjust the component hierarchy without relying on the component z-index property, thereby overcoming the defects of confusing component hierarchy relationships and high component storage and network transmission costs in the prior art.
[0008] To achieve the above objective, according to one aspect of the present invention, a component level adjustment method is provided.
[0009] The component hierarchy adjustment method of an embodiment of the present invention includes: obtaining the identifier and hierarchy adjustment strategy of the component in the canvas targeted by the hierarchy adjustment instruction from an event triggered by the hierarchy adjustment instruction; wherein the component is bound in advance to an array element containing the identifier of the component in a pre-stored component array; adjusting the position of the array element in the component array according to the hierarchy adjustment strategy; after the adjustment is completed, rendering the canvas according to the current position of the array element in the component array.
[0010] Optionally, the method further comprises: maintaining a stacking order value z-index of each component in the canvas at a default value.
[0011] Optionally, the level adjustment instruction includes: a level up instruction; and adjusting the position of the array element in the component array according to the level adjustment strategy specifically includes: determining the initial position of the array element in the component array; when the initial position is not the end of the component array, placing the array element at the position above the initial position.
[0012] Optionally, the level adjustment instruction includes: a level down instruction; and adjusting the position of the array element in the component array according to the level adjustment strategy specifically includes: determining the initial position of the array element in the component array; when the initial position is not the beginning of the component array, placing the array element at the next position of the initial position.
[0013] Optionally, the level adjustment instruction includes: a level top instruction; and adjusting the position of the array element in the component array according to the level adjustment strategy specifically includes: determining the initial position of the array element in the component array; when the initial position is not the end of the component array, placing the array element at the end of the component array.
[0014] Optionally, the level adjustment instruction includes: a level bottom instruction; and adjusting the position of the array element in the component array according to the level adjustment strategy specifically includes: determining the initial position of the array element in the component array; when the initial position is not the beginning of the component array, placing the array element at the beginning of the component array.
[0015] Optionally, the level adjustment instruction includes: a delete instruction; and adjusting the position of the array element in the component array according to the level adjustment strategy specifically includes: deleting the array element from the component array.
[0016] Optionally, the hierarchical adjustment instruction includes: a copy instruction; and adjusting the position of the array element in the component array according to the hierarchical adjustment strategy specifically includes: determining the initial position of the array element in the component array; copying the array element and resetting the component identifier in the copied data, and placing the obtained data as a component element in the position above the initial position in the component array.
[0017] Optionally, the method further comprises: receiving a component adding instruction, acquiring component template data according to the component adding instruction; after resetting the component identifier in the component template data, placing it as a component element at the end of the component array; and rendering the canvas.
[0018] Optionally, each component in the canvas is a component in an HTML5 webpage editor, and its positioning mode is absolute positioning.
[0019] To achieve the above objective, according to another aspect of the present invention, a component-level adjustment device is provided.
[0020] The component hierarchy adjustment device of an embodiment of the present invention includes: an identification acquisition module, which is used to obtain the identification and hierarchy adjustment strategy of the component in the canvas targeted by the hierarchy adjustment instruction from the event triggered by the hierarchy adjustment instruction; wherein the component is bound in advance to an array element containing the identification of the component in a pre-stored component array; a hierarchy adjustment module, which is used to adjust the position of the array element in the component array according to the hierarchy adjustment strategy; after the adjustment is completed, the canvas is rendered according to the current position of the array element in the component array.
[0021] Optionally, the device further comprises: a configuration module, configured to keep a stacking order value z-index of each component in the canvas at a default value.
[0022] Optionally, the level adjustment instruction includes: a level up instruction; and the level adjustment module is further used to: determine the initial position of the array element in the component array; when the initial position is not the end of the component array, place the array element at the position above the initial position.
[0023] Optionally, the level adjustment instruction includes: a level down instruction; and the level adjustment module is further used to: determine the initial position of the array element in the component array; when the initial position is not the beginning of the component array, place the array element at the next position of the initial position.
[0024] Optionally, the level adjustment instruction includes: a level top instruction; and the level adjustment module is further used to: determine the initial position of the array element in the component array; when the initial position is not the end of the component array, place the array element at the end of the component array.
[0025] Optionally, the level adjustment instruction includes: a level bottom instruction; and the level adjustment module is further used to: determine the initial position of the array element in the component array; when the initial position is not the beginning of the component array, place the array element at the beginning of the component array.
[0026] Optionally, the level adjustment instruction includes: a deletion instruction; and the level adjustment module is further used to: delete the array element from the component array.
[0027] Optionally, the level adjustment instruction includes: a copy instruction; and the level adjustment module is further used to: determine the initial position of the array element in the component array; copy the array element and reset the component identifier in the copied data, and place the obtained data as a component element in the position above the initial position in the component array.
[0028] Optionally, the device further includes: an addition instruction processing module, which is used to receive a component addition instruction and obtain component template data according to the component addition instruction; after resetting the component identifier in the component template data, place it as a component element at the end of the component array; and render the canvas.
[0029] Optionally, each component in the canvas is a component in an HTML5 webpage editor, and its positioning mode is absolute positioning.
[0030] To achieve the above objective, according to another aspect of the present invention, an electronic device is provided.
[0031] An electronic device of the present invention includes: one or more processors; a storage device 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 component level adjustment method provided by the present invention.
[0032] To achieve the above objective, according to yet another aspect of the present invention, a computer-readable storage medium is provided.
[0033] A computer-readable storage medium of the present invention stores a computer program, which, when executed by a processor, implements the component level adjustment method provided by the present invention.
[0034] According to the technical solution of the present invention, one embodiment of the above invention has the following advantages or beneficial effects: by pre-binding the components in the canvas and the elements in the component array, the adjustment of the component hierarchy is converted into the position movement of the array elements, thereby achieving the continuity of the component hierarchy relationship and the uniqueness of each component hierarchy without relying on the component z-index attribute, ensuring that the hierarchy-related parameters will not exceed the number of components, saving component storage and network transmission costs.
[0035] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0037] Figure 1is a schematic diagram of main steps of a method for adjusting component levels according to an embodiment of the present invention;
[0038] Figure 2 is a schematic diagram of binding components and array elements according to a method for adjusting component levels in an embodiment of the present invention;
[0039] Figure 3 is a schematic diagram of components of a component-level adjustment device according to an embodiment of the present invention;
[0040] Figure 4 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
[0041] Figure 5 It is a structural schematic diagram of an electronic device used to implement the component level adjustment method in an embodiment of the present invention. DETAILED DESCRIPTION
[0042] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0043] The technical solution of the embodiment of the present invention converts the adjustment of the component hierarchy into the position movement of the array elements by pre-binding the components in the canvas and the elements in the component array, thereby utilizing the inherent characteristics of the array to achieve the continuity and consistency of the component hierarchy, thereby overcoming the defects of the prior art of chaotic component hierarchy relationship and high component storage and network transmission costs.
[0044] It should be pointed out that the embodiments of the present invention and the technical features therein may be combined with each other without conflict.
[0045] Figure 1 4 is a schematic diagram of main steps of a component-level adjustment method according to an embodiment of the present invention.
[0046] like Figure 1 As shown, the component level adjustment method of the embodiment of the present invention can specifically perform the following steps:
[0047] Step S101: acquiring, from an event triggered by a level adjustment instruction, an identifier of a component in a canvas targeted by the level adjustment instruction and a level adjustment strategy.
[0048] In this step, a component refers to an independent view module in a page. In particular, in an embodiment of the present invention, a component may be a text, image, form, phone, sound effect, count, statistics, and other components in a web page editor of HyperText Markup Language HTML5. The level of a component refers to the stacking level of the layer where the component is located. The higher the level, the closer the component is to the user. The canvas is the page canvas, which is the parent container of each component and serves as the scene for component display and editing.
[0049] In the prior art, the component hierarchy is generally adjusted by simply adding or subtracting the stacking order value z-index of the component. In order to overcome the defects of chaotic component hierarchy and high component storage and network transmission costs, the present invention converts the adjustment of the component hierarchy into the position movement of the elements of the component array to achieve flexible adjustment of the component hierarchy. In order to achieve the association between the component and the component array, before step S101, it is first necessary to bind the component to the corresponding array element in the component array.
[0050] The component array is stored in the memory, and each array element thereof corresponds to a component. Each array element in the component array may be JS (a literal scripting language) object notation JSON (JavaScript Object Notation) data, and the structure of the component array may be as follows: [{id:xxx, attr1:a, attr2:b,…},{id:xxxxx, attr1:c, attr2:d,…}…], wherein each JSON data corresponds to a component, and the id in the JSON data is the identifier of the corresponding component.
[0051] Generally, binding refers to making the Document Object Model DOM (Document Object Model) elements (such as components in the page canvas) and data (such as component arrays) consistent in content, even if the two are bidirectionally bound, no matter which one changes, the other will be updated to the same data accordingly. In the embodiment of the present invention, it is necessary to bind the component to the array element containing the component identifier in the pre-stored component array before step S101. In specific applications, the above binding can be achieved through commands such as v-for in Vue.js (a progressive framework for building user interfaces).
[0052] In this step, after receiving the level adjustment instruction issued by the user, the identifier of the component targeted by the level adjustment instruction (i.e., the component to be level adjusted) can be obtained from the HTML event triggered by the level adjustment instruction, and the corresponding level adjustment strategy can also be obtained. Among them, the level adjustment instruction can be a click instruction, a keyboard button press instruction, a mouse button press instruction, etc., and the HTML events corresponding to the above instructions are onclick events, onkeydown events, and onmousedown events. The level adjustment strategy refers to the content of the level change indicated by the level adjustment instruction. For example: when the level adjustment instruction is to move up the level, the level adjustment strategy is: increase the level of the component targeted by the level adjustment instruction by one level.
[0053] Step S102: adjusting the position of the array element in the component array according to the level adjustment strategy; after the adjustment is completed, rendering the canvas according to the current position of the array element in the component array.
[0054] Generally, the position of an array element in a component array can be represented by its index. In specific applications, the position of an array element can be changed by array native methods such as push, pop, shift, unshift, splice, etc. In an embodiment of the present invention, array changes can be monitored, and canvas rendering can be triggered when it is determined that an array element has changed, thereby displaying the adjusted component hierarchy relationship. Among them, the above rendering refers to the process of displaying DOM elements (such as components and their hierarchies in the canvas) by constructing a rendering tree, which can be implemented by executing a rendering callback function.
[0055] In particular, in order to avoid the influence of component z-index on the level adjustment, in the embodiment of the present invention, the z-index of each component in the canvas needs to be kept at the default value. At the same time, the positioning mode of each component in the canvas needs to be set to absolute positioning, and the positioning mode of the canvas needs to be set to absolute positioning, relative positioning, or fixed positioning.
[0056] The following describes the strategies when receiving different level adjustment instructions:
[0057] 1. Level Up Instructions
[0058] When a level-up instruction is received (the instruction indicates to adjust the component level up by one level), first determine the array element containing the identifier of the component obtained in step S101 and its initial position from the component array, and then determine whether its initial position is the end of the array: if so, end the operation; otherwise, remove the array element, place it at the position above the initial position, and render the canvas according to the current position of the array element in the component array.
[0059] The end of the array refers to the position of the last element of the component array, and the component bound to the array element at this position is located at the top of the canvas. Similarly, the beginning of the array refers to the position of the first element of the component array, and the component bound to the array element at this position is located at the bottom of the canvas.
[0060] 2. Downward level command
[0061] When a level-down instruction is received (the instruction indicates to adjust the component level down by one level), first determine the array element containing the identifier of the component obtained in step S101 and its initial position from the component array, and then determine whether its initial position is the beginning of the array: if so, end the operation; otherwise, remove the array element and place it at the next position of the initial position, and render the canvas according to the current position of the array element in the component array.
[0062] 3. Top-level command
[0063] When receiving a top-level command (the command indicates to adjust the component level to the highest level), first determine the array element containing the identifier of the component obtained in step S101 and its initial position from the component array, and then determine whether its initial position is the end of the array: if so, end the operation; otherwise, remove the array element and place it at the end of the component array, and render the canvas according to the current position of the array element in the component array. Among them, whether the initial position is the end of the array can be determined by detecting whether the index of the initial position is the difference between the length of the component array and 1.
[0064] 4. Bottom-level command
[0065] When receiving a level bottom instruction (the instruction indicates to adjust the component level to the lowest level), first determine the array element containing the component identifier obtained in step S101 and its initial position from the component array, and then determine whether its initial position is the beginning of the array: if so, end the operation; otherwise, remove the array element, place it at the beginning of the component array, and render the canvas according to the current position of the array element in the component array. Among them, whether the initial position is the beginning of the array can be determined by detecting whether the index of the initial position is zero.
[0066] As a preferred solution, the present invention can also automatically maintain the hierarchy when adding, deleting, or duplicating components. Specifically:
[0067] When a delete instruction (the instruction instructs to delete a component) is received, the array element containing the component identifier is deleted from the component array, and then the canvas is rendered.
[0068] When a copy instruction is received (the instruction indicates to copy a component), the initial position of the array element containing the component identifier in the component array is first determined, then the array element is copied and the component identifier in the copied data is reset, the obtained data is placed as a component element in the position before the initial position in the component array, and finally the canvas is rendered.
[0069] When receiving a component adding instruction (the instruction indicates adding a new component), first obtain the component template data according to the component adding instruction, and reset the component identifier in the component template data. Then, place it at the end of the component array as a component element, and finally render the canvas.
[0070] Through the above settings, the hierarchy of each component can automatically remain continuous and consistent when adding, deleting, or copying components.
[0071] Figure 2 is a schematic diagram of binding components and array elements according to a method for adjusting component levels in an embodiment of the present invention. Figure 2 As shown, the left side is the component array and its elements, and the right side is the stacked components in the page canvas, and two-way binding is implemented between the two.
[0072] In the technical solution of the embodiment of the present invention, by pre-binding the components in the canvas and the elements in the component array, the adjustment of the component level is converted into the position movement of the array elements, so as to realize the continuity and consistency of the component level by utilizing the inherent characteristics of the array, thus overcoming the defects of the prior art in that the component level relationship is chaotic and the component storage and network transmission costs are high. In addition, the component level adjustment method of the present invention is highly practical, and no additional level processing is required when deleting, copying, and adding components.
[0073] Figure 3 It is a schematic diagram of components of a component-level adjustment device according to an embodiment of the present invention.
[0074] like Figure 3 As shown, the component level adjustment device 300 of the embodiment of the present invention may include: an identification acquisition module 301 and a level adjustment module 302. Among them:
[0075] The identification acquisition module 301 can be used to obtain the identification and level adjustment strategy of the component in the canvas targeted by the level adjustment instruction from the event triggered by the level adjustment instruction; wherein the component is bound in advance to the array element containing the identification of the component in the pre-stored component array;
[0076] The level adjustment module 302 may be used to adjust the position of the array element in the component array according to the level adjustment strategy; after the adjustment is completed, the canvas is rendered according to the current position of the array element in the component array.
[0077] In an embodiment of the present invention, the apparatus 300 may further include a configuration module, which is used to keep the stacking order value z-index of each component in the canvas at a default value.
[0078] Preferably, the level adjustment instruction includes a level up instruction; the level adjustment module 302 can be further used to: determine the initial position of the array element in the component array; when the initial position is not the end of the component array, place the array element at the position above the initial position.
[0079] As a preferred scheme, the level adjustment instruction includes a level down instruction; the level adjustment module 302 can be further used to: determine the initial position of the array element in the component array; when the initial position is not the beginning of the component array, place the array element at the next position of the initial position.
[0080] In practical applications, the level adjustment instruction includes a level top instruction; the level adjustment module 302 can be further used to: determine the initial position of the array element in the component array; when the initial position is not the end of the component array, place the array element at the end of the component array.
[0081] In a specific application, the level adjustment instruction includes a level bottom instruction; the level adjustment module 302 can be further used to: determine the initial position of the array element in the component array; when the initial position is not the beginning of the component array, place the array element at the beginning of the component array.
[0082] In one embodiment, the level adjustment instruction includes a delete instruction; the level adjustment module 302 may be further configured to: delete the array element from the component array.
[0083] In an optional implementation, the level adjustment instruction includes a copy instruction; the level adjustment module 302 can be further used to: determine the initial position of the array element in the component array; copy the array element and reset the component identifier in the copied data, and place the obtained data as a component element in the position above the initial position in the component array.
[0084] In a specific application scenario, the device 300 may further include an add instruction processing module, which is used to receive a component add instruction, obtain component template data according to the component add instruction; after resetting the component identifier in the component template data, place it at the end of the component array as a component element and render the canvas.
[0085] In addition, in the embodiment of the present invention, each component in the canvas is a component in an HTML5 webpage editor, and its positioning method is absolute positioning.
[0086] According to the technical solution of the embodiment of the present invention, by pre-binding the components in the canvas and the elements in the component array, the adjustment of the component level is converted into the position movement of the array elements, so as to realize the continuity and consistency of the component level by utilizing the inherent characteristics of the array, thus overcoming the defects of the prior art in that the component level relationship is chaotic and the component storage and network transmission costs are high. In addition, the component level adjustment method of the present invention is highly practical, and no additional level processing is required when deleting, copying, and adding components.
[0087] Figure 4 An exemplary system architecture 400 is shown to which the component-level adjustment method or component-level adjustment apparatus according to the embodiment of the present invention can be applied.
[0088] like Figure 4 As shown, the system architecture 400 may include terminal devices 401, 402, 403, a network 404 and a server 405 (this architecture is only an example, and the components included in the specific architecture may be adjusted according to the specific application). The network 404 is used to provide a medium for a communication link between the terminal devices 401, 402, 403 and the server 405. The network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0089] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0090] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0091] The server 405 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 401, 402, and 403. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.
[0092] It should be noted that the component-level adjustment method provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the component-level adjustment device is generally disposed in the server 405 .
[0093] It should be understood that Figure 4The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0094] The present invention also provides an electronic device. The electronic device of an embodiment of the present invention includes: one or more processors; a storage device 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 component level adjustment method provided by the present invention.
[0095] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of an electronic device suitable for implementing an embodiment of the present invention. Figure 5 The 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 invention.
[0096] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 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 part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the computer system 500 are also stored. The CPU 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.
[0097] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed so that a computer program read therefrom is installed into the storage section 508 as needed.
[0098] In particular, according to the embodiments disclosed in the present invention, the process described in the main step diagram above can be implemented as a computer software program. For example, the embodiments of the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the main step diagram. In the above embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit 501, the above functions defined in the system of the present invention are executed.
[0099] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above 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 present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. 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. Computer readable signal media may also be any computer readable medium other than computer readable storage media, 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 appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0100] 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 invention. 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 above-mentioned module, program segment or a part of a 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 or flow chart, and the combination of the boxes in the block diagram 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.
[0101] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be provided in a processor, for example, may be described as: a processor including an identification acquisition module and a hierarchy adjustment module. The names of these modules do not, in some cases, constitute limitations on the modules themselves, for example, the identification acquisition module may also be described as a "module that sends component identification and hierarchy adjustment policies to the hierarchy adjustment module".
[0102] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be installed in the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by the device, the steps executed by the device include: obtaining the identifier and the hierarchy adjustment strategy of the component in the canvas targeted by the hierarchy adjustment instruction from the event triggered by the hierarchy adjustment instruction; wherein the component is bound in advance to the array element containing the identifier of the component in the pre-stored component array; adjusting the position of the array element in the component array according to the hierarchy adjustment strategy; after the adjustment is completed, rendering the canvas according to the current position of the array element in the component array.
[0103] In the technical solution of the embodiment of the present invention, by pre-binding the components in the canvas and the elements in the component array, the adjustment of the component level is converted into the position movement of the array elements, so as to realize the continuity and consistency of the component level by utilizing the inherent characteristics of the array, thus overcoming the defects of the prior art in that the component level relationship is chaotic and the component storage and network transmission costs are high. In addition, the component level adjustment method of the present invention is highly practical, and no additional level processing is required when deleting, copying, and adding components.
[0104] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A component-level adjustment method, characterized in that: include: From the event triggered by the level adjustment instruction, the identifier of the component in the canvas targeted by the level adjustment instruction and the level adjustment strategy are obtained; wherein the level refers to the stacking level of the layer where the component is located; the component is bound in advance to an array element containing the identifier of the component in a pre-stored component array; The position of the array element in the component array is adjusted according to the level adjustment strategy; after the adjustment is completed, the canvas is rendered according to the current position of the array element in the component array.
2. The method according to claim 1, characterized in that The method further comprises: Leave the stacking order value z-index of each component in the canvas at the default value.
3. The method according to claim 1, characterized in that The level adjustment instruction includes: a level up instruction; and adjusting the position of the array element in the component array according to the level adjustment strategy specifically includes: Determine the initial position of the array element in the component array; When the initial position is not the end of the component array, the array element is placed at the previous position of the initial position.
4. The method according to claim 1, characterized in that: The level adjustment instruction includes: a level down instruction; and the adjusting the position of the array element in the component array according to the level adjustment strategy specifically includes: Determine the initial position of the array element in the component array; When the initial position is not the beginning of the component array, the array element is placed at the next position of the initial position.
5. The method according to claim 1, characterized in that The level adjustment instruction includes: a level top instruction; and adjusting the position of the array element in the component array according to the level adjustment strategy specifically includes: Determine the initial position of the array element in the component array; When the initial position is not the end of the component array, the array element is placed at the end of the component array.
6. The method according to claim 1, characterized in that The level adjustment instruction includes: a level bottom instruction; and adjusting the position of the array element in the component array according to the level adjustment strategy specifically includes: Determine the initial position of the array element in the component array; When the initial position is not the beginning of the component array, the array element is placed at the beginning of the component array.
7. The method according to claim 1, characterized in that The level adjustment instruction includes: a deletion instruction; and, The adjusting the position of the array element in the component array according to the hierarchical adjustment strategy specifically includes: deleting the array element from the component array.
8. The method according to claim 1, characterized in that The level adjustment instruction includes: a copy instruction; and adjusting the position of the array element in the component array according to the level adjustment strategy specifically includes: Determine the initial position of the array element in the component array; The array element is copied and the component identification in the copied data is reset, and the obtained data is placed as a component element at a position above the initial position in the component array.
9. The method according to claim 1, characterized in that: The method further comprises: Receive a component adding instruction, and obtain component template data according to the component adding instruction; After resetting the component identifier in the component template data, placing it as a component element at the end of the component array; and, Rendering the canvas.
10. The method according to any one of claims 1 to 9, characterized in that: Each component in the canvas is a component in the HTML5 webpage editor, and its positioning method is absolute positioning.
11. A component-level adjustment device, characterized in that: include: An identification acquisition module is used to acquire the identification and level adjustment strategy of the component in the canvas targeted by the level adjustment instruction from the event triggered by the level adjustment instruction; wherein the level refers to the stacking level of the layer where the component is located; the component is bound in advance to the array element containing the identification of the component in the pre-stored component array; The level adjustment module is used to adjust the position of the array element in the component array according to the level adjustment strategy; after the adjustment is completed, the canvas is rendered according to the current position of the array element in the component array.
12. The device according to claim 11, characterized in that The device further comprises: The configuration module is used to keep the stacking order value z-index of each component in the canvas at a default value.
13. The device according to claim 11, characterized in that The level adjustment instruction includes: a level up instruction; and The level adjustment module is further used to: determine the initial position of the array element in the component array; and when the initial position is not the end of the component array, place the array element at the position above the initial position.
14. The device according to claim 11, characterized in that The level adjustment instructions include: level down movement instructions; and The level adjustment module is further used to: determine the initial position of the array element in the component array; and when the initial position is not the beginning of the component array, place the array element at the next position of the initial position.
15. The device according to claim 11, characterized in that The level adjustment instructions include: a level top instruction; and, The level adjustment module is further used to: determine the initial position of the array element in the component array; and when the initial position is not the end of the component array, place the array element at the end of the component array.
16. The device according to claim 11, characterized in that The level adjustment instruction includes: a level bottoming instruction; and, The level adjustment module is further used to: determine the initial position of the array element in the component array; and when the initial position is not the beginning of the component array, place the array element at the beginning of the component array.
17. The device according to claim 11, characterized in that The level adjustment instruction includes: a deletion instruction; and, The level adjustment module is further used to: delete the array element from the component array.
18. The device according to claim 11, characterized in that The level adjustment instruction includes: a copy instruction; and, The level adjustment module is further used to: determine the initial position of the array element in the component array; copy the array element and reset the component identifier in the copied data, and place the obtained data as a component element in the position above the initial position in the component array.
19. The device according to claim 11, characterized in that The device further comprises: The adding instruction processing module is used to receive a component adding instruction, obtain component template data according to the component adding instruction; after resetting the component identifier in the component template data, place it as a component element at the end of the component array; and render the canvas.
20. The device according to any one of claims 11 to 19, characterized in that: Each component in the canvas is a component in the HTML5 webpage editor, and its positioning method is absolute positioning.
21. An electronic device, characterized in that: include: one or more processors; a storage device 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 10.
22. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.
