[go: up one dir, main page]

CN111966507A - WEB-based event response method and device, computer equipment and storage medium - Google Patents

WEB-based event response method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN111966507A
CN111966507A CN202010711173.XA CN202010711173A CN111966507A CN 111966507 A CN111966507 A CN 111966507A CN 202010711173 A CN202010711173 A CN 202010711173A CN 111966507 A CN111966507 A CN 111966507A
Authority
CN
China
Prior art keywords
event
response
event table
stored
response method
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
CN202010711173.XA
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.)
Merchants Union Consumer Finance Co Ltd
Original Assignee
Merchants Union Consumer Finance 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 Merchants Union Consumer Finance Co Ltd filed Critical Merchants Union Consumer Finance Co Ltd
Priority to CN202010711173.XA priority Critical patent/CN111966507A/en
Publication of CN111966507A publication Critical patent/CN111966507A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/545Interprogram communication where tasks reside in different layers, e.g. user- and kernel-space
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本申请涉及一种基于WEB的事件响应方法、装置、计算机设备和存储介质。通过响应Web应用中外层组件的事件触发指令,获取事件的事件标识,根据获取的事件标识,从预设事件表中确定对应的响应方法,并调用确定的响应方法,对外层组件的事件进行处理,其中响应方法存储在内层组件中,预设事件表中存储有至少一组事件标识与响应方法的关联关系。相较于传统的通过逐级传递或者数据共享的方式,本方案可以利用预设事件表,实现在外层组件响应事件并直接调用内层组件中的响应方法对事件进行处理,从而实现了提高事件响应效率的效果。

Figure 202010711173

This application relates to a web-based event response method, apparatus, computer device, and storage medium. By responding to event triggering instructions from an outer component in a web application, the method obtains the event identifier. Based on the obtained event identifier, it determines the corresponding response method from a preset event table and calls the determined response method to process the event of the outer component. The response methods are stored in the inner component, and the preset event table stores at least one set of associations between event identifiers and response methods. Compared to traditional methods that rely on hierarchical transmission or data sharing, this solution utilizes a preset event table to enable the outer component to respond to events and directly call the response method in the inner component to process the events, thereby improving event response efficiency.

Figure 202010711173

Description

基于WEB的事件响应方法、装置、计算机设备和存储介质WEB-based incident response method, device, computer equipment and storage medium

技术领域technical field

本申请涉及互联网技术领域,特别是涉及一种基于WEB的事件响应方法、装置、计算机设备和存储介质。The present application relates to the field of Internet technologies, and in particular, to a WEB-based incident response method, apparatus, computer equipment and storage medium.

背景技术Background technique

随着互联网技术的发展,Web应用成为了主流应用形式之一,Web应用可以包含多个页面,每个页面可以作为组件的容器,可以包括多个组件,为了实现多个组件之间的通信,目前Web应用通常是将UI拆分成多个独立的组件,通过组合或嵌套的形式,得到多层级嵌套组件,而多层级嵌套组件间的数据通信,通常是利用组件逐级传递或数据共享方式实现,当最外层组件触发事件时,对事件的响应处理有时会需要依赖内层组件的数据或方法,然而通过组件逐级传递的方式,需要经过多层组件,每层组件都要参与传递;而通过数据共享的方式,内层组件将数据记录在公共的地方,当组件多且各数据状态不一致时,响应的时间会相应延长。With the development of Internet technology, web applications have become one of the mainstream application forms. A web application can contain multiple pages, and each page can be used as a container for components and can include multiple components. In order to realize the communication between multiple components, At present, web applications usually split the UI into multiple independent components, and obtain multi-level nested components by combining or nesting. The data sharing method is implemented. When the outermost component triggers an event, the response processing of the event sometimes needs to rely on the data or methods of the inner component. However, through the method of component-by-level transmission, it needs to go through multiple layers of components. To participate in the transfer; and through data sharing, the inner components record data in a public place, when there are many components and the data status is inconsistent, the response time will be extended accordingly.

因此,目前Web应用的事件响应方法存在效率低的缺陷。Therefore, the current incident response method of Web application has the defect of low efficiency.

发明内容SUMMARY OF THE INVENTION

基于此,有必要针对上述技术问题,提供一种能够提高事件响应效率的基于WEB的事件响应方法、装置、计算机设备和存储介质。Based on this, it is necessary to provide a WEB-based incident response method, apparatus, computer equipment and storage medium that can improve the efficiency of incident response in response to the above technical problems.

一种基于WEB的事件响应方法,所述方法包括:A WEB-based incident response method, the method includes:

响应于Web应用中外层组件的事件触发指令,获取事件的事件标识;Obtain the event identifier of the event in response to the event trigger instruction of the outer component in the web application;

根据所述事件标识,从预设事件表中确定对应的响应方法;所述响应方法存储于内层组件中,所述预设事件表存储有至少一组事件标识与响应方法的关联关系;According to the event identifier, the corresponding response method is determined from a preset event table; the response method is stored in the inner component, and the preset event table stores at least one set of association relationships between the event identifier and the response method;

调用所述响应方法,对所述外层组件的事件进行处理。The response method is called to process the event of the outer component.

在其中一个实施例中,所述响应于外层组件的事件触发指令,获取事件的事件标识之前,还包括:In one embodiment, before acquiring the event identifier of the event in response to the event triggering instruction of the outer component, the method further includes:

获取待关联的事件标识以及所述待关联的事件标识对应的响应方法;所述响应方法为所述内层组件中定义的方法;Obtain the event identifier to be associated and the response method corresponding to the event identifier to be associated; the response method is a method defined in the inner component;

建立所述待关联的事件标识与所述待关联的事件标识对应的响应方法的映射关系;establishing a mapping relationship between the event identifier to be associated and the response method corresponding to the event identifier to be associated;

将所述映射关系存储至待存储的事件表中,得到所述预设事件表。The mapping relationship is stored in the to-be-stored event table to obtain the preset event table.

在其中一个实施例中,所述Web应用中包括多个页面,所述预设事件表包括所述多个页面对应的事件表;In one embodiment, the Web application includes multiple pages, and the preset event table includes an event table corresponding to the multiple pages;

所述将所述映射关系存储至所述待存储的事件表中,得到所述预设事件表,包括:The storing of the mapping relationship in the to-be-stored event table to obtain the preset event table includes:

将所述映射关系存储至当前页面对应的待存储的事件表中;所述当前页面为所述待关联的事件标识对应的外层组件所在的页面;storing the mapping relationship in the event table to be stored corresponding to the current page; the current page is the page where the outer layer component corresponding to the event identifier to be associated is located;

根据多个页面对应的存储所述映射关系后的事件表,得到所述预设事件表。The preset event table is obtained according to the event table corresponding to the plurality of pages after the mapping relationship is stored.

在其中一个实施例中,所述将所述映射关系存储至当前页面对应的待存储的事件表中之前,包括:In one embodiment, before storing the mapping relationship in the to-be-stored event table corresponding to the current page, the method includes:

判断所述Web应用中是否存在当前页面对应的待存储的事件表;Determine whether there is an event table to be stored corresponding to the current page in the Web application;

若否,根据所述当前页面的特征信息,建立对应的待存储的事件表,得到所述当前页面对应的待存储的事件表。If not, according to the feature information of the current page, a corresponding to-be-stored event table is established, and the to-be-stored event table corresponding to the current page is obtained.

在其中一个实施例中,所述根据所述当前页面的特征信息,建立对应的待存储的事件表,包括:In one embodiment, the establishment of a corresponding event table to be stored according to the feature information of the current page includes:

根据所述当前页面的页面路由或页面名称,建立对应的待存储的事件表。According to the page route or page name of the current page, a corresponding to-be-stored event table is established.

在其中一个实施例中,所述根据所述事件标识,从预设事件表中确定对应的响应方法之前,还包括:In one embodiment, before determining the corresponding response method from the preset event table according to the event identifier, the method further includes:

判断所述预设事件表中是否存在所述外层组件所在的页面对应的事件表;Judging whether there is an event table corresponding to the page where the outer layer component is located in the preset event table;

若是,根据所述事件标识,从所述页面对应的事件表中,确定对应的响应方法;If so, according to the event identifier, determine the corresponding response method from the event table corresponding to the page;

若否,结束响应所述事件。If not, end responding to the event.

在其中一个实施例中,所述响应方法为钩子方法;In one of the embodiments, the response method is a hook method;

所述根据所述事件标识,从所述页面对应的事件表中,确定对应的响应方法,包括:According to the event identifier, from the event table corresponding to the page, determine the corresponding response method, including:

判断所述页面对应的事件表中,所述事件标识对应的钩子方法是否存在;Determine whether the hook method corresponding to the event identifier exists in the event table corresponding to the page;

若是,将所述事件标识对应的钩子方法作为所述响应方法;If so, use the hook method corresponding to the event identifier as the response method;

若否,结束响应所述事件。If not, end responding to the event.

一种基于WEB的事件响应装置,所述装置包括:A WEB-based incident response device, the device includes:

响应模块,用于响应于Web应用中外层组件的事件触发指令,获取事件的事件标识;The response module is used to obtain the event identifier of the event in response to the event trigger instruction of the outer component in the web application;

确定模块,用于根据所述事件标识,从预设事件表中确定对应的响应方法;所述响应方法存储于内层组件中,所述预设事件表存储有至少一组事件标识与响应方法的关联关系;A determination module, configured to determine a corresponding response method from a preset event table according to the event identifier; the response method is stored in the inner component, and the preset event table stores at least one set of event identifiers and response methods relationship;

处理模块,用于调用所述响应方法,对所述外层组件的事件进行处理。The processing module is used for invoking the response method to process the event of the outer component.

一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现上述的方法的步骤。A computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method when the processor executes the computer program.

一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述的方法的步骤。A computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the steps of the above-mentioned method.

上述基于WEB的事件响应方法、装置、计算机设备和存储介质,通过响应Web应用中外层组件的事件触发指令,获取事件的事件标识,根据获取的事件标识,从预设事件表中确定对应的响应方法,并调用确定的响应方法,对外层组件的事件进行处理,其中响应方法存储在内层组件中,预设事件表中存储有至少一组事件标识与响应方法的关联关系。相较于传统的通过逐级传递或者数据共享的方式,本方案可以利用预设事件表,实现在外层组件响应事件并直接调用内层组件中的响应方法对事件进行处理,从而实现了提高事件响应效率的效果。The above-mentioned WEB-based event response method, device, computer equipment and storage medium obtain the event identifier of the event by responding to the event trigger instruction of the outer layer component in the Web application, and determine the corresponding response from the preset event table according to the acquired event identifier method, and call the determined response method to process the event of the outer component, wherein the response method is stored in the inner component, and the preset event table stores at least one set of association relationship between the event identifier and the response method. Compared with the traditional method of step-by-step transmission or data sharing, this solution can use the preset event table to realize the response of the event in the outer component and directly call the response method in the inner component to process the event, thus realizing the improvement of the event. The effect of response efficiency.

附图说明Description of drawings

图1为一个实施例中基于WEB的事件响应方法的应用环境图;1 is an application environment diagram of a WEB-based event response method in one embodiment;

图2为一个实施例中基于WEB的事件响应方法的流程示意图;2 is a schematic flow chart of a WEB-based event response method in one embodiment;

图3为一个实施例中建立预设事件表步骤的流程示意图;3 is a schematic flowchart of steps of establishing a preset event table in one embodiment;

图4为另一个实施例中基于WEB的事件响应方法的流程示意图;4 is a schematic flowchart of a WEB-based event response method in another embodiment;

图5为又一个实施例中基于WEB的事件响应方法的流程示意图;5 is a schematic flowchart of a WEB-based event response method in another embodiment;

图6为一个实施例中预设事件表的结构示意图;6 is a schematic structural diagram of a preset event table in one embodiment;

图7为一个实施例中基于WEB的事件响应装置的结构框图;7 is a structural block diagram of a WEB-based event response device in one embodiment;

图8为一个实施例中计算机设备的内部结构图。FIG. 8 is a diagram of the internal structure of a computer device in one embodiment.

具体实施方式Detailed ways

为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.

本申请提供的基于WEB的事件响应方法,可以应用于如图1所示的应用环境中。终端102可以运行有Web应用,该Web应用中可以包括多层组件,例如外层组件和内层组件,终端102可以响应Web应用中外层组件的事件触发指令,获取事件的事件标识,并从预设事件表中确定对应的响应方法,从而调用响应方法对外层组件的事件进行处理。在一个实施例中,还可以包括服务器104,上述预设事件表可以存储于服务器104中,终端102可以根据事件标识从服务器104中的预设事件表中确定对应的响应方法。其中,终端102通过网络与服务器104进行通信,终端102可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备,服务器104可以用独立的服务器或者是多个服务器组成的服务器集群来实现。The WEB-based event response method provided by this application can be applied to the application environment shown in FIG. 1 . The terminal 102 may run a web application, and the web application may include multi-layer components, such as outer-layer components and inner-layer components, and the terminal 102 may respond to the event triggering instruction of the outer-layer components in the web application, obtain the event identifier of the event, and obtain the event identifier from the pre- It is assumed that the corresponding response method is determined in the event table, so that the response method is called to process the event of the outer component. In one embodiment, the server 104 may also be included, the above-mentioned preset event table may be stored in the server 104 , and the terminal 102 may determine the corresponding response method from the preset event table in the server 104 according to the event identifier. The terminal 102 communicates with the server 104 through the network. The terminal 102 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices. The server 104 can be an independent server or multiple servers. A cluster of servers is implemented.

在一个实施例中,如图2所示,提供了一种基于WEB的事件响应方法,以该方法应用于图1中的终端为例进行说明,包括以下步骤:In one embodiment, as shown in FIG. 2, a WEB-based event response method is provided, and the method is applied to the terminal in FIG. 1 as an example to illustrate, including the following steps:

步骤S202,响应于Web应用中外层组件的事件触发指令,获取事件的事件标识。Step S202, in response to the event triggering instruction of the outer layer component in the Web application, obtain the event identifier of the event.

其中,Web应用可以是一种可以通过Web访问的应用程序,程序的最大好处是用户很容易访问应用程序,用户只需要有浏览器即可,不需要再安装其他软件。一个Web应用可以包含多个页面,页面作为组件的容器,可以包含多个组件,组件可以自由组合及结合HOC嵌套,页面本身也可以相当于一个组件。其中,HOC(Higher-Order Component,高阶组件),可以是一种基于React的组合特性而形成的设计模式,是一种用于抽象和复用组件逻辑的高级技巧。实际上,HOC通过函数的形式,接收一个组件作为参数,返回一个经过改造(如添加一些抽象的、复用的逻辑)的新组件,类似于组件嵌套。React是一个起源于Facebook的用于构建用户界面的JavaScript库,具有组件化的特点。React的组件化允许开发者将UI拆分为独立的有各自状态的可复用的代码片段(组件),并对每个片段进行独立构思,通过组合或嵌套的方式完成整体UI的构建。Among them, a Web application may be an application program that can be accessed through the Web. The greatest advantage of the program is that the user can easily access the application program, and the user only needs to have a browser and does not need to install other software. A web application can contain multiple pages. As a container for components, a page can contain multiple components. Components can be freely combined and nested with HOC. The page itself can also be equivalent to a component. Among them, HOC (Higher-Order Component) can be a design pattern formed based on the compositional characteristics of React, and is an advanced technique for abstracting and reusing component logic. In fact, HOC receives a component as a parameter in the form of a function, and returns a new component that has been transformed (such as adding some abstract and reused logic), similar to component nesting. React is a JavaScript library that originated from Facebook for building user interfaces, and has the characteristics of componentization. The componentization of React allows developers to split the UI into independent reusable code fragments (components) with their own states, and independently conceive of each fragment, and complete the construction of the overall UI by combining or nesting.

