CN114490126A - Page processing method and device, electronic equipment and storage medium - Google Patents

Page processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114490126A
CN114490126A CN202210061186.6A CN202210061186A CN114490126A CN 114490126 A CN114490126 A CN 114490126A CN 202210061186 A CN202210061186 A CN 202210061186A CN 114490126 A CN114490126 A CN 114490126A
Authority
CN
China
Prior art keywords
event
page
identifier
target
component
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210061186.6A
Other languages
Chinese (zh)
Inventor
文杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202210061186.6A priority Critical patent/CN114490126A/en
Publication of CN114490126A publication Critical patent/CN114490126A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The disclosure provides a page processing method and device, electronic equipment and a storage medium, and relates to the fields of intelligent search, natural language processing and the like. The specific implementation scheme is as follows: under the condition that a first component in a target page monitors a target event, acquiring an event identifier and an event parameter of the target event, and generating first calling information according to the event identifier, the event parameter and a page identifier of the target page; calling a first global method according to the first calling information so as to write event parameters in the first calling information into a first message queue corresponding to the page identifier and the event identifier; and the first message queue is used for paying attention to a second component of the first message queue in the target page, and updating and displaying the component content according to the event parameter written in the first message queue. Therefore, when the first component in the target page monitors the target event, the second component can be informed to update the component content according to the event parameter of the target event in the form of calling the global method.

Description

