Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The flow diagrams depicted in the figures are merely illustrative and do not necessarily include all of the elements and operations/steps, nor do they necessarily have to be performed in the order depicted. For example, some operations/steps may be decomposed, combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
The embodiment of the invention provides a page content rolling processing method and device, computer equipment and a computer readable storage medium. The page content rolling processing method can be applied to terminal equipment or a server, the terminal equipment can be electronic equipment such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant and wearable equipment, and the server can be a single server or a server cluster consisting of a plurality of servers. The following explains the page content scroll processing method applied to a server as an example.
Some embodiments of the invention are described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a schematic flow chart of a page content scrolling processing method according to an embodiment of the present invention.
As shown in fig. 1, the page content scrolling processing method specifically includes steps S11 to S16, and the order of the steps in the flowchart may be changed or some steps may be omitted according to different requirements.
S11, obtaining the descriptive text corresponding to the page needing to be rolled, and generating the tree structure corresponding to the descriptive text.
The method comprises the steps of obtaining a text of a page needing scrolling processing, such as a descriptive text (html text), and generating a tree structure corresponding to the descriptive text according to the descriptive text. The tree structure may include a Document Object Model (DOM). The tree structure can comprehensively express the structure of the descriptive text, and facilitates the operations of accessing, modifying, adding, deleting and the like of the descriptive text, thereby accelerating the processing efficiency of scrolling the page content.
In some embodiments, the generating the tree structure corresponding to the descriptive text includes:
analyzing the descriptive text to obtain a plurality of attributes and attribute tags corresponding to the attributes;
determining a label level corresponding to an attribute label corresponding to each attribute in a preset label system, and determining the importance of each attribute according to the level of the label level;
determining the node level of each attribute in the tree structure according to the importance;
and generating a tree structure corresponding to the descriptive text according to the node level corresponding to each attribute.
The attributes may include a TITLE class (TITLE), a text Class (CONTENT), a visual class (VISION), a BLOCK class (BLOCK), a hyperlink class (LINK), OTHER classes (OTHER), and the like, a label system is preset, the label system includes a plurality of attribute labels and label hierarchies corresponding to the attribute labels, such as a primary label, a secondary label, and the like, exemplarily, the importance degree corresponding to the attributes with the label hierarchy is also large, and the label system may be customized by a user. The higher the node hierarchy corresponding to the attribute with the higher importance. And generating a tree structure corresponding to the descriptive text according to the attribute tags corresponding to the attributes in the descriptive text, so that the tree structure can more accurately express the structure of the descriptive text.
And S12, traversing the tree structure layer by layer, and monitoring a plurality of attributes corresponding to the traversed layers in the tree structure.
Illustratively, the attribute values in the tree structure may be monitored by means of event (watch) monitoring, for example, the attribute values in the tree structure may be monitored by means of deep (deep) monitoring in event monitoring, that is, the tree structure is traversed hierarchically, and monitoring is added to each attribute in the tree structure, and the deep monitoring may monitor the tree structure comprehensively, so as to avoid missing information, thereby improving accuracy of digital scroll processing.
S13, in response to a change in the state of the target attribute being monitored, triggering a data processing function and comparing the new value of the target attribute with the old value.
Any attribute whose state changes is referred to as a target attribute. The states may include: the value of the attribute, the attribute tag of the attribute.
When monitoring that the attribute value in the tree structure changes, responding to the change of the attribute value, acquiring a new attribute value, namely a new value, and triggering a data processing function to compare the new value with an old value.
In some embodiments, the triggering a data processing function and comparing the new value of the target attribute to the old value comprises:
acquiring a new value of the target attribute and a first storage parameter of the new value;
acquiring an old value of the target attribute and a second storage parameter of the old value;
determining a first digit corresponding to the first storage parameter and determining a second digit corresponding to the second storage parameter;
triggering the data processing function to perform a comparison of the new value and the old value based on the first number of bits and the second number of bits.
For example, the number of bits of a value may be determined based on a stored parameter of the value. For example, the data processing function determines the number of bits of the new value according to the storage parameter of the new value, determines the number of bits of the old value according to the storage parameter of the old value, and compares the number of bits of the new value with the number of bits of the old value to obtain a comparison result.
Wherein, the result obtained by comparison comprises: the first number of bits is greater than the second number of bits, the first number of bits is equal to the first number of bits or the first number of bits is less than the second number of bits.
And S14, generating a target array according to the result obtained by comparison.
And processing the new value and the old value according to the result obtained by the comparison to obtain a target array, wherein the target array is used for rendering the descriptive text.
In some embodiments, the generating the target array according to the result of the comparison includes:
when the result obtained by comparison shows that the first digit is greater than the second digit, calculating the digit difference between the first digit and the second digit; performing bit complement processing on the old value according to the bit number difference; generating an old value array according to the old value after bit complementing processing;
when the result obtained by comparison shows that the first digit is smaller than the second digit, intercepting the old value according to the first digit; generating an old value array according to the intercepted old value;
carrying out data conversion on the new value to obtain a new value array;
and carrying out data splicing on the old value array and the new value array to obtain a target array.
For example, when it is determined that the new value has a greater number of bits than the old value according to the comparison result, that is, the first number of bits is greater than the second number of bits, a bit complementing operation is performed on the old value according to a bit number difference, for example, when the bit number difference is 1, a preset arabic number, such as 0, is added to the leftmost of the old value, and the old value array is obtained according to the old value after the bit complementing operation. For example, if the new value is 1000 and the old value is 100, then the bit-complemented old value is 0100, resulting in an array of [0, 1, 0, 0] old values.
For example, when it is determined that the new value has a bit number smaller than the old value according to the comparison result, that is, the first bit number is smaller than the second bit number, the old value is intercepted according to the bit number of the new value, for example, when the new value has a bit number of 3, the old value is intercepted by 3 bits from the rightmost side of the old value as the processed old value, and the old value array is obtained according to the processed old value. For example, if the new value is 100 and the old value is 1000, then the old value after the process is truncated to 000, resulting in an array of old values of [0, 0, 0 ].
For example, when the comparison result determines that the new value has a bit number equal to the old value, that is, the first bit number is equal to the second bit number, the old value is directly converted into an array form without processing the old value, and an old value array is generated.
Illustratively, the new value is converted to an array form, such as a new value of 1000, resulting in a new value array of [1, 0, 0, 0 ].
In this optional embodiment, the old value is processed according to the result obtained by the comparison to obtain an old value array; the old value is processed according to the result obtained by comparison, so that the new value and the old value are unified in format, the target array is obtained based on the generated old value array and the generated new value array, the error rate in rendering is reduced when the page to be rolled is rendered according to the target array, and the processing efficiency of digital rolling is improved.
For example, a value may be selected from the old value array and the new value array as a target array according to a preset selection rule.
By splicing the data in the old value array and the data in the new value array, data information can be effectively fused, so that the information content contained in the target array is more comprehensive, the rendering success rate is favorably improved, and the processing efficiency of digital scrolling is improved.
In some embodiments, after obtaining the target array according to the result of the comparison, the method further includes:
judging whether the target array is larger than a preset length threshold value or not;
and when the target array is larger than the preset length threshold, carrying out partition marking processing on the target array according to a preset sliding step length to obtain a partition marked target array.
For example, the preset length threshold is 3, the target array is [1, 0, 0, 0, 0, 0], the target array is greater than the preset length threshold, the target array is subjected to partition marking processing according to a preset sliding step length, the sliding step length may be the same as the preset length threshold and is 3, and certainly, the user-defined setting may also be performed according to the user's requirement. For example, a thousand-bit separator may be added to the target array as a partition marker for the target array.
By marking the target array exceeding the preset length threshold in a partitioning manner, the situation that the interrupted position information in the target array cannot be quickly found out when the rendering process is interrupted accidentally due to the overlong target array can be avoided.
And S15, triggering a page rendering function and rendering the descriptive text according to the target array to obtain a target page.
Illustratively, the render page function may include a render function.
In some embodiments, the triggering the render page function to render the descriptive text according to the target array to obtain a target page includes:
analyzing a cascading style sheet corresponding to the descriptive text to construct a cascading tree;
generating a rendering tree according to the tree structure corresponding to the laminated tree and the descriptive text;
and triggering a rendering page function to render the rendering tree according to the target array to obtain a target page.
Illustratively, the cascading style sheet includes a CSS, the cascading tree includes a CSS tree, when the CSS is obtained, a node (Token) in the CSS is read, and the CSS tree is constructed according to the node, where the CSS may be an ID or a class.
The descriptive text is rendered by constructing the rendering tree, so that the efficiency of traversing the descriptive text can be improved, and the rendering efficiency of the descriptive text is accelerated.
And S16, calling a loop to traverse the rendering style and displaying the target page in a rolling way.
Illustratively, the rendered descriptive text may be scroll-exposed using a loop traversal rendering style of SASS, such as using the for-loop syntax in SASS. The cycle traversal rendering style of the SASS can reduce the writing quantity of codes in the data scroll processing and accelerate the data scroll processing speed.
In an optional embodiment, the invoking of the loop traversal rendering style to scroll-display the target page includes:
judging whether the digit of the new value is larger than a preset digit threshold value;
when the digit of the new value is larger than the preset digit threshold value, the new value array corresponding to the new value is divided to obtain a plurality of new value sub-arrays;
calling a cyclic traversal rendering style to traverse each new value element in each new value sub-array;
determining content tag elements in the target page having the same number of bits as each of the new value subarrays;
splicing each content label element, and writing the spliced content label elements into the descriptive text;
and using a dom element example to perform scrolling display on the target page according to the descriptive text.
Illustratively, a bit number threshold corresponding to the bit number of a new value is preset, and when the bit number of the new value is greater than the preset bit number threshold, a new value array corresponding to the new value is segmented to obtain a plurality of new value sub-arrays; and the new value array is segmented according to the preset digit threshold value, so that the condition that rendering fails due to overlong new value array is avoided, and the rendering efficiency is improved. For example, the preset length threshold is 3, the new value is 10000, the number of bits is 5 greater than the preset length threshold 1, and the new value array corresponding to the new value is divided to obtain two new value sub-arrays [1, 0, 0], [0, 0 ].
And calling a loop traversal rendering style to traverse each new value element in each new value sub-array, such as the loop traversal rendering style of the SASS. And determining content tag elements with the same position as each new value element in the target page, splicing each determined content tag element, and writing the spliced content tag elements into a descriptive text corresponding to the target page. And using a dom element example to perform scrolling display on the target page according to the descriptive text. Dom element instances may be obtained using this $ refs.
It should be noted that, in order to ensure the privacy and security of the data in the page content scrolling process, such as the descriptive text, the tree structure, the attribute, the target array, and the like, may be stored in the block chain.
In the page content scrolling processing method provided in the above embodiment, by obtaining the descriptive text corresponding to the page to be scrolled, and generating the tree structure corresponding to the descriptive text, the tree structure can be used to comprehensively represent the structure of the descriptive text, thereby facilitating operations such as access, modification, addition, deletion and the like of the descriptive text, so as to increase the processing efficiency of scrolling the page content, then traversing the tree structure layer by layer, and monitoring a plurality of attributes corresponding to the traversed layer in the tree structure, and by monitoring the attribute values in the tree structure, the change of the attributes in the tree structure can be timely obtained, thereby increasing the data scrolling processing rate, in response to the change of the state of the monitored target attribute, triggering the data processing function, comparing the new value of the target attribute with the old value, and generating the target array according to the result obtained by comparison, and a more accurate target array can be obtained by comparing the new value with the old value, so that the rendering accuracy is improved, then a rendering page function is triggered to render the descriptive text according to the target array to obtain a target page, and finally a circular traversal rendering style is called to perform rolling display on the target page. The invention can improve the processing speed and accuracy of page content scrolling.
Referring to fig. 2, fig. 2 is a schematic block diagram of a page content scrolling processing device according to an embodiment of the present invention.
In some embodiments, the page content scroll processing apparatus 20 may include a plurality of functional modules formed by computer program segments, the computer program segments of the page content scroll processing apparatus 20 may be stored in a memory of the electronic device and executed by at least one processor to perform (see fig. 1 for details) the page content scroll processing function, and the page content scroll processing apparatus may be configured in a server or a terminal.
The server may be an independent server or a server cluster. The terminal can be an electronic device such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant and a wearable device.
In the present embodiment, the page content scroll processing device 20 may be divided into a plurality of functional modules according to the functions performed by the device. As shown in fig. 2, the functional module may include: the system comprises a page processing module 201, an attribute monitoring module 202, an attribute comparison module 203, an array generation module 204, a page rendering module 205 and a page presentation module 206. The module referred to herein is a series of computer program segments capable of being executed by at least one processor and capable of performing a fixed function and is stored in memory. In the present embodiment, the functions of the modules will be described in detail in the following embodiments.
The page processing module 201 is configured to obtain a descriptive text corresponding to a page to be scrolled, and generate a tree structure corresponding to the descriptive text.
The method comprises the steps of obtaining a text of a page needing scrolling processing, such as a descriptive text (html text), and generating a tree structure corresponding to the descriptive text according to the descriptive text. The tree structure may include a Document Object Model (DOM). The tree structure can comprehensively express the structure of the descriptive text, and facilitates the operations of accessing, modifying, adding, deleting and the like of the descriptive text, thereby accelerating the processing efficiency of scrolling the page content.
In some embodiments, the page processing module 201 generating the tree structure corresponding to the descriptive text includes:
analyzing the descriptive text to obtain a plurality of attributes and attribute tags corresponding to the attributes;
determining a label level corresponding to an attribute label corresponding to each attribute in a preset label system, and determining the importance of each attribute according to the level of the label level;
determining the node level of each attribute in the tree structure according to the importance;
and generating a tree structure corresponding to the descriptive text according to the node level corresponding to each attribute.
The attributes may include a TITLE class (TITLE), a text Class (CONTENT), a visual class (VISION), a BLOCK class (BLOCK), a hyperlink class (LINK), OTHER classes (OTHER), and the like, a label system is preset, the label system includes a plurality of attribute labels and label hierarchies corresponding to the attribute labels, such as a primary label, a secondary label, and the like, exemplarily, the importance degree corresponding to the attributes with the label hierarchy is also large, and the label system may be customized by a user. The higher the node hierarchy corresponding to the attribute with the higher importance. And generating a tree structure corresponding to the descriptive text according to the attribute tags corresponding to the attributes in the descriptive text, so that the tree structure can more accurately express the structure of the descriptive text.
The attribute monitoring module 202 is configured to traverse the tree structure layer by layer, and monitor a plurality of attributes corresponding to the traversed layer in the tree structure.
Illustratively, the attribute values in the tree structure may be monitored by means of event (watch) monitoring, for example, the attribute values in the tree structure may be monitored by means of deep (deep) monitoring in event monitoring, that is, the tree structure is traversed hierarchically, and monitoring is added to each attribute in the tree structure, and the deep monitoring may monitor the tree structure comprehensively, so as to avoid missing information, thereby improving accuracy of digital scroll processing.
And the attribute comparison module 203 is used for responding to the monitored state change of the target attribute, triggering a data processing function and comparing the new value of the target attribute with the old value.
Any attribute whose state changes is referred to as a target attribute. The states may include: the value of the attribute, the attribute tag of the attribute.
When monitoring that the attribute value in the tree structure changes, responding to the change of the attribute value, acquiring a new attribute value, namely a new value, and triggering a data processing function to compare the new value with an old value.
In some embodiments, the attribute comparison module 203 triggers a data processing function and comparing the new value of the target attribute to the old value comprises:
acquiring a new value of the target attribute and a first storage parameter of the new value;
acquiring an old value of the target attribute and a second storage parameter of the old value;
determining a first digit corresponding to the first storage parameter and determining a second digit corresponding to the second storage parameter;
triggering the data processing function to perform a comparison of the new value and the old value based on the first number of bits and the second number of bits.
For example, the number of bits of a value may be determined based on a stored parameter of the value. For example, the data processing function determines the number of bits of the new value according to the storage parameter of the new value, determines the number of bits of the old value according to the storage parameter of the old value, and compares the number of bits of the new value with the number of bits of the old value to obtain a comparison result.
Wherein, the result obtained by comparison comprises: the first number of bits is greater than the second number of bits, the first number of bits is equal to the first number of bits or the first number of bits is less than the second number of bits.
And an array generating module 204, configured to generate a target array according to the result obtained by the comparison.
And processing the new value and the old value according to the result obtained by the comparison to obtain a target array, wherein the target array is used for rendering the descriptive text.
In some embodiments, the generating the target array by the array generating module 204 according to the comparison result includes:
when the result obtained by comparison shows that the first digit is greater than the second digit, calculating the digit difference between the first digit and the second digit; performing bit complement processing on the old value according to the bit number difference; generating an old value array according to the old value after bit complementing processing;
when the result obtained by comparison shows that the first digit is smaller than the second digit, intercepting the old value according to the first digit; generating an old value array according to the intercepted old value;
carrying out data conversion on the new value to obtain a new value array;
and carrying out data splicing on the old value array and the new value array to obtain a target array.
For example, when it is determined that the new value has a greater number of bits than the old value according to the comparison result, that is, the first number of bits is greater than the second number of bits, a bit complementing operation is performed on the old value according to a bit number difference, for example, when the bit number difference is 1, a preset arabic number, such as 0, is added to the leftmost of the old value, and the old value array is obtained according to the old value after the bit complementing operation. For example, if the new value is 1000 and the old value is 100, then the bit-complemented old value is 0100, resulting in an array of [0, 1, 0, 0] old values.
For example, when it is determined that the new value has a bit number smaller than the old value according to the comparison result, that is, the first bit number is smaller than the second bit number, the old value is intercepted according to the bit number of the new value, for example, when the new value has a bit number of 3, the old value is intercepted by 3 bits from the rightmost side of the old value as the processed old value, and the old value array is obtained according to the processed old value. For example, if the new value is 100 and the old value is 1000, then the old value after the process is truncated to 000, resulting in an array of old values of [0, 0, 0 ].
For example, when the comparison result determines that the new value has a bit number equal to the old value, that is, the first bit number is equal to the second bit number, the old value is directly converted into an array form without processing the old value, and an old value array is generated.
Illustratively, the new value is converted to an array form, such as a new value of 1000, resulting in a new value array of [1, 0, 0, 0 ]. In this optional embodiment, the old value is processed according to the result obtained by the comparison to obtain an old value array; the old value is processed according to the result obtained by comparison, so that the new value and the old value are unified in format, the target array is obtained based on the generated old value array and the generated new value array, the error rate in rendering is reduced when the page to be rolled is rendered according to the target array, and the processing efficiency of digital rolling is improved.
For example, a value may be selected from the old value array and the new value array as a target array according to a preset selection rule.
By splicing the data in the old value array and the data in the new value array, data information can be effectively fused, so that the information content contained in the target array is more comprehensive, the rendering success rate is favorably improved, and the processing efficiency of digital scrolling is improved.
In some embodiments, after the array generating module 204 obtains the target array according to the result of the comparison, the array generating module 204 is further configured to:
judging whether the target array is larger than a preset length threshold value or not;
and when the target array is larger than the preset length threshold, carrying out partition marking processing on the target array according to a preset sliding step length to obtain a partition marked target array.
For example, the preset length threshold is 3, the target array is [1, 0, 0, 0, 0, 0], the target array is greater than the preset length threshold, the target array is subjected to partition marking processing according to a preset sliding step length, the sliding step length may be the same as the preset length threshold and is 3, and certainly, the user-defined setting may also be performed according to the user's requirement. For example, a thousand-bit separator may be added to the target array as a partition marker for the target array.
By marking the target array exceeding the preset length threshold in a partitioning manner, the situation that the interrupted position information in the target array cannot be quickly found out when the rendering process is interrupted accidentally due to the overlong target array can be avoided.
And the text rendering module 205 is configured to trigger a render page function and render the descriptive text according to the target array to obtain a target page.
Illustratively, the render page function may include a render function.
In some embodiments, the triggering, by the text rendering module 205, a render page function to render the descriptive text according to the target array to obtain a target page includes:
analyzing a cascading style sheet corresponding to the descriptive text to construct a cascading tree;
generating a rendering tree according to the tree structure corresponding to the laminated tree and the descriptive text;
and triggering a rendering page function to render the rendering tree according to the target array to obtain a target page.
Illustratively, the cascading style sheet includes a CSS, the cascading tree includes a CSS tree, when the CSS is obtained, a node (Token) in the CSS is read, and the CSS tree is constructed according to the node, where the CSS may be an ID or a class.
The descriptive text is rendered by constructing the rendering tree, so that the efficiency of traversing the descriptive text can be improved, and the rendering efficiency of the descriptive text is accelerated.
And the page display module 206 is used for calling a loop traversal rendering style and performing scroll display on the target page. Illustratively, the rendered descriptive text may be scroll-exposed using a loop traversal rendering style of SASS, such as using the for-loop syntax in SASS. The cycle traversal rendering style of the SASS can reduce the writing quantity of codes in the data scroll processing and accelerate the data scroll processing speed.
In an alternative embodiment, the page presentation module 206 invoking a loop traversal rendering style to scroll-present the target page includes:
judging whether the digit of the new value is larger than a preset digit threshold value;
when the digit of the new value is larger than the preset digit threshold value, the new value array corresponding to the new value is divided to obtain a plurality of new value sub-arrays;
calling a cyclic traversal rendering style to traverse each new value element in each new value sub-array;
determining content tag elements in the target page having the same number of bits as each of the new value subarrays;
splicing each content label element, and writing the spliced content label elements into the descriptive text;
and using a dom element example to perform scrolling display on the target page according to the descriptive text.
Illustratively, a bit number threshold corresponding to the bit number of a new value is preset, and when the bit number of the new value is greater than the preset bit number threshold, a new value array corresponding to the new value is segmented to obtain a plurality of new value sub-arrays; and the new value array is segmented according to the preset digit threshold value, so that the condition that rendering fails due to overlong new value array is avoided, and the rendering efficiency is improved. For example, the preset length threshold is 3, the new value is 10000, the number of bits is 5 greater than the preset length threshold 1, and the new value array corresponding to the new value is divided to obtain two new value sub-arrays [1, 0, 0], [0, 0 ].
And calling a loop traversal rendering style to traverse each new value element in each new value sub-array, such as the loop traversal rendering style of the SASS. And determining content tag elements with the same position as each new value element in the target page, splicing each determined content tag element, and writing the spliced content tag elements into a descriptive text corresponding to the target page. And using a dom element example to perform scrolling display on the target page according to the descriptive text. Dom element instances may be obtained using this $ refs.
It should be noted that, in order to ensure the privacy and security of the data in the page content scrolling process, such as the descriptive text, the tree structure, the attribute, the target array, and the like, may be stored in the block chain.
The page content scroll processing apparatus provided by the above embodiment may be implemented in the form of a computer program, and the computer program may be run on a computer device as shown in fig. 3.
Referring to fig. 3, fig. 3 is a schematic block diagram of a computer device according to an embodiment of the present invention. The computer device may be a server or a terminal device.
As shown in fig. 3, the computer device 30 includes a processor 301 and a memory 302 connected by a system bus, wherein the memory 302 may include a nonvolatile storage medium and a volatile storage medium.
The memory 302 may store an operating system and computer programs. The computer program comprises computer readable instructions which, when executed, cause the processor 301 to perform the page content scroll processing method.
The processor 301 is used to provide computing and control capabilities, supporting the operation of the overall computer device.
In a possible embodiment, the computer device further comprises a network interface for performing network communication, such as sending assigned tasks, etc. Those skilled in the art will appreciate that the configuration shown in fig. 3 is a block diagram of only a portion of the configuration associated with aspects of the present invention and is not intended to limit the computing devices to which aspects of the present invention may be applied, and that a particular computing device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
It should be understood that Processor 301 is a Central Processing Unit (CPU), and may be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Wherein, in one embodiment, the processor executes a computer program stored in the memory to implement the steps of:
acquiring a descriptive text corresponding to a page needing to be rolled, and generating a tree structure corresponding to the descriptive text;
traversing the tree structure layer by layer, and monitoring a plurality of attributes corresponding to the traversed layers in the tree structure;
in response to a monitored change in the state of a target attribute, triggering a data processing function and comparing a new value of the target attribute with an old value;
generating a target array according to the result obtained by comparison;
triggering a rendering page function and rendering the descriptive text according to the target array to obtain a target page;
and calling a loop traversal rendering style and performing rolling display on the target page.
Specifically, the processor may refer to the description of the relevant steps in the foregoing embodiment of the page content scrolling processing method, which is not described herein again.
Embodiments of the present invention further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, where the computer program includes computer-readable instructions, and when the computer instructions are executed, a method implemented by the computer program may refer to the embodiments of the page content scrolling processing method in the present invention.
The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, for example, a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device.
Further, the computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The page content scrolling processing apparatus, the computer device, and the computer-readable storage medium provided in the foregoing embodiments can accelerate the processing efficiency of scrolling the page content by acquiring the descriptive text corresponding to the page to be scrolled and generating the tree structure corresponding to the descriptive text, so that the structure of the descriptive text can be comprehensively represented by using the tree structure, and operations such as accessing, modifying, adding, and deleting the descriptive text are facilitated, and then the tree structure is traversed layer by layer, and a plurality of attributes corresponding to the traversed layer in the tree structure are monitored, and the change of the attribute in the tree structure can be timely acquired by monitoring the attribute value in the tree structure, so that the rate of data scrolling is accelerated, in response to the monitored state change of the target attribute, a data processing function is triggered and the new value of the target attribute is compared with the old value, and generating a target array according to a result obtained by comparison, obtaining a more accurate target array by comparing a new value with an old value so as to improve the rendering accuracy, then triggering a rendering page function to render the descriptive text according to the target array to obtain a target page, and finally calling a circular traversal rendering style to perform rolling display on the target page. The invention can improve the processing speed and accuracy of page content scrolling.
It is to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items. It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments. While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.