在使用React进行大型Web应用开发,遇到复杂的UI设计时,为了降低开发及维护成本,开发者可以利用组件化,将UI拆分成多个独立的组件,结合HOC进行抽象,通过组合或嵌套的形式来实现。即Web应用中可以包括外层组件和内层组件,在React的多层级组件嵌套的情况下,外层组件和内层组件之间需要进行数据交互或者通信,终端102可以响应Web应用中外层组件的事件触发指令,获取该事件的事件标识。其中,事件标识可以用于表示该事件的特征信息,具体地,事件标识可以是事件名。When using React for large-scale web application development, when encountering complex UI design, in order to reduce development and maintenance costs, developers can use componentization to split the UI into multiple independent components, combine HOC for abstraction, and combine or Nested form to achieve. That is, the web application may include outer components and inner components. In the case of the multi-level component nesting of React, data interaction or communication needs to be performed between the outer components and the inner components, and the terminal 102 can respond to the inner and outer layers of the web application. The event triggering instruction of the component obtains the event ID of the event. The event identifier may be used to represent feature information of the event, and specifically, the event identifier may be an event name.

步骤S204,根据事件标识,从预设事件表中确定对应的响应方法;响应方法存储于内层组件中,预设事件表存储有至少一组事件标识与响应方法的关联关系。Step S204, according to the event identifier, determine the corresponding response method from the preset event table; the response method is stored in the inner component, and the preset event table stores at least one group of association relationships between the event identifier and the response method.

其中,事件标识可以是上述Web应用中触发的事件的标识,该事件可以是由用户触发的事件,预设事件表可以是包括多个事件标识以及每个事件标识对应的响应方法的表,预设事件表可以作为集中管理事件以及事件对应的响应方法的列表,预设事件表中可以存储有至少一组事件标识与响应方法的关联关系。具体地,该关联关系可以是以Key-value的形式注册在预设事件表中。终端102可以根据上述事件标识,从上述预设事件表中确定对应的响应方法,例如根据事件标识和响应方法的关联关系得到。The event identifier may be an identifier of an event triggered in the above-mentioned Web application, the event may be an event triggered by a user, and the preset event table may be a table including multiple event identifiers and a response method corresponding to each event identifier. It is assumed that the event table can be used as a list of centralized management events and response methods corresponding to the events, and the preset event table can store at least a set of association relationships between event identifiers and response methods. Specifically, the association relationship may be registered in the preset event table in the form of key-value. The terminal 102 may determine the corresponding response method from the above-mentioned preset event table according to the above-mentioned event identifier, for example, according to the association relationship between the event identifier and the response method.

步骤S206,调用响应方法,对外层组件的事件进行处理。Step S206, calling the response method to process the event of the outer component.

其中,响应方法可以是存储于内层组件中,与上述事件标识对应的响应方法,响应方法可以是根据实际情况设定的,不同的事件可以有不同的响应方法。终端102可以在上述预设事件表搜索与事件标识关联的响应方法,并调用该响应方法,对外层组件的事件进行处理。其中,上述响应方法可以存储于内层组件中,上述事件可以是外层组件触发的事件,即终端102可以利用上述预设事件表,在外层组件响应事件,通过预设事件表直接调用内层组件的响应方法,并处理相应的事件。The response method may be a response method stored in the inner component and corresponding to the above event identifier, the response method may be set according to the actual situation, and different events may have different response methods. The terminal 102 may search the above preset event table for a response method associated with the event identifier, and call the response method to process the event of the outer component. The above-mentioned response method may be stored in the inner-layer component, and the above-mentioned event may be an event triggered by the outer-layer component, that is, the terminal 102 may use the above-mentioned preset event table, respond to the event in the outer-layer component, and directly call the inner-layer component through the preset event table. The component's response method and handle the corresponding event.

上述基于WEB的事件响应方法中,通过响应Web应用中外层组件的事件触发指令,获取事件的事件标识,根据获取的事件标识,从预设事件表中确定对应的响应方法,并调用确定的响应方法,对外层组件的事件进行处理,其中响应方法存储在内层组件中,预设事件表中存储有至少一组事件标识与响应方法的关联关系。相较于传统的通过逐级传递或者数据共享的方式,本方案可以利用预设事件表,实现在外层组件响应事件并直接调用内层组件中的响应方法对事件进行处理,从而实现了提高事件响应效率的效果。In the above-mentioned WEB-based event response method, the event identifier of the event is obtained by responding to the event trigger instruction of the outer layer component in the Web application, and the corresponding response method is determined from the preset event table according to the acquired event identifier, and the determined response is called. The method is used to process the event of the outer layer component, wherein the response method is stored in the inner layer component, and the preset event table stores the association relationship between at least one group of event identifiers and the response method. Compared with the traditional method of step-by-step transmission or data sharing, this solution can use the preset event table to realize the response of the event in the outer component and directly call the response method in the inner component to process the event, thus realizing the improvement of the event. The effect of response efficiency.

在一个实施例中,响应于外层组件的事件触发指令,获取事件的事件标识之前,还包括:获取待关联的事件标识以及待关联的事件标识对应的响应方法;响应方法为内层组件中定义的方法;建立待关联的事件标识与待关联的事件标识对应的响应方法的映射关系;将映射关系存储至待存储的事件表中,得到预设事件表。In one embodiment, before acquiring the event identifier of the event in response to the event triggering instruction of the outer component, the method further includes: acquiring the event identifier to be associated and a response method corresponding to the event identifier to be associated; the response method is in the inner component A defined method; establishing a mapping relationship between an event identifier to be associated and a response method corresponding to the event identifier to be associated; storing the mapping relationship in an event table to be stored to obtain a preset event table.

本实施例中,待关联的事件标识可以是尚未与其对应的响应方法建立关联关系的事件标识,每种事件可以对应一种响应方法,即触发该事件时,终端102可以利用该响应方法处理该事件,待关联的事件标识可以有多种。终端102可以在响应于外层组件的事件触发指令前,建立上述预设事件表。终端102可以获取待关联的事件标识,以及该待关联的事件标识对应的响应方法,其中响应方法可以在内层组件中定义,终端102可以建立待关联的事件标识以及该待关联的事件标识对应的响应方法之间的映射关系,并将该映射关系存储至待存储的事件表中,得到上述预设事件表。In this embodiment, the event identifier to be associated may be an event identifier that has not yet been associated with its corresponding response method, and each event may correspond to a response method, that is, when the event is triggered, the terminal 102 can use the response method to process the event. Events, there can be multiple event identifiers to be associated. The terminal 102 may establish the above-mentioned preset event table before responding to the event triggering instruction of the outer component. The terminal 102 can obtain the event identifier to be associated, and the response method corresponding to the event identifier to be associated, wherein the response method can be defined in the inner component, and the terminal 102 can establish the event identifier to be associated and the event identifier to be associated. The mapping relationship between the response methods is stored, and the mapping relationship is stored in the event table to be stored to obtain the above-mentioned preset event table.