Page processing method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of artificial intelligence, and in particular, to the technical fields of intelligent search, natural language processing, and the like, and more particularly, to a page processing method and apparatus, an electronic device, and a storage medium.
Background
An SPA application (single page Web application) refers to an application with only one Web page, that is, a client requests to access a page for the first time, and after responding from a server, page jump in a client browser is performed, all of which are that ajax (asynchronous JavaScript and XML) data requests are completed at the client, a template of a corresponding page is filled, a page display is refreshed, and a new page request is not initiated to the server.
A page in the SPA application may be composed of contents of multiple parts (multi-part), and these parts may be divided into independent components (i.e., component or widget), and communication is required between these components, for example, component a (component a) needs to notify component b (component b) of some changes or operations. Therefore, how to implement communication between components is very important.
Disclosure of Invention
The present disclosure provides a page processing method, apparatus, electronic device, and storage medium to solve at least one of the problems in the related art.
According to an aspect of the present disclosure, there is provided a page processing method, including:
under the condition that a first component in a target page monitors a target event, acquiring an event identifier and an event parameter of the target event;
generating first calling information according to the event identifier, the event parameter and the page identifier of the target page;
calling a first global method according to the first calling information so as to write event parameters in the first calling information into a first message queue corresponding to the page identifier and the event identifier;
the first message queue is used for a second component which concerns the first message queue in the target page, and component content is updated and displayed according to the event parameter written in the first message queue.
According to another aspect of the present disclosure, there is provided a page processing apparatus including:
the system comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring an event identifier and an event parameter of a target event under the condition that a first component in a target page monitors the target event;
the first generation module is used for generating first calling information according to the event identifier, the event parameter and the page identifier of the target page;
the first calling module is used for calling a first global method according to the first calling information so as to write the event parameter in the first calling information into a first message queue corresponding to the page identifier and the event identifier;
the first message queue is used for a second component which concerns the first message queue in the target page, and component content is updated and displayed according to the event parameter written in the first message queue.
According to still another aspect of the present disclosure, there is provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a page processing method according to the above aspect of the disclosure.
According to still another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium of computer instructions for causing a computer to perform the page processing method set forth in the above-described aspect of the present disclosure.
According to yet another aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the page processing method proposed by the above-mentioned aspect of the present disclosure.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a diagram illustrating a first communication mode of components in a page in a conventional SPA application;
FIG. 2 is a diagram illustrating a communication mode of components in a page in a conventional SPA application;
fig. 3 is a schematic flowchart of a page processing method according to a first embodiment of the disclosure;
fig. 4 is a schematic flowchart of a page processing method according to a second embodiment of the disclosure;
FIG. 5 is a diagram illustrating how components in pages communicate in accordance with an embodiment of the present disclosure;
fig. 6 is a schematic flowchart of a page processing method according to a third embodiment of the disclosure;
fig. 7 is a schematic structural diagram of a page processing apparatus according to a fourth embodiment of the disclosure;
FIG. 8 shows a schematic block diagram of an example electronic device that may be used to implement embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Communication is needed among components in a page in an SPA application, and the communication mode can transit an Event by adopting an Event-Center (hereinafter, abbreviated as EC) or an Event-Hub).
For example, the communication principle between component a (component a) and component b (component b) may be as shown in fig. 1. When component a needs to notify component B of some change or operation, an event method of interest of EC, such as ec.on (eventName), is usually called on component B, where eventName refers to an event name of an event of interest to component B, and then component a calls an event triggering method of EC, such as ec.trigger (eventName), at this time, EC may determine that an event with an event name of eventName needs to be triggered, and then may trigger a logic of regarding the eventName event.
It should be noted that different pages may also communicate with each other, and the communication mode is the same as the communication principle of each component in the same page, which is not described herein again. In addition, the inside of the EC is how to execute the event logic concerned by the concerned event method on when the trigger event method trigger is called, and does not concern here.
However, the communication method between the above components has the following problems: when events with the same name are focused or triggered respectively in different pages, the different pages are affected mutually.
As an example, as shown in FIG. 2, when Page 1(Page1) and Page 2(Page2) each focus on or trigger an en event with the same name, if the component A in Page1 triggers an en event, it will not only cause the component B in Page1 to update the corresponding component content, but also cause the component K in Page2 to update the corresponding component content. Similarly, if the component E in Page2 triggers an en event, it will not only cause the component K in Page2 to update the corresponding component contents, but will also cause the component B in Page1 to update the corresponding component contents.
That is, in the SPA application, although the Page has been switched from Page1 to Page2, the Page data and the Event of the Page binding and the global Event-Center may not be destroyed, as shown in fig. 2, after switching to Page2, if the logic of the Event-Center and Page1 remains, when an en Event is triggered in Page2, in addition to executing the logic of the Page that focuses on the en Event, the logic of Page1 that focuses on the en Event is also triggered.
In order to solve the above problem, the present disclosure provides a page processing method, an apparatus, an electronic device, and a storage medium.
A page processing method, apparatus, electronic device, and storage medium of the embodiments of the present disclosure are described below with reference to the accompanying drawings.
Fig. 3 is a flowchart illustrating a page processing method according to a first embodiment of the disclosure.
The page processing method is exemplified by being configured in a page processing apparatus, and the page processing apparatus may be applied to any electronic device, so that the electronic device may execute a page processing function.
The electronic device may be any device with computing capability, for example, a PC (Personal Computer), a mobile terminal, and the like, and the mobile terminal may be a hardware device with various operating systems, touch screens, and/or display screens, such as a mobile phone, a tablet Computer, a Personal digital assistant, and a wearable device.
As shown in fig. 3, the page processing method may include the steps of:
step 301, acquiring an event identifier and an event parameter of a target event when a first component in a target page monitors the target event.
In the disclosed embodiment, the target page may be a currently displayed page.
In the embodiment of the present disclosure, the first component may be a component in the target page that detects the target event, or a component in the target page that triggers the target event. The target event may be any event monitored or triggered by the first component, and the event identifier of the target event may be, for example, character information that identifies the target event, such as an event name of the target event; the event parameter of the target event may be a parameter related to the target event, for example, the target event is taken as a login event, and the event parameter may be a parameter related to the login event, such as a login account, user information associated with the login account, and the like.
In the embodiment of the disclosure, under the condition that the first component in the target page monitors the target event, the event identifier corresponding to the target event and the event parameter corresponding to the target event may be obtained. For example, the event identifier and the event parameter corresponding to the target event may be obtained from the first component side.
Step 302, generating first calling information according to the event identifier, the event parameter and the page identifier of the target page.
In the embodiment of the present disclosure, in order to avoid a situation that components concerning the event with the same name in different pages update corresponding component contents at the same time due to the event with the same name adopted in different pages, that is, in order to avoid a situation that different pages affect each other due to the event with the same name being concerned or triggered inside different pages, in the present disclosure, the first call information may be generated according to an event identifier and an event parameter corresponding to the target event and a page identifier of the target page.
As an example, the event identifier of the target event and the page identifier of the target page may be spliced to obtain a spliced identifier, for example, the page identifier may be used as a prefix of the event identifier, or the page identifier may be used as a suffix of the event identifier to obtain the spliced identifier. Therefore, the first calling information can be generated according to the splicing identification and the event parameter of the target event.
Step 303, calling a first global method according to the first calling information to write an event parameter in the first calling information into a first message queue corresponding to the page identifier and the event identifier; the first message queue is used for paying attention to a second component of the first message queue in the target page, and component content is updated and displayed according to the event parameter written in the first message queue.
In an embodiment of the present disclosure, the second component may be a component of the target page that is interested in the target event.
In this embodiment of the present disclosure, a first global method may be called according to first calling information, so as to write an event parameter in the first calling information into a first message queue corresponding to a page identifier and an event identifier, so that a second component focusing on a target event in a target page may obtain the event parameter from the first message queue to update and display component content, that is, the second component focusing on the first message queue in the target page may update and display the component content according to the event parameter written in the first message queue.
That is to say, in the present disclosure, under the condition that a first component in a target page monitors a first target event, an event identifier and an event parameter of the target event may be obtained, and the event parameter is written into a first message queue corresponding to the page identifier and the event identifier, so that under the condition that a second component, which focuses on the first message queue in the target page, monitors that there is a write operation in the first message queue, component content of the second component may be updated and displayed according to the first event parameter written in the first message queue.
As an example, taking the first global method as a trigger event method of the global event center to perform an example, the trigger event method of the global event center may be called according to the first call information, so that the global event center may write an event parameter in the first call information into a first message queue corresponding to the page identifier and the event identifier. For the event-concerned method for calling the global event center and the second component of the concerned target event, the content of the component can be updated and displayed according to the event parameter written in the first message queue, that is, the page data can be updated according to the event parameter.
As an application scenario, a target page is taken as a mailbox page, a target event is taken as a login event for example, a first component may be a component used for logging in the upper right corner of the mailbox page, and when a user triggers the first component on the target page, first call information may be generated according to an event parameter and an event identifier of the login event and a page identifier of the mailbox page, and a trigger event method of a global event center may be called according to the first call information, so that the global event center may write an event parameter in the first call information into a first message queue corresponding to the page identifier and the event identifier. For a concerned event method for calling a global event center in a mailbox page and for a second concerned logging event component, component content can be updated and displayed according to event parameters written in a first message queue. For example, before the component content of the second component is updated, because the user does not log in the mailbox page, the second component before the update may show information irrelevant to the user mailbox content, and after the user logs in the mailbox page, the second component after the component content is updated may show status information related to the user mailbox, such as an inbox, a draft box, and the like. That is, only after the first component is successfully logged in, the second component can be notified to refresh, and the second component can display corresponding mailbox contents, such as the number of published articles, how many drafts are in the draft box, and the like, only after being refreshed.
The page processing method of the embodiment of the disclosure acquires an event identifier and an event parameter of a target event under the condition that a first component in the target page monitors the target event, and generates first calling information according to the event identifier, the event parameter and a page identifier of the target page; calling a first global method according to the first calling information so as to write event parameters in the first calling information into a first message queue corresponding to the page identifier and the event identifier; the first message queue is used for paying attention to a second component of the first message queue in the target page, and component content is updated and displayed according to the event parameter written in the first message queue. Therefore, when the first component in the target page monitors the target event, the second component can be informed to update the component content according to the event parameter of the target event in the form of calling the global method. In addition, in the disclosure, a global method is called simultaneously according to the event identifier and the page identifier to write the event parameter into the message queue corresponding to the page identifier and the event identifier, so that the event parameter in the message queue is obtained only by the second component of the target event corresponding to the attention event identifier in the target page corresponding to the page identifier, and the component of the attention target event in other pages cannot obtain the event parameter of the target event, thereby avoiding the occurrence of the situation that the components of the attention target event in different pages adopt the same-name event and update the corresponding component content simultaneously, and avoiding the occurrence of the situation that the components of the attention target event in different pages pay attention to or trigger the same-name event respectively in different pages and cause the mutual influence of different pages.
In the technical scheme of the present disclosure, the processes of collecting, storing, using, processing, transmitting, providing, disclosing and the like of the personal information of the related user are all performed under the premise of obtaining the consent of the user, and all meet the regulations of the related laws and regulations, and do not violate the good custom of the public order.
As a possible implementation manner, in order to enable the second component to effectively acquire the event parameter written in the first message queue, in the present disclosure, a concern relationship between the second component and the first message queue may be configured in advance. The above process is described in detail below with reference to fig. 4.
Fig. 4 is a flowchart illustrating a page processing method according to a second embodiment of the disclosure.
As shown in fig. 4, the page processing method may include the steps of:
step 401, configuring a concern relationship between a second component and a first message queue corresponding to a page identifier and an event identifier according to a target event to be responded by the second component in a target page and the page identifier of the target page.
In the embodiment of the present disclosure, a concern relationship between the second component and the first message queue corresponding to the page identifier and the event identifier of the target event may be configured according to the target event that the second component needs to respond to in the target page and the page identifier of the target page.
As a possible implementation manner, in order to effectively configure an attention relationship between the second component and the first message queue, in the present disclosure, second call information may be generated according to an event identifier of a target event to which the second component needs to respond in a target page and a page identifier of the target page, and an attention method may be called according to the second call information to configure the attention relationship between the second component and the first message queue.
As an example, for a second component focusing on a target event in a target page, the second component may generate second call information according to an event identifier of the target event, a page identifier of the target page, and a callback function, and call a focused event method of a global event center according to the second call information to configure a focused relationship between the second component and the first message queue.
For example, in order to avoid a situation that components concerning the same-name events in different pages update corresponding component contents at the same time due to the same-name events adopted in different pages, that is, to avoid a situation that the same-name events in different pages are respectively concerned or triggered, thereby causing mutual influence between different pages, in the present disclosure, each page may be packaged with a local event center corresponding to itself, the second component may call an concerning event method on () of the local event center corresponding to the target page in advance according to an event identifier and a callback function of the target event, the local event center may use the page identifier of the target page as a prefix or suffix of the event identifier, and call an concerning event method on () of the global event center, so as to configure an concerning relationship between the second component and the first message queue.
It should be noted that, the present disclosure is only exemplified by the step 401 being executed before the step 402, but the present disclosure is not limited thereto, and in practical applications, the step 401 only needs to be executed before the step 404.
Step 402, acquiring an event identifier and an event parameter of a target event when a first component in the target page monitors the target event.
Step 403, generating first calling information according to the event identifier, the event parameter, and the page identifier of the target page.
Step 404, calling a first global method according to the first calling information to write the event parameter in the first calling information into a first message queue corresponding to the page identifier and the event identifier; the first message queue is used for paying attention to a second component of the first message queue in the target page, and component content is updated and displayed according to the event parameter written in the first message queue.
For a specific implementation process of steps 402 to 404, reference may be made to related descriptions of any embodiment of the present disclosure, which are not described herein again.
As an example, the page processing method is executed by a client, which may be an SPA application, such as a browser web application, an applet application, or the like. When the client front end displays a target Page, for example, the target Page is Page1 in fig. 5, the first component may be component a in Page1, the target event may be an en event, the component a may obtain an event identifier (e.g., an event name, i.e., en) and an event parameter of the en event, and call a trigger event method trigger (en) of a local event center corresponding to the Page1 according to the event identifier and the event parameter, the local event center may use the Page identifier (e.g., the Page name, i.e., Page1) of the Page1 as a prefix of the event identifier and call a trigger event method trigger (Page1.en) of a global event center corresponding to the client back end, so that the global event center may transfer the event parameter corresponding to the en event into a first target queue corresponding to the Page identifier and the event identifier.
For a second component (i.e., component b) in the Page1, which focuses on the en event, the component b may call, in advance, an event-focused method on (en) of a local event center corresponding to the Page1 according to the event identifier of the en event and a callback function, where the local event center may use a Page identifier (e.g., a Page name, i.e., Page1) of the Page1 as a prefix of the event identifier, and call an event-focused method on (Page1.en) of a global event center corresponding to the client backend, so as to configure a focus relationship between the second component and the first message queue.
Therefore, when the event parameter corresponding to the en event is written in the first message queue, the componentB can acquire the event parameter written in the first message queue, and update and display the component content according to the event parameter written in the first message queue.
According to the page processing method of the embodiment of the disclosure, the attention relationship between the second component and the first message queue is configured according to the target event required to be responded by the second component in the target page and the page identifier of the target page. Therefore, the concern relationship between the second component and the first message queue can be effectively configured according to the event identifier of the target event concerned by the second component and the page identifier of the target page, so that the event parameters in the first message queue can be acquired only by the second component concerned by the target event in the target page, the event parameters of the target event cannot be acquired by the components concerned by the target event in other pages, and the situation that the components concerned by the same-name event in different pages update corresponding component contents at the same time due to the adoption of the same-name event in different pages can be avoided.
In order to clearly illustrate how the event parameters are written into the message queue in the disclosure, the disclosure also provides a page processing method.
Fig. 6 is a flowchart illustrating a page processing method according to a third embodiment of the disclosure.
As shown in fig. 6, the page processing method may include the steps of:
step 601, acquiring an event identifier and an event parameter of a target event when a first component in a target page monitors the target event.
The specific implementation process of step 601 may refer to the related description of any embodiment of the present disclosure, which is not described herein again.
Step 602, determining whether the event identifier includes a setting identifier, if yes, performing steps 605 to 606, and if no, performing steps 603 to 604.
In the embodiment of the present disclosure, the set identifier is a preset identifier, and the set identifier is used to indicate that the target event is an event with global influence, not a page-level event inside a page. That is, when there is an event having the same event identifier (for example, the same event name, that is, the same name) as the target event in another page, the component concerning the target event in the other page also needs to update the component content according to the event parameter of the target event. For example, the setting identifier may be a global identifier, such as global.
Step 603, generating first calling information according to the event identifier, the event parameter and the page identifier of the target page.
In the embodiment of the present disclosure, when the event identifier does not include the set identifier, it indicates that the target event only needs to affect the component in the target page, and at this time, the first invocation information may be generated according to the event identifier, the event parameter, and the page identifier of the target page.
Step 604, calling a first global method according to the first calling information to write the event parameter in the first calling information into a first message queue corresponding to the page identifier and the event identifier; the first message queue is used for paying attention to a second component of the first message queue in the target page, and component content is updated and displayed according to the event parameter written in the first message queue.
The specific implementation process of steps 603 to 604 may refer to the related description of any embodiment of the present disclosure, and is not described herein again.
Step 605, generating second calling information according to the event identifier and the event parameter of the target event.
In the embodiment of the present disclosure, when the event identifier includes the set identifier, it indicates that the target event is an event that is globally influenced, and when the target event is monitored or triggered, the event parameter of the target event needs to influence not only the component in the target page but also the components in other pages.
Step 606, according to the second calling information, calling a second global method to write the event parameter in the second scheduling information into a second message queue corresponding to the event identifier; and the second message queue is used for paying attention to a third component of the second message queue in each page, and updating and displaying the component content according to the event parameter written in the second message queue.
In the disclosed embodiment, the third component may be a component of any page that focuses on a target event.
In this disclosure, a second global method may be called according to second call information, so as to write an event parameter in second scheduling information into a second message queue corresponding to an event identifier, so that a third component concerning the target event in any page may obtain the event parameter from the second message queue to update and display a component content, that is, in this disclosure, a third component concerning the second message queue in any page may update and display a component content according to the event parameter written in the second message queue.
In a possible implementation manner of the embodiment of the present disclosure, the attention relationship between the third component and the second message queue may be configured according to a target event to which the third component in any page needs to respond.
For example, third calling information may be generated according to an event identifier of a target event to which the third component in any page needs to respond, and a concern method may be called according to the third calling information to configure a concern relationship between the third component and a second message queue corresponding to the event identifier.
For example, taking a target Page as Page1 in fig. 5 and a target event as an en event, in addition to the componentB in Page1 focusing on en events, the componentK in Page2 also focuses on en events. In the case that componentA in Page1 triggers an en event, if componentA calls a trigger event method trigger (en) of the local event center corresponding to Page1 according to only an event identifier (e.g., an event name, i.e., en) and an event parameter of the en event, the local event center may add a prefix or a suffix to the event identifier (en) according to a Page identifier (such as a Page name, i.e., Page1) of Page1, for example, to add a prefix to the event identifier (en) according to the Page identifier, and the local event center may call a trigger event method trigger (Page1.en) of the global event center, so that the global event center may write the event parameter into the first target queue corresponding to the Page identifier (Page1) and the event identifier (en). Therefore, componentB concerning the en event in Page1 can acquire the event parameter written in the first message queue, and update and display the component content according to the event parameter written in the first message queue.
And if the componentA calls a trigger event method trigger (global) of the local event center according to the event identifier (e.g., event name, i.e., en) of the en event, the setting identifier (e.g., global) and the event parameter at the same time, the local event center may add a prefix or a suffix to the event identifier (en) without according to the page identifier when recognizing that the prefix of the en is global. The local event center may call a trigger event method trigger (global.en) of the global event center, so that the global event center may write the event parameter into the second target queue corresponding to the event identifier. Therefore, both the component B and the component K of the concerned en event in the Page1 and the Page2 can acquire the event parameter written in the second message queue, and update and display the component content according to the event parameter written in the second message queue.
Similarly, in the case that a componentE in Page2 triggers an en event, if the componentE calls a trigger event method trigger (en) of the local event center corresponding to Page2 according to only an event identifier (e.g., an event name, i.e., en) and an event parameter of the en event, the local event center may add a prefix or a suffix to the event identifier (en) according to a Page identifier (e.g., a Page name, i.e., Page2) of Page2, for example, to add a prefix to the event identifier (en) according to the Page identifier, and the local event center may call a trigger event method trigger (Page2.en) of the global event center, so that the global event center may write the event parameter into a first target queue corresponding to the Page identifier (Page2) and the event identifier (en). Therefore, the componentK concerning the en event in Page2 can acquire the event parameter written in the first message queue, and update and display the component content according to the event parameter written in the first message queue.
And if the componentE calls a trigger event method trigger (global) of the local event center according to the event identifier (e.g., event name, i.e., en) of the en event, the setting identifier (e.g., global) and the event parameter at the same time, the local event center may add a prefix or a suffix to the event identifier (en) without according to the page identifier when recognizing that the prefix of the en is global. The local event center may call a trigger event method trigger (global.en) of the global event center, so that the global event center may write the event parameter into the second target queue corresponding to the event identifier. Therefore, both the component B and the component K of the concerned en event in the Page1 and the Page2 can acquire the event parameter written in the second message queue, and update and display the component content according to the event parameter written in the second message queue.
Therefore, the local event center in each page can adopt a proxy mode to avoid the influence caused by the distribution of the event with the same name in different pages, wherein the local event center and the global event center in each page adopt the same method name. Moreover, when the event identifier includes a set identifier (such as global), an event supporting global influence, that is, a request for explicitly distributing a homonymous event to be globally validated, may also be implemented, and when the local event center corresponding to each page calls the global event center, if it is recognized that the prefix of the event name is the set identifier, the page name is not added before the event name, so that a page-level event inside the page is not formed.
It should be noted that, the foregoing is only illustrated by adding a prefix to the event identifier according to the set identifier (global), but the present disclosure is not limited to this, and in actual application, a suffix may be added to the event identifier according to the set identifier (global), or a triggerGlobal () method may be added to the event center EC, for example, the component a may call the global trigger event method triggerGlobal (eventName, eventparam) of the local event center according to the event identifier (eventName) and the event parameter (eventParams) of the en event. The local event center may call a global trigger event method triggerGlobal (eventName, eventParams) of the global event center, so that the global event center may write the event parameter into the second target queue corresponding to the event identifier.
Or, a third parameter may be added to the trigger () method to support an event with an incoming Global influence, for example, component a may call a trigger event method trigger (eventName, evenparams, isGlobal ═ true) of the local event center according to the event identifier (eventName) and the event parameter, and the local event center may call a trigger event method trigger (eventName, evenparams, isGlobal ═ true) of the Global event center, so that when the Global event center determines the Global event center, the event parameter may be written into the second target queue corresponding to the event identifier.
According to the page processing method of the embodiment of the disclosure, under the condition that the event identifier does not contain the set identifier, the first calling information is generated according to the event identifier, the event parameter and the page identifier of the target page. Therefore, the situation that components concerning the same-name events in different pages update corresponding component contents at the same time due to the same-name events adopted in different pages can be avoided.
Generating second calling information according to the event identifier and the event parameter of the target event under the condition that the event identifier comprises the set identifier; calling a second global method according to the second calling information so as to write the event parameters in the second scheduling information into a second message queue corresponding to the event identifier; and the second message queue is used for paying attention to a third component of the second message queue in each page, and updating and displaying the component content according to the event parameter written in the second message queue. Thus, events supporting global influence, i.e. supporting the distribution requirement of the event of the same name explicitly to be globally effective, can be realized. That is, in the present disclosure, not only page-level events inside a page can be realized, but also events with global influence can be supported, and the flexibility and applicability of the method can be improved.
Corresponding to the page processing method provided in the embodiments of fig. 3 to 6, the present disclosure also provides a page processing apparatus, and since the page processing apparatus provided in the embodiments of the present disclosure corresponds to the page processing method provided in the embodiments of fig. 3 to 6, the implementation of the page processing method is also applicable to the page processing apparatus provided in the embodiments of the present disclosure, and is not described in detail in the embodiments of the present disclosure.
Fig. 7 is a schematic structural diagram of a page processing apparatus according to a fourth embodiment of the disclosure.
As shown in fig. 7, the page processing apparatus 700 may include: an acquisition module 710, a first generation module 720, and a first invocation module 730.
The obtaining module 710 is configured to obtain an event identifier and an event parameter of the target event when the first component in the target page monitors the target event.
And the first generating module 720 is configured to generate first invocation information according to the event identifier, the event parameter, and the page identifier of the target page.
The first calling module 730 is configured to call the first global method according to the first calling information, so as to write the event parameter in the first calling information into the first message queue corresponding to the page identifier and the event identifier.
The first message queue is used for paying attention to a second component of the first message queue in the target page, and component content is updated and displayed according to the event parameter written in the first message queue.
In a possible implementation manner of the embodiment of the present disclosure, the page processing apparatus 700 may further include:
and the configuration module is used for configuring the concern relationship between the second component and the first message queue according to the target event to be responded by the second component in the target page and the page identifier of the target page.
In a possible implementation manner of the embodiment of the present disclosure, the configuring module may include:
and the generating unit is used for generating second calling information according to the event identifier of the target event required to be responded by the second component in the target page and the page identifier of the target page.
And the calling unit is used for calling the attention method according to the second calling information so as to configure the attention relationship between the second component and the first message queue.
In a possible implementation manner of the embodiment of the present disclosure, the first invoking module is specifically configured to: and under the condition that the event identifier does not contain the set identifier, generating first calling information according to the event identifier, the event parameter and the page identifier of the target page.
In a possible implementation manner of the embodiment of the present disclosure, the page processing apparatus 700 may further include:
and the second generation module is used for generating second calling information according to the event identifier and the event parameter of the target event under the condition that the event identifier comprises the set identifier.
And the second calling module is used for calling a second global method according to the second calling information so as to write the event parameters in the second scheduling information into a second message queue corresponding to the event identifier.
And the second message queue is used for paying attention to a third component of the second message queue in each page, and updating and displaying the component content according to the event parameter written in the second message queue.
The page processing device of the embodiment of the disclosure acquires an event identifier and an event parameter of a target event under the condition that a first component in the target page monitors the target event, and generates first calling information according to the event identifier, the event parameter and a page identifier of the target page; calling a first global method according to the first calling information so as to write event parameters in the first calling information into a first message queue corresponding to the page identifier and the event identifier; the first message queue is used for paying attention to a second component of the first message queue in the target page, and component content is updated and displayed according to the event parameter written in the first message queue. Therefore, when the first component in the target page monitors the target event, the second component can be informed to update the component content according to the event parameter of the target event in the form of calling the global method. In addition, in the disclosure, a global method is called simultaneously according to the event identifier and the page identifier to write the event parameter into the message queue corresponding to the page identifier and the event identifier, so that the event parameter in the message queue is obtained only by the second component of the target event corresponding to the attention event identifier in the target page corresponding to the page identifier, and the component of the attention target event in other pages cannot obtain the event parameter of the target event, thereby avoiding the occurrence of the situation that the components of the attention target event in different pages adopt the same-name event and update the corresponding component content simultaneously, and avoiding the occurrence of the situation that the components of the attention target event in different pages pay attention to or trigger the same-name event respectively in different pages and cause the mutual influence of different pages.
To implement the above embodiments, the present disclosure also provides an electronic device, which may include at least one processor; and a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the page processing method according to any one of the above embodiments of the disclosure.
In order to achieve the above embodiments, the present disclosure also provides a non-transitory computer readable storage medium storing computer instructions for causing a computer to execute the page processing method proposed in any one of the above embodiments of the present disclosure.
In order to implement the foregoing embodiments, the present disclosure further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the computer program implements the page processing method proposed in any of the foregoing embodiments of the present disclosure.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 8 shows a schematic block diagram of an example electronic device that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 8, the electronic apparatus 800 includes a computing unit 801 that can perform various appropriate actions and processes in accordance with a computer program stored in a ROM (Read-Only Memory) 802 or a computer program loaded from a storage unit 808 into a RAM (Random Access Memory) 803. In the RAM 803, various programs and data required for the operation of the electronic apparatus 800 can also be stored. The calculation unit 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An I/O (Input/Output) interface 805 is also connected to the bus 804.
A number of components in the electronic device 800 are connected to the I/O interface 805, including: an input unit 806 such as a keyboard, a mouse, or the like; an output unit 807 such as various types of displays, speakers, and the like; a storage unit 808, such as a magnetic disk, optical disk, or the like; and a communication unit 809 such as a network card, modem, wireless communication transceiver, etc. The communication unit 809 allows the electronic device 800 to exchange information/data with other devices through a computer network such as the internet and/or various telecommunication networks.
Computing unit 801 may be a variety of general and/or special purpose processing components with processing and computing capabilities. Some examples of the computing Unit 801 include, but are not limited to, a CPU (Central Processing Unit), a GPU (graphics Processing Unit), various dedicated AI (Artificial Intelligence) computing chips, various computing Units running machine learning model algorithms, a DSP (Digital Signal Processor), and any suitable Processor, controller, microcontroller, and the like. The calculation unit 801 executes the respective methods and processes described above, such as the above-described page processing method. For example, in some embodiments, the page processing methods described above may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program can be loaded and/or installed onto the electronic device 800 via the ROM 802 and/or the communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the page processing method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the page processing method described above in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be realized in digital electronic circuitry, Integrated circuitry, FPGAs (Field Programmable Gate arrays), ASICs (Application-Specific Integrated circuits), ASSPs (Application Specific Standard products), SOCs (System On Chip, System On a Chip), CPLDs (Complex Programmable Logic devices), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a RAM, a ROM, an EPROM (Electrically Programmable Read-Only-Memory) or flash Memory, an optical fiber, a CD-ROM (Compact Disc Read-Only-Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a Display device (e.g., a CRT (Cathode Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), internet, and blockchain Network.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The Server may be a cloud Server, which is also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service expansibility in a conventional physical host and a VPS (Virtual Private Server). The server may also be a server of a distributed system, or a server incorporating a blockchain.
It should be noted that artificial intelligence is a subject for studying a computer to simulate some human thinking processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), and includes both hardware and software technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing, and the like; the artificial intelligence software technology mainly comprises a computer vision technology, a voice recognition technology, a natural language processing technology, machine learning/deep learning, a big data processing technology, a knowledge map technology and the like.
According to the technical scheme of the embodiment of the disclosure, under the condition that a target event is monitored by a first component in a target page, an event identifier and an event parameter of the target event are obtained, and first calling information is generated according to the event identifier, the event parameter and a page identifier of the target page; calling a first global method according to the first calling information so as to write event parameters in the first calling information into a first message queue corresponding to the page identifier and the event identifier; the first message queue is used for paying attention to a second component of the first message queue in the target page, and component content is updated and displayed according to the event parameter written in the first message queue. Therefore, when a first component in the target page monitors a target event, a second component is informed to update the component content according to the event parameter of the target event in a mode of calling a global method. In addition, in the disclosure, a global method is called simultaneously according to the event identifier and the page identifier to write the event parameter into the message queue corresponding to the page identifier and the event identifier, so that the event parameter in the message queue is obtained only by the second component of the target event corresponding to the attention event identifier in the target page corresponding to the page identifier, and the component of the attention target event in other pages cannot obtain the event parameter of the target event, thereby avoiding the occurrence of the situation that the components of the attention target event in different pages adopt the same-name event and update the corresponding component content simultaneously, and avoiding the occurrence of the situation that the components of the attention target event in different pages pay attention to or trigger the same-name event respectively in different pages and cause the mutual influence of different pages.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel or sequentially or in different orders, and are not limited herein as long as the desired results of the technical solutions proposed in the present disclosure can be achieved.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the protection scope of the present disclosure.

Claims (13)

1. A method of page processing, the method comprising:
under the condition that a first component in a target page monitors a target event, acquiring an event identifier and an event parameter of the target event;
generating first calling information according to the event identifier, the event parameter and the page identifier of the target page;
calling a first global method according to the first calling information so as to write event parameters in the first calling information into a first message queue corresponding to the page identifier and the event identifier;
the first message queue is used for a second component which concerns the first message queue in the target page, and component content is updated and displayed according to the event parameter written in the first message queue.
2. The method of claim 1, wherein the method further comprises:
and configuring a concern relationship between the second component and the first message queue according to a target event required to be responded by the second component in the target page and the page identifier of the target page.
3. The method of claim 2, wherein the configuring the attention relationship between the second component and the first message queue according to the target event of the target page to which the second component needs to respond and the page identifier of the target page comprises:
generating second calling information according to the event identifier of the target event required to be responded by the second component in the target page and the page identifier of the target page;
and calling an attention method according to the second calling information so as to configure an attention relationship between the second component and the first message queue.
4. The method according to any one of claims 1 to 3, wherein the generating first call information according to the event identifier and the event parameter, and the page identifier of the target page comprises:
and under the condition that the event identifier does not contain a set identifier, generating first calling information according to the event identifier, the event parameter and the page identifier of the target page.
5. The method of claim 4, wherein the method further comprises:
under the condition that the event identifier comprises the set identifier, generating second calling information according to the event identifier and the event parameter of the target event;
calling a second global method according to the second calling information so as to write the event parameters in the second scheduling information into a second message queue corresponding to the event identifier;
and the second message queue is used for paying attention to a third component of the second message queue in each page, and updating and displaying the component content according to the event parameter written in the second message queue.
6. A page processing apparatus, the apparatus comprising:
the system comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring an event identifier and an event parameter of a target event under the condition that a first component in a target page monitors the target event;
the first generation module is used for generating first calling information according to the event identifier, the event parameter and the page identifier of the target page;
the first calling module is used for calling a first global method according to the first calling information so as to write the event parameter in the first calling information into a first message queue corresponding to the page identifier and the event identifier;
the first message queue is used for a second component which concerns the first message queue in the target page, and component content is updated and displayed according to the event parameter written in the first message queue.
7. The apparatus of claim 6, wherein the apparatus further comprises:
and the configuration module is used for configuring the concern relationship between the second component and the first message queue according to the target event required to be responded by the second component in the target page and the page identifier of the target page.
8. The apparatus of claim 7, wherein the configuration module comprises:
a generating unit, configured to generate second invocation information according to an event identifier of a target event that needs to be responded by the second component in the target page and a page identifier of the target page;
and the calling unit is used for calling an attention method according to the second calling information so as to configure the attention relationship between the second component and the first message queue.
9. The apparatus according to any one of claims 6 to 8, wherein the first invoking module is specifically configured to:
and under the condition that the event identifier does not contain a set identifier, generating first calling information according to the event identifier, the event parameter and the page identifier of the target page.
10. The apparatus of claim 9, wherein the apparatus further comprises:
a second generation module, configured to generate second invocation information according to the event identifier and the event parameter of the target event when the event identifier includes the set identifier;
the second calling module is used for calling a second global method according to the second calling information so as to write the event parameter in the second scheduling information into a second message queue corresponding to the event identifier;
and the second message queue is used for paying attention to a third component of the second message queue in each page, and updating and displaying the component content according to the event parameter written in the second message queue.
11. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.
12. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-5.
13. A computer program product comprising a computer program which, when being executed by a processor, carries out the steps of the method according to any one of claims 1-5.
CN202210061186.6A 2022-01-19 2022-01-19 Page processing method and device, electronic equipment and storage medium Pending CN114490126A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210061186.6A CN114490126A (en) 2022-01-19 2022-01-19 Page processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210061186.6A CN114490126A (en) 2022-01-19 2022-01-19 Page processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114490126A true CN114490126A (en) 2022-05-13

Family

ID=81472626

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210061186.6A Pending CN114490126A (en) 2022-01-19 2022-01-19 Page processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114490126A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114968407A (en) * 2022-05-30 2022-08-30 北京金堤科技有限公司 Plug-in calling method and device, electronic equipment and storage medium
CN117667076A (en) * 2023-12-06 2024-03-08 北京波士山信息技术有限公司 Cross-component message transfer method and system for dynamic page

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114968407A (en) * 2022-05-30 2022-08-30 北京金堤科技有限公司 Plug-in calling method and device, electronic equipment and storage medium
CN114968407B (en) * 2022-05-30 2024-03-08 北京金堤科技有限公司 Plug-in calling method, device, electronic equipment and storage medium
CN117667076A (en) * 2023-12-06 2024-03-08 北京波士山信息技术有限公司 Cross-component message transfer method and system for dynamic page

Similar Documents

Publication Publication Date Title
CN113010827B (en) Page rendering method and device, electronic equipment and storage medium
CN114490126A (en) Page processing method and device, electronic equipment and storage medium
CN115309470B (en) Method, device, equipment and storage medium for loading widget
CN114528517A (en) View processing method and device, electronic equipment and computer readable medium
CN114035865B (en) Method, device and equipment for starting small program and storage medium
CN114398023A (en) File generation method and page configuration method and device
CN112947916B (en) Method, apparatus, device and storage medium for implementing online canvas
CN114417780A (en) State synchronization method and device, electronic equipment and storage medium
CN115309730A (en) Data auditing method and device, electronic equipment and storage medium
CN115550141A (en) Event processing method and device, electronic equipment and readable storage medium
CN112966201B (en) Object processing method, device, electronic equipment and storage medium
CN114090118A (en) Method, device and equipment for starting small program and storage medium
CN114546343A (en) Generation method and device of activity page
CN114389969A (en) Client test method and device, electronic equipment and storage medium
CN114401121A (en) Application program login method and device, electronic equipment and readable storage medium
CN114218313A (en) Data management method, device, electronic equipment, storage medium and product
CN113836173A (en) Data processing method and device, electronic equipment and storage medium
CN112925623A (en) Task processing method and device, electronic equipment and medium
CN112882711A (en) Rendering method, device, equipment and storage medium
CN113051510A (en) Interactive processing method and device, front-end equipment, back-end equipment and storage medium
CN116431108B (en) Object type processing method and device, electronic equipment and storage medium
CN114428646B (en) Data processing method and device, electronic equipment and storage medium
CN114895898A (en) Instruction processing method, device, equipment and storage medium
CN114281436A (en) Applet communication method, apparatus, device and storage medium
CN117081939A (en) Traffic data processing method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination