Page sliding method and device
By listening to horizontal sliding events and vertical sliding events in the hybrid development mode, determining the sliding area of the nested page and passing the horizontal sliding events, the problem that nested pages cannot slide horizontally is solved, and a wider application scenario is achieved.
Patent Information
- Application Number
- CN202411442906.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-02-18
AI Technical Summary
In the existing hybrid development model, the page will have sliding conflicts when users browse, resulting in nested pages being unable to slide horizontally, limiting the application of web page views in hybrid development.
By listening to the horizontal sliding event and the vertical sliding event of the target page, based on the sliding data of the vertical sliding event, determine the sliding area of the nested page in the target page, and determine whether the position of the horizontal sliding event is within the sliding area. If so, Pass the event to the nested page so it slides horizontally.
It effectively resolves the sliding conflict in the hybrid development model, realizes horizontal sliding of nested pages, and meets more business needs and usage scenarios.
Smart Images

Figure CN119473281A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a page sliding method and device. Background Art
[0002] In page development, for simple single-page requirements, web views (a visual component), such as WebView, are usually used for development. As business scenarios become more complex, this hybrid development model of nesting web views in the system's native development components is becoming increasingly popular.
[0003] In the process of implementing the present invention, the inventors found that the prior art has the following problems:
[0004] The pages generated by the existing hybrid development model will have sliding conflicts when users browse, and the nested pages generated by the web page view in the page cannot be slid horizontally, which limits the application of the web page view in hybrid development. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a page sliding method and device, which realizes the horizontal sliding of nested pages. By judging the horizontal sliding position corresponding to the monitored horizontal sliding event, it is determined whether the horizontal sliding event belongs to the nested page, and the horizontal sliding event belonging to the nested page is passed to the corresponding nested page, which effectively solves the sliding conflict in the hybrid development mode and meets more business needs and usage scenarios.
[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a page sliding method is provided, comprising:
[0007] In response to monitoring a horizontal sliding event and a vertical sliding event of a target page, determining a sliding area of a nested page in the target page according to sliding data corresponding to the vertical sliding event; wherein the nested page is nested in the target page;
[0008] It is determined whether the horizontal sliding position corresponding to the horizontal sliding event is within the sliding area. When the determination result is within the sliding area, the horizontal sliding event is passed to the nested page so that the nested page slides horizontally according to the horizontal sliding event.
[0009] Optionally, determining a sliding area of the nested page in the target page according to the sliding data corresponding to the longitudinal sliding event includes: obtaining an initial sliding area of the nested page in the target page, the initial sliding area being determined by the nested page when the loading of the target page is completed; obtaining a corresponding sliding distance from a listening code that listens to the longitudinal sliding event, the listening code triggering calculation of the sliding distance of the target page when detecting that the target page has longitudinally slid; and calculating the sliding area of the nested page in the target page according to the initial sliding area and the sliding distance.
[0010] Optionally, when the vertical sliding event is empty, determining the sliding area of the nested page in the target page according to the sliding data corresponding to the vertical sliding event includes: using the initial sliding area as the sliding area of the nested page in the target page.
[0011] Optionally, the target page includes a nested page and a native page. When the judgment result is that the target page is not within the sliding area, the method further includes: intercepting the horizontal sliding event, and performing horizontal sliding of the native page according to the horizontal sliding event.
[0012] Optionally, whether the horizontal sliding position corresponding to the horizontal sliding event is within the sliding area is determined, and when the determination result is that the horizontal sliding event is within the sliding area, the horizontal sliding event is passed to the nested page, including: writing a sliding interception code in a native page in the target page, obtaining the horizontal sliding position corresponding to the horizontal sliding event through the sliding interception code, and determining whether the horizontal sliding position is within the sliding area, and when the determination result is that the horizontal sliding event is within the sliding area, the horizontal sliding event is passed to the nested page.
[0013] Optionally, after determining the sliding area of the nested page in the target page, the method further includes: verifying the sliding area according to the distribution position of the nested page in the target page and the distribution rule of the sub-pages supporting horizontal sliding in the nested page.
[0014] Optionally, after passing the horizontal sliding event to the nested page, the method further includes: monitoring whether the nested page receives the horizontal sliding event, and if the nested page does not receive the horizontal sliding event, passing the horizontal sliding event to the nested page again through a preset retry mechanism.
[0015] According to a second aspect of an embodiment of the present invention, a page sliding device is provided, comprising:
[0016] A sliding area determination module, configured to respond to monitoring a horizontal sliding event and a vertical sliding event of a target page, and determine a sliding area of a nested page in the target page according to sliding data corresponding to the vertical sliding event; wherein the nested page is nested in the target page;
[0017] The page sliding module is used to determine whether the horizontal sliding position corresponding to the horizontal sliding event is within the sliding area. When the judgment result is that the horizontal sliding position is within the sliding area, the horizontal sliding event is passed to the nested page so that the nested page slides horizontally according to the horizontal sliding event.
[0018] According to a third aspect of an embodiment of the present invention, there is provided an electronic device for page sliding, comprising:
[0019] one or more processors;
[0020] a storage device for storing one or more programs,
[0021] When the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the first aspect of the embodiment of the present invention.
[0022] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method provided by the first aspect of the embodiment of the present invention is implemented.
[0023] An embodiment of the invention has the following advantages or beneficial effects: by responding to the monitored horizontal sliding event and the vertical sliding event of the target page, according to the sliding data corresponding to the vertical sliding event, determining the sliding area of the nested page in the target page; wherein the nested page is nested in the target page; judging whether the horizontal sliding position corresponding to the horizontal sliding event is within the sliding area, when the judgment result is within the sliding area, passing the horizontal sliding event to the nested page, so that the nested page slides horizontally according to the technical solution of the horizontal sliding event, realizing a method for supporting horizontal sliding of nested pages, determining whether the horizontal sliding event belongs to the nested page by judging the horizontal sliding position corresponding to the monitored horizontal sliding event, and passing the horizontal sliding event belonging to the nested page to the corresponding nested page, effectively solving the sliding conflict in the hybrid development mode and meeting more business needs and usage scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings are used to better understand the present invention and shall not constitute improper limitations of the present invention.
[0025] Figure 1 is a schematic diagram of the main process of the page sliding method according to an embodiment of the present invention;
[0026] Figure 2 is a schematic diagram of determining a sliding area according to an embodiment of the present invention;
[0027] Figure 3 is a schematic diagram of judging a horizontal sliding event according to an embodiment of the present invention;
[0028] Figure 4 This is a complete schematic diagram of the principle of page sliding in an embodiment of the present invention;
[0029] Figure 5 It is a complete flow chart of the page sliding method according to an embodiment of the present invention;
[0030] Figure 6 is a schematic diagram of main modules of a page sliding device according to an embodiment of the present invention;
[0031] Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0032] Figure 8 It is a schematic diagram of the structure of a computer system of a terminal device suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0033] It should be noted that the acquisition, storage and application of user personal information involved in the technical solution of the present disclosure are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0034] 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.
[0035] The pages generated by the existing hybrid development model will have sliding conflicts when users browse, and the nested pages generated by the web page view in the page cannot be slid horizontally, which limits the application of the web page view in hybrid development and cannot meet the actual application well.
[0036] In order to solve the above problems existing in the prior art, the present invention proposes a page sliding method. Based on the determined sliding area of the nested page in the target page, when the horizontal sliding position corresponding to the monitored horizontal sliding event is located in the sliding area, the monitored horizontal sliding event is passed to the nested page to make the nested page slide horizontally. A method for supporting horizontal sliding of nested pages is implemented. By judging the horizontal sliding position corresponding to the monitored horizontal sliding event, it is determined whether the horizontal sliding event belongs to the nested page, and the horizontal sliding event belonging to the nested page is passed to the corresponding nested page, which effectively solves the sliding conflict in the hybrid development mode and meets more business needs and usage scenarios.
[0037] In the introduction to the embodiments of the present invention, the terms and their meanings are as follows:
[0038] WebView: refers to web view, which is a component used to display web content in applications. It can be embedded in mobile terminals to achieve hybrid development of the front end. Most hybrid development frameworks are based on the WebView mode for secondary development.
[0039] Figure 1 is a schematic diagram of the main process of the page sliding method according to an embodiment of the present invention. Figure 1 As shown, the page sliding method of the embodiment of the present invention includes the following steps S101 to S102.
[0040] Step S101, in response to monitoring a horizontal sliding event and a vertical sliding event of a target page, determining a sliding area of a nested page in the target page according to sliding data corresponding to the vertical sliding event; wherein the nested page is nested in the target page.
[0041] Specifically, in the existing hybrid development mode of nesting a web page view in a native development component of a system, since the native development component will consume the event itself after listening to the horizontal sliding event, the nested page with horizontal sliding requirements cannot slide horizontally. The nested page mentioned in the embodiment of the present invention is a page constructed by a web page view (such as a WebView component) nested in a native development component. For a nested page with horizontal sliding requirements, usually not all content in the nested page needs to slide horizontally, and the nested page exists in the target page constructed by hybrid development, so it is necessary to determine the sliding area that supports horizontal sliding of the nested page in the target page. In addition, considering that when a user browses a page, usually the page will slide up and down vertically, and this operation will directly affect the range of the sliding area, so the embodiment of the present invention also includes the vertical sliding event of the target page in the monitoring content. The horizontal sliding event and the vertical sliding event of the target page are monitored, and when the horizontal sliding event and the vertical sliding event of the target page are monitored, the sliding data corresponding to the vertical sliding event is added to the calculation of the sliding area to obtain the current sliding area.
[0042] According to one embodiment of the present invention, the sliding area of the nested page in the target page is determined according to the sliding data corresponding to the vertical sliding event, including: obtaining the initial sliding area of the nested page in the target page, the initial sliding area is determined by the nested page when the loading of the target page is completed; obtaining the corresponding sliding distance from the listening code that listens to the vertical sliding event, the listening code triggers the calculation of the sliding distance of the target page when the vertical sliding of the target page is detected; and calculating the sliding area of the nested page in the target page according to the initial sliding area and the sliding distance.
[0043] Specifically, in the process of hybrid development of the target page by nesting the web page view in the system native development component, the embodiment of the present invention specifically takes the WebView component as an example. When WebView completes the loading of the target page, it passes the coordinate data of all areas supporting horizontal sliding in the nested page constructed by it to the native development component, and the native development component obtains the initial sliding area of the nested page in the target page. It can be understood that the coordinate data of the area is usually composed of the coordinates of each component point. In the page construction scenario of the embodiment of the present invention, since the area is generally rectangular, it can be represented by the coordinates of the upper left corner and the coordinates of the lower right corner. Of course, there may be multiple areas supporting horizontal sliding in the nested page, and there will be multiple initial sliding areas correspondingly, forming an initial sliding area list. The embodiment of the present invention mainly takes one initial sliding area as an example. Multiple initial sliding areas are equivalent to the subsequent judgment of whether the horizontal sliding position corresponding to the horizontal sliding event is within each sliding area.
[0044] Furthermore, the embodiment of the present invention pre-adds a monitoring code for monitoring vertical sliding events in the native development component. Through the monitoring code, when the target page slides vertically, that is, when the content in the target page shifts vertically, the logic of sliding distance calculation inside the monitoring code is triggered, and the translation distance of the content in the target page is counted. For example, if it shifts by 10 pixels, the counted translation distance is returned to the native development component as the calculated sliding distance.
[0045] Finally, the sliding distance is counted into the initial sliding area. Since the sliding distance is the vertical distance data, the sliding distance is added to the vertical coordinates of the coordinates of each component point in the initial sliding area. For example, the coordinates of the initial sliding area are: upper left coordinates (x1, y1), lower right coordinates (x2, y2), and the sliding distance is sliding upward Y, then the sliding area of the current nested page in the target page is (x1, y1+Y), (x2, y2+Y). It can be understood that if it is sliding downward Y, then the sliding area of the current nested page in the target page is (x1, y1-Y), (x2, y2-Y).
[0046] Figure 2 It is a schematic diagram of determining the sliding area of an embodiment of the present invention. It is assumed that the initial sliding area of the nested page in the target page has been obtained, as demarcated by the dotted line in the figure. Since the initial sliding area is a regular rectangle, the coordinates of the upper left corner (x1, y1) and the coordinates of the lower right corner (x2, y2) are used to mark the initial sliding area. The monitoring code in the native development component monitors the vertical sliding event of the target page in real time, and finds that when the horizontal sliding event is monitored, the vertical sliding event of the target page has generated an upward sliding distance of scrollY, which is equivalent to the initial sliding area of the nested page being translated upward by scrollY. Accordingly, the coordinates of the sliding area of the current nested page in the target page are transformed from (x1, y1), (x2, y2) to (x1, y1+scrollY), (x2, y2+scrollY).
[0047] According to another embodiment of the present invention, when the vertical sliding event is empty, the sliding area of the nested page in the target page is determined according to the sliding data corresponding to the vertical sliding event, including: using the initial sliding area as the sliding area of the nested page in the target page.
[0048] Specifically, taking into account the comprehensive coverage of the embodiments of the present invention, there may be individual business scenarios where the user opens the target page and initiates a horizontal sliding event without performing an overall vertical browsing. In this case, the monitored vertical sliding event is empty, that is, the initial sliding area of the nested page in the target page does not undergo vertical displacement. At this time, the initial sliding area can be used as the sliding area of the nested page in the target page.
[0049] Step S102, determining whether the horizontal sliding position corresponding to the horizontal sliding event is within the sliding area, and when the determination result is within the sliding area, passing the horizontal sliding event to the nested page, so that the nested page slides horizontally according to the horizontal sliding event.
[0050] Specifically, based on the above-determined sliding area of the nested page in the target page, it is determined whether the horizontal sliding position corresponding to the currently monitored horizontal sliding event is within the sliding area. The horizontal sliding position of the embodiment of the present invention can be the position point of the touch point in the touch screen in the target page, or it can be the position point of the cursor of an operating device such as a mouse in the target page. The embodiment of the present invention does not make specific limitations. By determining whether the horizontal sliding position is within the sliding area of the nested page, it is determined whether the horizontal sliding event belongs to the nested page. When the judgment result is within the sliding area, it is determined that the monitored horizontal sliding event is a horizontal sliding of the nested page, so the horizontal sliding event is transparently transmitted to the nested page, so that the nested page receives the horizontal sliding event and slides horizontally according to the sliding requirements in the horizontal sliding event.
[0051] According to an embodiment of the present invention, the target page includes a nested page and a native page. When the judgment result is that the target page is not within the sliding area, the method further includes: intercepting the horizontal sliding event, and performing horizontal sliding of the native page according to the horizontal sliding event.
[0052] Specifically, the target page is mainly constructed by nesting the web view WebView component in the native development component. Accordingly, the target page includes the nested page constructed by the web view WebView component and the native page constructed by the native development component. If the above judgment result is that the horizontal sliding position is not within the sliding area of the nested page, then the horizontal sliding event belongs to the native page. At this time, the native page intercepts the horizontal sliding event, and the native page consumes the horizontal sliding event itself, and performs horizontal sliding of the native page according to the sliding requirements of the horizontal sliding event.
[0053] Figure 3This is a schematic diagram of judging a horizontal sliding event in an embodiment of the present invention. If the horizontal sliding position corresponding to the horizontal sliding event is within the sliding area of the nested page, it is determined that the horizontal sliding event belongs to the nested page, and the native development component transparently transmits the horizontal sliding event to the nested page to make the nested page slide horizontally; if the horizontal sliding position corresponding to the horizontal sliding event is not within the sliding area of the nested page, the horizontal sliding event belongs to the native page, the horizontal sliding event is intercepted, and the native page slides horizontally.
[0054] According to another embodiment of the present invention, whether the horizontal sliding position corresponding to the horizontal sliding event is within the sliding area is determined, and when the determination result is within the sliding area, the horizontal sliding event is passed to the nested page, including: writing a sliding interception code in a native page in the target page, obtaining the horizontal sliding position corresponding to the horizontal sliding event through the sliding interception code, and determining whether the horizontal sliding position is within the sliding area, and when the determination result is within the sliding area, the horizontal sliding event is passed to the nested page.
[0055] Specifically, the embodiment of the present invention adds a sliding interception code to the native page of the target page, and integrates the acquisition of the horizontal sliding position, the judgment of the horizontal sliding position and the transmission of the horizontal sliding event in the sliding interception code. The sliding interception code in the native page obtains the horizontal sliding position corresponding to the monitored horizontal sliding event, and based on the sliding area determined above, it is judged according to the judgment logic whether the horizontal sliding position is within the sliding area. If it is within the sliding area, the horizontal sliding event is transparently transmitted to the nested page. If it is not within the sliding area, the horizontal sliding event is intercepted and the native page is slid horizontally.
[0056] According to another embodiment of the present invention, after determining the sliding area of the nested page in the target page, the method further includes: verifying the sliding area according to the distribution position of the nested page in the target page and the distribution rule of the sub-pages supporting horizontal sliding in the nested page.
[0057] Specifically, considering that the accuracy of the sliding area of the nested page plays an important role in the page sliding of this case, in order to ensure accuracy, after determining the sliding area of the nested page in the target page, the distribution position information of the nested page and the distribution rules of the sub-pages that can slide horizontally in the nested page are obtained from the construction record of the target page. For example, the picture of floor 1 in the nested page supports horizontal sliding. Then, according to the distribution rule and the distribution position of the nested page in the target page, the reasonable distribution range of the sliding area can be estimated. If the sliding area determined above does not deviate from the distribution range, the verification passes. If it deviates from the distribution range, the verification fails, and the verification details are reported to the background so that relevant personnel can check the abnormality. It can be understood that there can be multiple sub-pages that slide horizontally in the nested page, and each sub-page corresponds to a sliding area. Then, according to the sub-page corresponding to the currently determined sliding area, the reasonable distribution range of the sliding area of the sub-page is estimated, and then the sliding area of the sub-page is verified.
[0058] According to another embodiment of the present invention, after passing the horizontal sliding event to the nested page, the method further includes: monitoring whether the nested page receives the horizontal sliding event, and if the nested page does not receive the horizontal sliding event, passing the horizontal sliding event to the nested page again through a preset retry mechanism.
[0059] Specifically, in order to further improve the reliability of page sliding, the present invention adds a retry mechanism in the transmission of horizontal sliding events. After the horizontal sliding event is passed to the nested page, the code that executes the retry mechanism in the native page listens to the response signal returned by the nested page. If no response signal is received within the specified time, it is determined that the transmission has failed. At this time, the retry mechanism is started, and according to the preset number of retries and waiting time, the horizontal sliding event is attempted to be passed to the nested page again. As long as the transmission is successful within the number of retries and waiting time, it will be successful.
[0060] Figure 4It is a complete schematic diagram of the principle of page sliding in an embodiment of the present invention. For a target page constructed in a hybrid development mode in which a WebView component is nested in a native development component of a system, the native page obtains the initial sliding area of the nested page in the target page. When the nested page has multiple sub-pages that support horizontal sliding, the initial sliding area list of the nested page is obtained, and the vertical sliding event of the target page is monitored to obtain the vertical sliding distance corresponding to the vertical sliding event; according to the initial sliding area list and the sliding distance, the current sliding area list in the nested page is calculated. When a horizontal sliding event triggered by a user is monitored, the native page uses its internal sliding interception code to call each sliding area in the currently calculated sliding area list. For each sliding area, it is determined whether the horizontal sliding position corresponding to the horizontal sliding event is in the sliding area. If it is in a certain sliding area, the horizontal sliding event is passed to the nested page, and the nested page slides horizontally according to the horizontal sliding event; if it is not in the sliding area, the horizontal sliding event is intercepted, and according to the horizontal sliding event, the native page consumes the horizontal sliding event itself to slide the native page horizontally.
[0061] Figure 5 It is a complete flow diagram of the page sliding method of an embodiment of the present invention. The monitoring code in the native development component monitors the vertical sliding event of the target page in real time, and when the vertical sliding event is monitored, the vertical sliding distance is counted, and then the sliding area of the nested page is calculated in real time in combination with the initial sliding area of the nested page, so as to provide a sliding area calculated in real time when the horizontal sliding event is monitored. When the native development component monitors the horizontal sliding event, the sliding area of the nested page calculated in real time is retrieved, and the horizontal sliding position corresponding to the horizontal sliding event is obtained. It is judged whether the horizontal sliding position is within the sliding area. If it is within the sliding area, the monitored horizontal sliding event is transparently transmitted to the nested page, and the WebView component corresponding to the nested page parses the received horizontal sliding event, determines the range and sliding parameters of the horizontal sliding, and executes the horizontal sliding of the nested page. If it is not within the sliding area, it means that the horizontal sliding event monitored this time does not belong to the nested page, but to the native page. At this time, the native page intercepts the horizontal sliding event, and the native development component corresponding to the native page parses the horizontal sliding event, and slides the native page horizontally according to the range and sliding parameters of the horizontal sliding determined by the analysis.
[0062] The embodiment of the present invention is based on the determined sliding area of the nested page in the target page. When the horizontal sliding position corresponding to the monitored horizontal sliding event is located in the sliding area, the monitored horizontal sliding event is passed to the nested page to make the nested page slide horizontally. A method for supporting horizontal sliding of nested pages is implemented. By judging the horizontal sliding position corresponding to the monitored horizontal sliding event, it is determined whether the horizontal sliding event belongs to the nested page, and the horizontal sliding event belonging to the nested page is passed to the corresponding nested page, which effectively solves the sliding conflict in the hybrid development mode and meets more business needs and usage scenarios.
[0063] Figure 6 Schematic diagram of the main modules of the page sliding device according to an embodiment of the present invention. Figure 6 As shown, the page sliding device 600 mainly includes a sliding area determination module 601 and a page sliding module 602 .
[0064] The sliding area determination module 601 is used to determine the sliding area of the nested page in the target page according to the sliding data corresponding to the vertical sliding event in response to monitoring the horizontal sliding event and the vertical sliding event of the target page; wherein the nested page is nested in the target page;
[0065] The page sliding module 602 is used to determine whether the horizontal sliding position corresponding to the horizontal sliding event is within the sliding area. When the judgment result is within the sliding area, the horizontal sliding event is passed to the nested page so that the nested page slides horizontally according to the horizontal sliding event.
[0066] According to one embodiment of the present invention, the sliding area determination module 601 is further used to: obtain an initial sliding area of the nested page in the target page, the initial sliding area is determined by the nested page when the loading of the target page is completed; obtain a corresponding sliding distance from a listening code that listens to the longitudinal sliding event, the listening code triggers the calculation of the sliding distance of the target page when the longitudinal sliding of the target page is detected; and calculate the sliding area of the nested page in the target page based on the initial sliding area and the sliding distance.
[0067] According to another embodiment of the present invention, when the vertical sliding event is empty, the sliding area determining module 601 is further configured to: use the initial sliding area as the sliding area of the nested page in the target page.
[0068] According to another embodiment of the present invention, the target page includes a nested page and a native page. When the judgment result is that the target page is not within the sliding area, the page sliding device 600 also includes a native page sliding module (not shown in the figure), which is used to: intercept the horizontal sliding event, and perform horizontal sliding of the native page according to the horizontal sliding event.
[0069] According to another embodiment of the present invention, the page sliding module 602 is also used to: write a sliding interception code in the native page in the target page, obtain the horizontal sliding position corresponding to the horizontal sliding event through the sliding interception code, and determine whether the horizontal sliding position is within the sliding area; when the judgment result is within the sliding area, pass the horizontal sliding event to the nested page.
[0070] According to another embodiment of the present invention, the page sliding device 600 also includes a verification module (not shown in the figure), which is used to: after determining the sliding area of the nested page in the target page, verify the sliding area according to the distribution position of the nested page in the target page and the distribution rules of the sub-pages supporting horizontal sliding in the nested page.
[0071] According to another embodiment of the present invention, the page sliding device 600 also includes a retry module (not shown in the figure), which is used to: after passing the horizontal sliding event to the nested page, monitor whether the nested page receives the horizontal sliding event, and if the nested page does not receive the horizontal sliding event, pass the horizontal sliding event to the nested page again through a preset retry mechanism.
[0072] Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention can be applied.
[0073] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, 703, network 704 and server 705. Network 704 is used to provide a medium for communication links between terminal devices 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0074] Users can use terminal devices 701, 702, 703 to interact with server 705 through network 704 to receive or send messages, etc. Various communication client applications, such as page sliding applications, etc., can be installed on terminal devices 701, 702, 703 (only as an example).
[0075] The terminal devices 701 , 702 , and 703 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.
[0076] Terminal devices 701, 702, and 703 can respond to monitoring of a horizontal sliding event and a vertical sliding event of a target page, and determine a sliding area of a nested page in the target page according to the sliding data corresponding to the vertical sliding event; wherein the nested page is nested in the target page; and determine whether the horizontal sliding position corresponding to the horizontal sliding event is within the sliding area. When the judgment result is that the horizontal sliding event is within the sliding area, the horizontal sliding event is passed to the nested page, so that the nested page performs horizontal sliding and other processing according to the horizontal sliding event, and the processing result is fed back to the terminal device.
[0077] It should be noted that the page sliding method provided in the embodiment of the present invention is generally executed by the terminal devices 701 , 702 , 703 , and accordingly, the page sliding device is generally provided in the terminal devices 701 , 702 , 703 .
[0078] It should be understood that Figure 7 The 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 implementation requirements.
[0079] Reference below Figure 8 , Figure 8 It is a schematic diagram of the structure of a computer system of a terminal device suitable for implementing an embodiment of the present invention. Figure 8 The terminal 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.
[0080] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0081] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.
[0082] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in 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 flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.
[0083] 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 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 thereof.
[0084] 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 module, program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that 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 the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0085] The units involved in the embodiments of the present invention may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes: a sliding area determination module and a page sliding module.
[0086] Among them, the names of these modules do not constitute a limitation of the modules themselves in certain cases. For example, the sliding area determination module can also be described as "a module for responding to monitoring horizontal sliding events and vertical sliding events of a target page, and determining the sliding area of a nested page in the target page according to sliding data corresponding to the vertical sliding events."
[0087] On the other hand, the present invention also provides a computer-readable medium, which may be included in the device described in the embodiment; or it may exist independently without being assembled into the device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by a device, the device includes: in response to monitoring a horizontal sliding event and a vertical sliding event of a target page, determining a sliding area of a nested page in the target page according to the sliding data corresponding to the vertical sliding event; wherein the nested page is nested in the target page; determining whether the horizontal sliding position corresponding to the horizontal sliding event is within the sliding area, and when the judgment result is within the sliding area, passing the horizontal sliding event to the nested page, so that the nested page slides horizontally according to the horizontal sliding event.
[0088] The technical solution according to the embodiment of the present invention has the following advantages or beneficial effects: by responding to the monitored horizontal sliding event and the vertical sliding event of the target page, according to the sliding data corresponding to the vertical sliding event, determining the sliding area of the nested page in the target page; wherein the nested page is nested in the target page; judging whether the horizontal sliding position corresponding to the horizontal sliding event is within the sliding area, when the judgment result is within the sliding area, passing the horizontal sliding event to the nested page, so that the nested page slides horizontally according to the technical solution of the horizontal sliding event, realizes a method for supporting horizontal sliding of nested pages, determines whether the horizontal sliding event belongs to the nested page by judging the horizontal sliding position corresponding to the monitored horizontal sliding event, and passes the horizontal sliding event belonging to the nested page to the corresponding nested page, effectively solves the sliding conflict in the hybrid development mode, and meets more business needs and usage scenarios.
[0089] The specific implementation methods described herein do not constitute limitations on the scope of protection 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 modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention shall be included in the scope of protection of the present invention.
Claims
1. A page sliding method, characterized in that: include: In response to monitoring a horizontal sliding event and a vertical sliding event of a target page, determining a sliding area of a nested page in the target page according to sliding data corresponding to the vertical sliding event; wherein the nested page is nested in the target page; It is determined whether the horizontal sliding position corresponding to the horizontal sliding event is within the sliding area. When the determination result is within the sliding area, the horizontal sliding event is passed to the nested page so that the nested page slides horizontally according to the horizontal sliding event.
2. The method according to claim 1, characterized in that Determining a sliding area of the nested page in the target page according to the sliding data corresponding to the vertical sliding event includes: Acquire an initial sliding area of the nested page in the target page, where the initial sliding area is determined by the nested page when the target page is loaded; Acquiring a corresponding sliding distance from a monitoring code that monitors the vertical sliding event, wherein the monitoring code triggers calculation of the sliding distance of the target page when monitoring that the target page has vertically slid; A sliding area of the nested page in the target page is calculated according to the initial sliding area and the sliding distance.
3. The method according to claim 2, characterized in that In the case where the vertical sliding event is empty, determining the sliding area of the nested page in the target page according to the sliding data corresponding to the vertical sliding event includes: The initial sliding area is used as the sliding area of the nested page in the target page.
4. The method according to claim 1, characterized in that The target page includes a nested page and a native page. When the result of the determination is that the target page is not within the sliding area, the method further includes: The horizontal sliding event is intercepted, and the native page is horizontally slid according to the horizontal sliding event.
5. The method according to claim 4, characterized in that Determining whether the horizontal sliding position corresponding to the horizontal sliding event is within the sliding area, and when the determination result is within the sliding area, passing the horizontal sliding event to the nested page, including: A sliding interception code is written in the native page in the target page, and the horizontal sliding position corresponding to the horizontal sliding event is obtained through the sliding interception code, and it is determined whether the horizontal sliding position is within the sliding area. When the judgment result is that the horizontal sliding position is within the sliding area, the horizontal sliding event is passed to the nested page.
6. The method according to claim 1, characterized in that After determining the sliding area of the nested page in the target page, the method further includes: The sliding area is verified according to the distribution position of the nested page in the target page and the distribution rule of the sub-pages supporting horizontal sliding in the nested page.
7. The method according to claim 1, characterized in that After transmitting the horizontal sliding event to the nested page, the method further includes: Monitor whether the nested page receives the horizontal sliding event, and if the nested page does not receive the horizontal sliding event, pass the horizontal sliding event to the nested page again through a preset retry mechanism.
8. A page sliding device, characterized in that: include: A sliding area determination module, configured to respond to monitoring a horizontal sliding event and a vertical sliding event of a target page, and determine a sliding area of a nested page in the target page according to sliding data corresponding to the vertical sliding event; wherein the nested page is nested in the target page; The page sliding module is used to determine whether the horizontal sliding position corresponding to the horizontal sliding event is within the sliding area. When the judgment result is that the horizontal sliding position is within the sliding area, the horizontal sliding event is passed to the nested page so that the nested page slides horizontally according to the horizontal sliding event.
9. A mobile electronic device terminal, 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 7.
10. A computer readable 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 7 is implemented.