具体地,组件的生命周期可以包含三个阶段,其中初始阶段为挂载(Mounting),在此阶段,内外层组件依次执行初始化构造,上述响应方法可以在内层组件中定义,在初始化构造时,终端102可以将自定义的响应方法通过相应的调用事件添加方法注册到上述待存储的事件表中,例如可以以上述事件标识为key,事件的响应方法为value,建立事件标识与响应方法的映射关系,并可以将形成的key-value映射关系存储至上述待存储的事件表中,从而得到上述预设事件表。Specifically, the life cycle of a component can include three stages, of which the initial stage is Mounting. In this stage, the inner and outer components perform initialization construction in turn. The above response method can be defined in the inner component. , the terminal 102 can register the self-defined response method in the above-mentioned event table to be stored through the corresponding invocation event adding method, for example, the above-mentioned event identifier can be used as the key, the response method of the event can be the value, and the relationship between the event identifier and the response method can be established. The mapping relationship can be stored, and the formed key-value mapping relationship can be stored in the above-mentioned event table to be stored, so as to obtain the above-mentioned preset event table.

通过本实施例,终端102可以利用事件标识和响应方法的映射关系建立预设事件表,从而可以利用该预设事件表对相应事件进行响应和处理,提高了事件响应的效率。Through this embodiment, the terminal 102 can use the mapping relationship between the event identifier and the response method to establish a preset event table, so that the preset event table can be used to respond to and process corresponding events, thereby improving the efficiency of event response.

在一个实施例中,将映射关系存储至待存储的事件表中,得到预设事件表,包括:将映射关系存储至当前页面对应的待存储的事件表中;当前页面为待关联的事件标识对应的外层组件所在的页面;根据多个页面对应的存储映射关系后的事件表,得到预设事件表。In one embodiment, storing the mapping relationship in the event table to be stored to obtain a preset event table includes: storing the mapping relationship in the event table to be stored corresponding to the current page; the current page is the event identifier to be associated The page where the corresponding outer component is located; the preset event table is obtained according to the event table corresponding to the plurality of pages after storing the mapping relationship.

本实施例中,上述Web应用中可以包括多个页面,上述预设事件表可以包括多个页面对应的事件表,终端102可以将上述事件标识与响应方法的映射关系存储至待存储的事件表中,从而得到上述预设事件表。具体地,终端102可以将上述映射关系存储至当前页面对应的待存储的事件表中。其中,当前页面为上述待关联的事件标识对应的外层组件所在的页面,页面与待存储的事件表之间也可以通过建立映射关系的方式形成关联,例如通过key-value形式的映射关系形成关联,具体地,可以以页面的特征信息如页面名称或页面路由为key,页面对应的待存储的事件表为value,建立页面与待存储的事件表的映射关系;不同页面对应的事件表中可以存储有相同事件对应的事件标识与响应方法的关联关系,并且对于同一种事件,在不同页面组件的事件列表中均有唯一且固定的事件标识,例如事件名,作为key,命名统一,便于复用,降低开发及维护成本。In this embodiment, the web application may include multiple pages, the preset event table may include event tables corresponding to the multiple pages, and the terminal 102 may store the mapping relationship between the event identifier and the response method in the event table to be stored , so as to obtain the above-mentioned preset event table. Specifically, the terminal 102 may store the above mapping relationship in the to-be-stored event table corresponding to the current page. The current page is the page where the outer component corresponding to the event identifier to be associated is located, and the page and the event table to be stored can also be associated by establishing a mapping relationship, for example, a mapping relationship in the form of key-value. Specifically, the feature information of the page, such as page name or page route, can be used as the key, and the event table to be stored corresponding to the page is used as the value, and the mapping relationship between the page and the event table to be stored can be established; in the event table corresponding to different pages The association relationship between the event identifier and the response method corresponding to the same event can be stored, and for the same event, there are unique and fixed event identifiers in the event lists of different page components, such as the event name, as the key, the naming is unified, which is convenient for Reuse, reduce development and maintenance costs.

通过本实施例,终端102可以建立包括多个页面对应的事件表的预设事件表,从而可以实现利用预设事件表对不同页面中的事件进行响应和处理,提高了事件响应的效率。Through this embodiment, the terminal 102 can establish a preset event table including event tables corresponding to multiple pages, so that the preset event table can be used to respond and process events in different pages, thereby improving the efficiency of event response.

在一个实施例中,将映射关系存储至当前页面对应的待存储的事件表中之前,包括:判断Web应用中是否存在当前页面对应的待存储的事件表;若否,根据当前页面的特征信息,建立对应的待存储的事件表,得到当前页面对应的待存储的事件表。In one embodiment, before storing the mapping relationship in the event table to be stored corresponding to the current page, it includes: judging whether there is an event table to be stored corresponding to the current page in the Web application; if not, according to the feature information of the current page , establish a corresponding to-be-stored event table, and obtain a to-be-stored event table corresponding to the current page.

本实施例中,终端102可以在将上述映射关系存储至当前页面对应的待存储的事件表之前,首先检测并判断Web应用中的待存储事件表中是否存在当前页面对应的待存储的事件表,并根据判断结果进行相应处理。若判断结果为是,则终端102可以将上述事件标识与响应方法的映射关系存储至当前页面对应的待存储的事件表中;若判断结果为否,则终端102可以获取当前页面的相应特征信息,并根据获取的页面的特征信息,建立对应的待存储的事件表,得到当前页面对应的待存储的事件表。具体地,上述页面的特征信息可以是页面路由或页面名称;终端102可以在存储上述事件标识与响应方法的映射关系前,用上述事件标识对应的外层组件所在的页面的key,检索value,即检索是否有当前页面对应的待存储的事件表map,若检索到则终端102可以往该待存储的事件表中存储上述事件标识与响应方法的映射关系,若检索不到,则终端102可以以当前页面路由或页面组件名作为key,新建当前页面对应的待存储的事件表,并将上述事件标识与响应方法的映射关系作为映射对象,插入存储至针对当前页面新建的待存储的事件表中。In this embodiment, the terminal 102 may first detect and determine whether there is an event table to be stored corresponding to the current page in the event table to be stored in the Web application before storing the above mapping relationship in the event table to be stored corresponding to the current page , and perform corresponding processing according to the judgment result. If the judgment result is yes, the terminal 102 can store the mapping relationship between the above-mentioned event identifier and the response method in the to-be-stored event table corresponding to the current page; if the judgment result is no, the terminal 102 can obtain the corresponding feature information of the current page , and establish a corresponding event table to be stored according to the acquired feature information of the page, and obtain the event table to be stored corresponding to the current page. Specifically, the feature information of the above-mentioned page may be a page route or a page name; before storing the mapping relationship between the above-mentioned event identifier and the response method, the terminal 102 may use the key of the page where the outer layer component corresponding to the above-mentioned event identifier is located to retrieve the value, That is, it is searched whether there is an event table map to be stored corresponding to the current page. If it is retrieved, the terminal 102 can store the mapping relationship between the above-mentioned event identifier and the response method in the event table to be stored. If it cannot be retrieved, the terminal 102 can Using the current page route or page component name as the key, create a new event table to be stored corresponding to the current page, and use the mapping relationship between the above event identifier and the response method as the mapping object, insert and store it into the new event table to be stored for the current page middle.

在一个实施例中,如图3所示,图3为一个实施例中建立预设事件表步骤的流程示意图。本实施例中,在包括上述对当前页面的待存储的事件表进行检测的步骤时,建立预设事件表的流程可以如图3所示,终端102可以首先对内层组件进行初始化构造,即定义每种事件对应的响应方法,还可以调用全局事件管理对象的事件添加方法,将上述响应方法注册至预设事件表中,具体地,上述响应方法可以是钩子事件的响应方法,终端102可以以钩子事件的事件标识,例如事件名,作为key,事件的响应方法作为value,建立事件标识和响应方法的映射关系,并在存储至相应的事件表前,用上述事件标识对应的外层组件所在的页面的相应特征,在全局事件表,即多个待存储的事件表中检索当前页面对应的待存储的事件表,即当前页面的事件列表map是否存在,若是,则终端102可以将新建的上述事件标识与响应方法的映射关系插入至上述当前页面对应的待存储的事件表中;若否,终端102可以按照当前页面的相应特征形成key,新建当前页面对应的待存储的事件表,从而可以将上述事件标识与响应方法的映射关系存储至针对当前页面新建的待存储的事件表中。In one embodiment, as shown in FIG. 3 , FIG. 3 is a schematic flowchart of steps of establishing a preset event table in one embodiment. In this embodiment, when the above-mentioned step of detecting the event table to be stored on the current page is included, the process of establishing the preset event table may be as shown in FIG. Define the response method corresponding to each event, and also call the event adding method of the global event management object, and register the above-mentioned response method in the preset event table. Specifically, the above-mentioned response method can be the response method of the hook event, and the terminal 102 can The event identifier of the hook event, such as the event name, is used as the key, and the response method of the event is used as the value to establish the mapping relationship between the event identifier and the response method, and before storing in the corresponding event table, use the above event to identify the corresponding outer component The corresponding feature of the page where it is located is searched in the global event table, that is, a plurality of event tables to be stored, for the event table to be stored corresponding to the current page, that is, whether the event list map of the current page exists, and if so, the terminal 102 can create a new The mapping relationship between the above-mentioned event identifier and the response method is inserted into the to-be-stored event table corresponding to the above-mentioned current page; if not, the terminal 102 can form a key according to the corresponding feature of the current page, and create a new to-be-stored event table corresponding to the current page, Therefore, the mapping relationship between the above-mentioned event identifier and the response method can be stored in the newly created event table to be stored for the current page.

通过上述实施例,终端102可以在存储上述事件标识与响应方法的映射关系前确定当前页面对应的待存储的事件表是否存在,并且可以基于当前页面的相关特征信息建立当前页面对应的待存储的事件表,从而可以利用相应页面的事件表,通过上述事件标识调用响应方法,实现提高事件响应效率的效果。Through the above embodiment, the terminal 102 can determine whether the to-be-stored event table corresponding to the current page exists before storing the above-mentioned mapping relationship between the event identifier and the response method, and can establish the to-be-stored corresponding to the current page based on the relevant feature information of the current page. The event table is used, so that the event table of the corresponding page can be used to call the response method through the above-mentioned event identifier, so as to achieve the effect of improving the efficiency of the event response.

在一个实施例中,根据事件标识,从预设事件表中确定对应的响应方法之前,还包括:判断预设事件表中是否存在外层组件所在的页面对应的事件表;若是,根据事件标识,从页面对应的事件表中,确定对应的响应方法;若否,结束响应事件。In one embodiment, before determining the corresponding response method from the preset event table according to the event identifier, the method further includes: judging whether there is an event table corresponding to the page where the outer component is located in the preset event table; if so, according to the event identifier , determine the corresponding response method from the event table corresponding to the page; if not, end the response event.

本实施例中,终端102可以在利用上述预设事件表确定上述事件标识对应的响应方法前,对上述预设事件表中是否存在外层组件所在的页面对应的事件表进行判断,即判断预设事件表中是否存在上述外层组件所在的页面对应的事件表,并根据判断结果,进行相应的处理,若判断结果为是,则终端102可以根据上述事件标识,从上述外层组件所在的页面对应的事件表中,确定对应的响应方法;若判断结果为否,则终端102可以结束响应上述事件。其中,上述外层组件可以是上述事件标识对应的外层组件。In this embodiment, the terminal 102 may, before using the preset event table to determine the response method corresponding to the event identifier, determine whether there is an event table corresponding to the page where the outer component is located in the preset event table, that is, determine whether the preset event table corresponds to the page where the outer component is located. Assume whether there is an event table corresponding to the page where the above-mentioned outer layer component is located in the event table, and perform corresponding processing according to the judgment result, if the judgment result is yes, then the terminal 102 can, according to the above-mentioned event identifier, from the above-mentioned outer layer component is located. In the event table corresponding to the page, the corresponding response method is determined; if the determination result is no, the terminal 102 may end responding to the above event. Wherein, the above-mentioned outer-layer component may be an outer-layer component corresponding to the above-mentioned event identifier.

具体地,终端102可以在确定事件标识对应的响应方法前,利用外层组件所在的页面的key,从全局事件表map,即预设事件表中,检索上述页面对应的事件表map是否存在,从而根据判断结果执行相应的处理。Specifically, before determining the response method corresponding to the event identifier, the terminal 102 can use the key of the page where the outer component is located to retrieve whether the event table map corresponding to the above page exists from the global event table map, that is, the preset event table, Accordingly, corresponding processing is performed according to the judgment result.

通过本实施例,终端102可以在获取事件标识对应的响应方法前,判断预设事件表中是否存在当前页面对应的事件表,并且可以在判断为是时,从当前页面对应的事件表中确定对应的响应方法,从而提高了事件响应的效率。Through this embodiment, the terminal 102 can determine whether there is an event table corresponding to the current page in the preset event table before acquiring the response method corresponding to the event identifier, and can determine from the event table corresponding to the current page when the determination is yes Corresponding response methods, thereby improving the efficiency of incident response.

在一个实施例中,根据事件标识,从页面对应的事件表中,确定对应的响应方法,包括:判断页面对应的事件表中,事件标识对应的钩子方法是否存在;若是,将事件标识对应的钩子方法作为响应方法;若否,结束响应事件。In one embodiment, determining the corresponding response method from the event table corresponding to the page according to the event identifier includes: judging whether the hook method corresponding to the event identifier exists in the event table corresponding to the page; The hook method is used as the response method; if not, the response event is ended.

本实施例中,上述响应方法为钩子方法,终端102可以在确定上述预设事件表中存在当前页面对应的事件表时,从当前页面对应的事件表中确定上述事件标识对应的响应方法。终端102可以判断当前页面对应的事件表中,上述事件标识对应的响应方法,即钩子方法,是否存在,并根据判断结果进行相应的处理。若判断结果为是,终端102可以将上述事件标识对应的钩子方法作为上述响应方法;若判断结果为否,则终端102可以结束响应上述事件。其中,钩子方法可以由抽象类声明并且实现,子类也可以选择加以扩展,通常抽象类会给出一个空的钩子方法,也就是没有实现的扩展,它和具体方法在代码上没有区别,不过是一种意识的区别;而它和抽象方法有时候也是没有区别的,就是在子类都需要将其实现的时候,而不同的是抽象方法必须实现,而钩子方法可以不实现,也就是说钩子方法为你在实现某一个抽象类的时候提供了可选项,相当于预先提供了一个默认配置。In this embodiment, the above-mentioned response method is a hook method, and the terminal 102 may determine a response method corresponding to the above-mentioned event identifier from the event table corresponding to the current page when determining that there is an event table corresponding to the current page in the above-mentioned preset event table. The terminal 102 can determine whether the response method corresponding to the above event identifier, that is, the hook method, exists in the event table corresponding to the current page, and perform corresponding processing according to the determination result. If the determination result is yes, the terminal 102 may use the hook method corresponding to the above event identifier as the above response method; if the determination result is no, the terminal 102 may end responding to the above event. Among them, the hook method can be declared and implemented by the abstract class, and the subclass can also choose to extend it. Usually the abstract class will give an empty hook method, that is, the extension without implementation. It is no different from the specific method in code, but It is a difference of consciousness; and it is sometimes indistinguishable from abstract methods, that is, when subclasses need to implement them, the difference is that abstract methods must be implemented, while hook methods can not be implemented, that is to say The hook method provides options when you implement an abstract class, which is equivalent to providing a default configuration in advance.

具体地,终端102可以利用当前事件标识,即钩子key,从当前页面对应的事件表中检索钩子方法是否存在,并根据检索结果对上述事件进行相应的处理。Specifically, the terminal 102 can use the current event identifier, that is, the hook key, to retrieve whether the hook method exists from the event table corresponding to the current page, and perform corresponding processing on the above event according to the retrieval result.

通过本实施例,终端102可以对事件标识对应的钩子方法是否存在进行判断,并在判断为是时,将上述事件标识对应的钩子方法作为响应方法,从而提高了事件响应的效率。Through this embodiment, the terminal 102 can determine whether the hook method corresponding to the event identifier exists, and when the determination is yes, use the hook method corresponding to the event identifier as the response method, thereby improving the efficiency of event response.

在一个实施例中,如图4所示,图4为另一个实施例中基于WEB的事件响应方法的流程示意图。本实施例中,终端102可以首先对各层组件进行初始化构造,例如在内层组件中,可以定义钩子对应的响应方法,并以key-value形式将事件标识与响应方法的关联关系存储至全局事件管理对象中的预设事件表中,其中全局事件管理对象中还包括事件增删方法、判断事件是否存在的方法等,当外层组件监听到相应的事件触发时,可以利用触发的事件的key,从预设事件表中调用相应的钩子响应方法。In one embodiment, as shown in FIG. 4 , FIG. 4 is a schematic flowchart of a WEB-based event response method in another embodiment. In this embodiment, the terminal 102 can firstly initialize the components of each layer. For example, in the inner layer components, a response method corresponding to the hook can be defined, and the association relationship between the event identifier and the response method can be stored in the global in the form of key-value. In the preset event table in the event management object, the global event management object also includes the method of adding and deleting events, the method of judging whether the event exists, etc. When the outer component listens to the corresponding event trigger, it can use the key of the triggered event. , call the corresponding hook response method from the preset event table.

具体地,在一个实施例中,上述外层组件监听并调用响应方法的具体流程可以如图5所示,图5为又一个实施例中基于WEB的事件响应方法的流程示意图。终端102可以在Web应用中,当前页面的外层组件监听钩子事件触发指令,并利用上述全局事件管理对象判断事件是否存在的方法,判断事件是否存在。具体地,可以利用当前页面key,从上述预设事件表中检索当前页面对应的事件表是否存在,并在判断为否时结束响应该事件,在判断为是时,用当前事件标识,即当前钩子key,从上述当前页面对应的事件表中,检索钩子响应方法是否存在,并在判断为否时,结束响应该事件,在判断为是时,执行得到的钩子方法。Specifically, in one embodiment, the specific flow of the above-mentioned outer component monitoring and invoking the response method may be as shown in FIG. 5 , which is a schematic flow diagram of a WEB-based event response method in another embodiment. The terminal 102 may, in the Web application, the outer component of the current page listen to the hook event triggering instruction, and judge whether the event exists by using the above-mentioned method of the global event management object to judge whether the event exists. Specifically, the current page key can be used to retrieve whether the event table corresponding to the current page exists from the above-mentioned preset event table, and when it is judged to be no, the response to the event is ended. The hook key, from the event table corresponding to the current page, retrieves whether the hook response method exists, and when it is judged to be no, ends responding to the event, and when it is judged to be yes, executes the obtained hook method.

在一个实施例中,上述全局事件管理对象、预设事件表、页面对应的事件表以及响应方法之间的结构可以如图6所示,图6为一个实施例中预设事件表的结构示意图。本实施例中,终端102可以定义一个全局事件管理对象,用于集中管理各页面组件共享的事件,其主要包含4个部分:一个用于维护事件列表的map,即上述预设事件表、添加事件的方法、删除事件的方法,以及判断事件是否存在的方法;其中预设事件表中可以使用页面路由或页面组件名作为key,value为key所对应的页面下所有事件表,这些事件表中可以包括以事件名作key,value为具体事件响应方法的事件名与响应方法的关联关系。需要特别说明的是,同一种事件使用的key相同,如下图页面1和页面2都有定义对事件A的响应处理、页面1和页面3都有定义对事件B的响应处理。对于同一种事件,在不同页面组件的事件列表中均有唯一且固定的事件名(React组件固定的钩子事件名)作key,命名统一,一一对应相应的钩子事件,便于复用,降低开发及维护成本。In one embodiment, the structure among the global event management object, the preset event table, the event table corresponding to the page, and the response method may be as shown in FIG. 6 , which is a schematic structural diagram of the preset event table in one embodiment . In this embodiment, the terminal 102 may define a global event management object for centrally managing events shared by each page component, which mainly includes four parts: a map for maintaining the event list, that is, the above-mentioned preset event table, adding The method of the event, the method of deleting the event, and the method of judging whether the event exists; in the preset event table, the page route or page component name can be used as the key, and the value is all the event tables under the page corresponding to the key. It can include the event name as the key and the value as the association relationship between the event name and the response method of the specific event response method. It should be noted that the same event uses the same key. As shown in the figure below, page 1 and page 2 both define response processing to event A, and page 1 and page 3 both define response processing to event B. For the same event, there is a unique and fixed event name (the fixed hook event name of the React component) in the event list of different page components as the key, the naming is unified, and the corresponding hook events correspond one-to-one, which is convenient for reuse and reduces development. and maintenance costs.

通过上述实施例,终端102可以在Web应用中,在外层组件事件触发时,利用预设事件表,调用与事件标识对应的内层组件中的响应方法,对外层组件触发的事件进行处理,从而可以提高事件响应的效率。Through the above embodiment, the terminal 102 can use the preset event table to call the response method in the inner component corresponding to the event identifier when the event of the outer component is triggered in the Web application, and process the event triggered by the outer component, thereby Can improve the efficiency of incident response.

应该理解的是,虽然图2-图5的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图2-图5中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the steps in the flowcharts of FIGS. 2-5 are sequentially displayed according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited to the order, and these steps may be performed in other orders. Moreover, at least a part of the steps in FIG. 2-FIG. 5 may include multiple steps or multiple stages. These steps or stages are not necessarily executed and completed at the same time, but may be executed at different times. The order of execution is also not necessarily sequential, but may be performed alternately or alternately with other steps or at least a portion of the steps or stages within the other steps.

在一个实施例中,如图7所示,提供了一种基于WEB的事件响应装置,包括:响应模块500、确定模块504和处理模块506,其中:In one embodiment, as shown in FIG. 7, a WEB-based event response apparatus is provided, including: a response module 500, a determination module 504 and a processing module 506, wherein:

响应模块500,用于响应于Web应用中外层组件的事件触发指令,获取事件的事件标识。The response module 500 is configured to acquire the event identifier of the event in response to the event triggering instruction of the outer layer component in the Web application.

确定模块504,用于根据事件标识,从预设事件表中确定对应的响应方法;响应方法存储于内层组件中,预设事件表存储有至少一组事件标识与响应方法的关联关系。The determining module 504 is configured to determine a corresponding response method from a preset event table according to the event identifier; the response method is stored in the inner component, and the preset event table stores at least one set of association relationships between the event identifier and the response method.

处理模块506,用于调用响应方法,对外层组件的事件进行处理。The processing module 506 is used for invoking the response method to process the event of the outer component.

在一个实施例中,上述装置还包括:建立模块,用于获取待关联的事件标识以及待关联的事件标识对应的响应方法;响应方法为内层组件中定义的方法;建立待关联的事件标识与待关联的事件标识对应的响应方法的映射关系;将映射关系存储至待存储的事件表中,得到预设事件表。In one embodiment, the above-mentioned device further includes: an establishment module for acquiring the event identifier to be associated and a response method corresponding to the event identifier to be associated; the response method is a method defined in an inner component; establishing the event identifier to be associated The mapping relationship of the response method corresponding to the event identifier to be associated; the mapping relationship is stored in the event table to be stored to obtain a preset event table.

在一个实施例中,上述建立模块,具体用于将映射关系存储至当前页面对应的待存储的事件表中;当前页面为待关联的事件标识对应的外层组件所在的页面;根据多个页面对应的存储映射关系后的事件表,得到预设事件表。In one embodiment, the above-mentioned establishment module is specifically used to store the mapping relationship in the event table to be stored corresponding to the current page; the current page is the page where the outer layer component corresponding to the event identifier to be associated is located; The corresponding event table after the mapping relationship is stored to obtain a preset event table.

在一个实施例中,上述装置还包括:第一判断模块,用于判断Web应用中是否存在当前页面对应的待存储的事件表;若否,根据当前页面的特征信息,建立对应的待存储的事件表,得到当前页面对应的待存储的事件表。In one embodiment, the above-mentioned device further includes: a first judging module for judging whether there is an event table to be stored corresponding to the current page in the Web application; Event table, to obtain the event table to be stored corresponding to the current page.

在一个实施例中,上述第一判断模块,具体用于根据当前页面的页面路由或页面名称,建立对应的待存储的事件表。In one embodiment, the above-mentioned first judgment module is specifically configured to establish a corresponding to-be-stored event table according to the page route or page name of the current page.

在一个实施例中,上述装置还包括:第二判断模块,用于判断预设事件表中是否存在外层组件所在的页面对应的事件表;若是,根据事件标识,从页面对应的事件表中,确定对应的响应方法;若否,结束响应事件。In one embodiment, the above-mentioned device further includes: a second judgment module for judging whether there is an event table corresponding to the page where the outer component is located in the preset event table; if so, according to the event identifier, from the event table corresponding to the page , determine the corresponding response method; if not, end the response event.

在一个实施例中,上述装置还包括:第三判断模块,用于判断页面对应的事件表中,事件标识对应的钩子方法是否存在;若是,将事件标识对应的钩子方法作为响应方法;若否,结束响应事件。In one embodiment, the above-mentioned device further includes: a third judgment module for judging whether the hook method corresponding to the event identifier exists in the event table corresponding to the page; if so, the hook method corresponding to the event identifier is used as the response method; if not , to end the response event.

关于基于WEB的事件响应装置的具体限定可以参见上文中对于基于WEB的事件响应方法的限定,在此不再赘述。上述基于WEB的事件响应装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For the specific limitation of the WEB-based event response apparatus, reference may be made to the limitation of the WEB-based event response method above, which will not be repeated here. Each module in the above-mentioned WEB-based incident response device can be implemented in whole or in part by software, hardware and combinations thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

在一个实施例中,提供了一种计算机设备,该计算机设备可以是终端,其内部结构图可以如图8所示。该计算机设备包括通过系统总线连接的处理器、存储器、通信接口、显示屏和输入装置。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的通信接口用于与外部的终端进行有线或无线方式的通信,无线方式可通过WIFI、运营商网络、NFC(近场通信)或其他技术实现。该计算机程序被处理器执行时以实现一种基于WEB的事件响应方法。该计算机设备的显示屏可以是液晶显示屏或者电子墨水显示屏,该计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。In one embodiment, a computer device is provided, and the computer device may be a terminal, and its internal structure diagram may be as shown in FIG. 8 . The computer equipment includes a processor, memory, a communication interface, a display screen, and an input device connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium, an internal memory. The nonvolatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the execution of the operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for wired or wireless communication with an external terminal, and the wireless communication can be realized by WIFI, operator network, NFC (Near Field Communication) or other technologies. The computer program implements a WEB-based event response method when executed by the processor. The display screen of the computer equipment may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment may be a touch layer covered on the display screen, or a button, a trackball or a touchpad set on the shell of the computer equipment , or an external keyboard, trackpad, or mouse.

本领域技术人员可以理解,图8中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in FIG. 8 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied. Include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.

在一个实施例中,提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现如上述的基于WEB的事件响应方法。In one embodiment, a computer device is provided, including a memory and a processor, a computer program is stored in the memory, and the processor implements the above-mentioned WEB-based event response method when the computer program is executed.

在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现如上述的基于WEB的事件响应方法。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, implements the above-mentioned WEB-based event response method.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-Only Memory,ROM)、磁带、软盘、闪存或光存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic Random Access Memory,DRAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage In the medium, when the computer program is executed, it may include the processes of the above-mentioned method embodiments. Wherein, any reference to memory, storage, database or other media used in the various embodiments provided in this application may include at least one of non-volatile and volatile memory. The non-volatile memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, and the like. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, the RAM may be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM).

以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, all It is considered to be the range described in this specification.

以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several embodiments of the present application, and the descriptions thereof are relatively specific and detailed, but should not be construed as a limitation on the scope of the invention patent. It should be noted that, for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the scope of protection of the patent of the present application shall be subject to the appended claims.

Claims (10)

1.一种基于WEB的事件响应方法,其特征在于,所述方法包括:1. A WEB-based incident response method, wherein the method comprises: 响应于Web应用中外层组件的事件触发指令,获取事件的事件标识;Obtain the event identifier of the event in response to the event trigger instruction of the outer component in the web application; 根据所述事件标识,从预设事件表中确定对应的响应方法;所述响应方法存储于内层组件中,所述预设事件表存储有至少一组事件标识与响应方法的关联关系;According to the event identifier, the corresponding response method is determined from a preset event table; the response method is stored in the inner component, and the preset event table stores at least one set of association relationships between the event identifier and the response method; 调用所述响应方法,对所述外层组件的事件进行处理。The response method is called to process the event of the outer component. 2.根据权利要求1所述的方法,其特征在于,所述响应于外层组件的事件触发指令,获取事件的事件标识之前,还包括:2. The method according to claim 1, wherein, before acquiring the event identifier of the event in response to the event triggering instruction of the outer component, the method further comprises: 获取待关联的事件标识以及所述待关联的事件标识对应的响应方法;所述响应方法为所述内层组件中定义的方法;Obtain the event identifier to be associated and the response method corresponding to the event identifier to be associated; the response method is a method defined in the inner component; 建立所述待关联的事件标识与所述待关联的事件标识对应的响应方法的映射关系;establishing a mapping relationship between the event identifier to be associated and the response method corresponding to the event identifier to be associated; 将所述映射关系存储至待存储的事件表中,得到所述预设事件表。The mapping relationship is stored in the to-be-stored event table to obtain the preset event table. 3.根据权利要求2所述的方法,其特征在于,所述Web应用中包括多个页面,所述预设事件表包括所述多个页面对应的事件表;3. The method according to claim 2, wherein the Web application comprises a plurality of pages, and the preset event table comprises an event table corresponding to the plurality of pages; 所述将所述映射关系存储至所述待存储的事件表中,得到所述预设事件表,包括:The storing of the mapping relationship in the to-be-stored event table to obtain the preset event table includes: 将所述映射关系存储至当前页面对应的待存储的事件表中;所述当前页面为所述待关联的事件标识对应的外层组件所在的页面;storing the mapping relationship in the event table to be stored corresponding to the current page; the current page is the page where the outer layer component corresponding to the event identifier to be associated is located; 根据多个页面对应的存储所述映射关系后的事件表,得到所述预设事件表。The preset event table is obtained according to the event table corresponding to the plurality of pages after the mapping relationship is stored. 4.根据权利要求3所述的方法,其特征在于,所述将所述映射关系存储至当前页面对应的待存储的事件表中之前,包括:4. The method according to claim 3, wherein before storing the mapping relationship in the event table to be stored corresponding to the current page, comprising: 判断所述Web应用中是否存在当前页面对应的待存储的事件表;Determine whether there is an event table to be stored corresponding to the current page in the Web application; 若否,根据所述当前页面的特征信息,建立对应的待存储的事件表,得到所述当前页面对应的待存储的事件表。If not, according to the feature information of the current page, a corresponding to-be-stored event table is established, and the to-be-stored event table corresponding to the current page is obtained. 5.根据权利要求4所述的方法,其特征在于,所述根据所述当前页面的特征信息,建立对应的待存储的事件表,包括:5. The method according to claim 4, wherein, establishing a corresponding event table to be stored according to the feature information of the current page, comprising: 根据所述当前页面的页面路由或页面名称,建立对应的待存储的事件表。According to the page route or page name of the current page, a corresponding to-be-stored event table is established. 6.根据权利要求3所述的方法,其特征在于,所述根据所述事件标识,从预设事件表中确定对应的响应方法之前,还包括:6. The method according to claim 3, wherein, before determining the corresponding response method from the preset event table according to the event identifier, further comprising: 判断所述预设事件表中是否存在所述外层组件所在的页面对应的事件表;Judging whether there is an event table corresponding to the page where the outer layer component is located in the preset event table; 若是,根据所述事件标识,从所述页面对应的事件表中,确定对应的响应方法;If so, according to the event identifier, determine the corresponding response method from the event table corresponding to the page; 若否,结束响应所述事件。If not, end responding to the event. 7.根据权利要求6所述的方法,其特征在于,所述响应方法为钩子方法;7. The method according to claim 6, wherein the response method is a hook method; 所述根据所述事件标识,从所述页面对应的事件表中,确定对应的响应方法,包括:According to the event identifier, from the event table corresponding to the page, determine the corresponding response method, including: 判断所述页面对应的事件表中,所述事件标识对应的钩子方法是否存在;Determine whether the hook method corresponding to the event identifier exists in the event table corresponding to the page; 若是,将所述事件标识对应的钩子方法作为所述响应方法;If so, use the hook method corresponding to the event identifier as the response method; 若否,结束响应所述事件。If not, end responding to the event. 8.一种基于WEB的事件响应装置,其特征在于,所述装置包括:8. A WEB-based event response device, wherein the device comprises: 响应模块,用于响应于Web应用中外层组件的事件触发指令,获取事件的事件标识;The response module is used to obtain the event identifier of the event in response to the event trigger instruction of the outer component in the web application; 确定模块,用于根据所述事件标识,从预设事件表中确定对应的响应方法;所述响应方法存储于内层组件中,所述预设事件表存储有至少一组事件标识与响应方法的关联关系;A determination module, configured to determine a corresponding response method from a preset event table according to the event identifier; the response method is stored in the inner component, and the preset event table stores at least one set of event identifiers and response methods affiliation; 处理模块,用于调用所述响应方法,对所述外层组件的事件进行处理。The processing module is used for invoking the response method to process the event of the outer component. 9.一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至7中任一项所述的方法的步骤。9. A computer device, comprising a memory and a processor, wherein the memory stores a computer program, wherein the processor implements the method according to any one of claims 1 to 7 when the processor executes the computer program. step. 10.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至7中任一项所述的方法的步骤。10. A computer-readable storage medium on which a computer program is stored, characterized in that, when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
CN202010711173.XA 2020-07-22 2020-07-22 WEB-based event response method and device, computer equipment and storage medium Pending CN111966507A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010711173.XA CN111966507A (en) 2020-07-22 2020-07-22 WEB-based event response method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010711173.XA CN111966507A (en) 2020-07-22 2020-07-22 WEB-based event response method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111966507A true CN111966507A (en) 2020-11-20

Family

ID=73362515

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010711173.XA Pending CN111966507A (en) 2020-07-22 2020-07-22 WEB-based event response method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111966507A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070016653A1 (en) * 2005-07-13 2007-01-18 Jan Larsen Event triggering over a network
CN107016010A (en) * 2016-06-30 2017-08-04 阿里巴巴集团控股有限公司 The treating method and apparatus of hyperlinked object
CN110119336A (en) * 2019-04-04 2019-08-13 微民保险代理有限公司 Data processing method, device, computer readable storage medium and computer equipment
CN110457097A (en) * 2019-05-24 2019-11-15 平安普惠企业管理有限公司 Page response control method, device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070016653A1 (en) * 2005-07-13 2007-01-18 Jan Larsen Event triggering over a network
CN107016010A (en) * 2016-06-30 2017-08-04 阿里巴巴集团控股有限公司 The treating method and apparatus of hyperlinked object
CN110119336A (en) * 2019-04-04 2019-08-13 微民保险代理有限公司 Data processing method, device, computer readable storage medium and computer equipment
CN110457097A (en) * 2019-05-24 2019-11-15 平安普惠企业管理有限公司 Page response control method, device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
US10042746B2 (en) Callpath finder
WO2019019769A1 (en) Service function implementation method, device, computer apparatus and storage medium
US11991094B2 (en) Metadata driven static determination of controller availability
CN108614976A (en) Authority configuring method, device and storage medium
CN110750315B (en) Class loading method, device, equipment and storage medium in Android system
US12355797B2 (en) System for collecting computer network entity information employing abstract models
CN115858213A (en) Task scheduling checking method and device, computer equipment and storage medium
CN112631682A (en) Applet processing method, device, equipment and storage medium
CN114756293A (en) Service processing method, device, computer equipment and storage medium
CN112199200B (en) Resource scheduling method and device, computer equipment and storage medium
CN118034717A (en) Page configuration method and device of micro front-end system and computer equipment
JP2011154496A (en) Program and device for setting access right and access right management system
CN113849482A (en) Data migration method and device and electronic equipment
CN111966507A (en) WEB-based event response method and device, computer equipment and storage medium
CN117435589A (en) Data transfer method, device, computer equipment, storage medium
CN111221560B (en) Resource management method and device and electronic equipment
CN114443706A (en) Budget data processing method, apparatus, computer equipment and storage medium
CN112232027A (en) A symbol translation method, apparatus, device and computer-readable storage medium
CN111880773A (en) A data processing method, device, electronic device and storage medium
US12323487B2 (en) Implementing a target block command on an unstructured data storage node
CN115987557A (en) An inter-cluster calling method, device, computer equipment and storage medium
CN116909684A (en) Deployment method, device, computer equipment and storage medium for low-code applications
CN118152137A (en) Resource configuration method, device, computer equipment, storage medium and product
CN116225426A (en) Method and device for calling reusable module, computer equipment and storage medium
CN118656539A (en) Information recommendation data processing method, device, electronic device 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
CB02 Change of applicant information

Country or region after: China

Address after: 518000 Room 201, building A, No. 1, Qian Wan Road, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong (Shenzhen Qianhai business secretary Co., Ltd.)

Applicant after: Zhaolian Consumer Finance Co.,Ltd.

Address before: 518000 Room 201, building A, No. 1, Qian Wan Road, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong (Shenzhen Qianhai business secretary Co., Ltd.)

Applicant before: MERCHANTS UNION CONSUMER FINANCE Co.,Ltd.

Country or region before: China

CB02 Change of applicant information
RJ01 Rejection of invention patent application after publication

Application publication date: 20201120

RJ01 Rejection of invention patent application after publication