[go: up one dir, main page]

CN110413920A - Method and device for generating pages - Google Patents

Method and device for generating pages Download PDF

Info

Publication number
CN110413920A
CN110413920A CN201810380514.2A CN201810380514A CN110413920A CN 110413920 A CN110413920 A CN 110413920A CN 201810380514 A CN201810380514 A CN 201810380514A CN 110413920 A CN110413920 A CN 110413920A
Authority
CN
China
Prior art keywords
view
model object
model
data
object identifier
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
CN201810380514.2A
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 Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information 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 Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201810380514.2A priority Critical patent/CN110413920A/en
Publication of CN110413920A publication Critical patent/CN110413920A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Landscapes

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

Abstract

本申请实施例公开了用于生成页面的方法和装置。上述方法的一具体实施方式包括:接收以及解析服务端发送的数据,数据包括视图对象标识以及待显示数据;根据视图对象标识、预设的第一映射列表以及待显示数据,创建模型对象,其中,第一映射列表包括视图对象标识以及视图对象标识对应的模型对象标识、模型对象名称;根据所创建的模型对象以及预设的第二映射列表,创建视图对象,其中,第二映射列表包括模型对象标识以及模型对象标识对应的视图对象名称;对所创建的视图对象进行布局,生成页面。该实施方式提高了页面的生成速度,避免了生成页面或刷新页面时的卡顿现象。

The embodiment of the present application discloses a method and device for generating a page. A specific implementation of the above method includes: receiving and parsing the data sent by the server, the data includes the view object identifier and the data to be displayed; creating a model object according to the view object identifier, the preset first mapping list and the data to be displayed, wherein , the first mapping list includes the view object identifier and the model object identifier corresponding to the view object identifier, and the model object name; create a view object according to the created model object and the preset second mapping list, wherein the second mapping list includes the model The object identifier and the name of the view object corresponding to the model object identifier; layout the created view object and generate a page. This embodiment improves the page generation speed and avoids the jamming phenomenon when generating pages or refreshing pages.

Description

用于生成页面的方法和装置Method and device for generating pages

技术领域technical field

本申请实施例涉及互联网技术领域,尤其涉及用于生成页面的方法和装置。The embodiment of the present application relates to the technical field of the Internet, and in particular to a method and an apparatus for generating a page.

背景技术Background technique

目前,页面开发一般使用MVC(Model-View-Controller,模型-视图-控制器)的设计模式,M是指数据模型,V是指用户界面,C是指控制器。使用MVC是将数据模型和用户界面实现代码分离,从而使同一个程序可以使用不同的表现形式。比如一批统计数据可以分别用柱状图和饼状图来表示。控制器存在的目的则是确保数据模型和用户界面的同步,一旦数据模型发生改变,用户界面应该同步更新。Currently, page development generally uses the MVC (Model-View-Controller, Model-View-Controller) design pattern, where M refers to the data model, V refers to the user interface, and C refers to the controller. Using MVC is to separate the data model and user interface code, so that the same program can use different forms of expression. For example, a batch of statistical data can be represented by histograms and pie charts. The purpose of the controller is to ensure the synchronization of the data model and the user interface. Once the data model changes, the user interface should be updated synchronously.

发明内容Contents of the invention

本申请实施例提出了用于生成页面的方法和装置。The embodiment of the present application proposes a method and an apparatus for generating a page.

第一方面,本申请实施例提供了一种用于生成页面的方法,包括:接收以及解析服务端发送的数据,上述数据包括视图对象标识以及待显示数据;根据上述视图对象标识、预设的第一映射列表以及上述待显示数据,创建模型对象,其中,上述第一映射列表包括视图对象标识以及视图对象标识对应的模型对象标识、模型对象名称;根据所创建的模型对象以及预设的第二映射列表,创建视图对象,其中,上述第二映射列表包括模型对象标识以及模型对象标识对应的视图对象名称;对所创建的视图对象进行布局,生成页面。In the first aspect, the embodiment of the present application provides a method for generating a page, including: receiving and analyzing the data sent by the server, the above-mentioned data includes the view object identifier and the data to be displayed; according to the above-mentioned view object identifier, preset The first mapping list and the above-mentioned data to be displayed create a model object, wherein the above-mentioned first mapping list includes a view object identifier and a model object identifier corresponding to the view object identifier, and a model object name; according to the created model object and the preset first The second mapping list is to create a view object, wherein the second mapping list includes a model object identifier and a view object name corresponding to the model object identifier; layout the created view object to generate a page.

在一些实施例中,上述根据视图对象标识、预设的第一映射列表以及上述待显示数据,创建模型对象,包括:根据预设的第一映射列表,确定与视图对象标识对应的模型对象标识以及模型对象名称;根据所确定的模型对象名称,调用预设的对象生成函数,生成对象;将所确定的模型对象标识以及上述待显示数据封装在所生成的对象中,得到模型对象。In some embodiments, the creation of the model object according to the view object identifier, the preset first mapping list, and the data to be displayed includes: determining the model object identifier corresponding to the view object identifier according to the preset first mapping list and the model object name; according to the determined model object name, call a preset object generation function to generate an object; encapsulate the determined model object identifier and the above-mentioned data to be displayed in the generated object to obtain a model object.

在一些实施例中,上述根据所创建的模型对象以及预设的第二映射列表,创建视图对象,包括:解析所创建的模型对象,得到模型对象标识;根据上述第二映射列表,确定解析得到的模型对象标识对应的视图对象名称;根据所确定的视图对象名称,调用预设的对象生成函数,生成视图对象。In some embodiments, the creation of the view object based on the created model object and the preset second mapping list includes: parsing the created model object to obtain the model object identifier; The name of the view object corresponding to the model object identifier; according to the determined name of the view object, call the preset object generation function to generate the view object.

在一些实施例中,在上述接收以及解析服务端返回的数据之前,上述方法还包括:响应于检测到用户触发的页面生成操作,向服务端发送数据获取请求。In some embodiments, before receiving and parsing the data returned by the server, the method further includes: sending a data acquisition request to the server in response to detecting a user-triggered page generation operation.

在一些实施例中,上述方法还包括:响应于检测到用户触发的视图切换操作,调用与上述视图切换操作对应的布局函数以更改所创建的视图对象的布局;根据所创建的视图对象更改后的布局,得到切换视图的页面。In some embodiments, the above method further includes: in response to detecting the view switching operation triggered by the user, calling a layout function corresponding to the above view switching operation to change the layout of the created view object; The layout of the page to get the switching view.

第二方面,本申请实施例提供了一种用于生成页面的装置,包括:数据接收单元,被配置成接收以及解析服务端发送的数据,上述数据包括视图对象标识以及待显示数据;模型对象创建单元,被配置成根据上述视图对象标识、预设的第一映射列表以及上述待显示数据,创建模型对象,其中,上述第一映射列表包括视图对象标识以及视图对象标识对应的模型对象标识、模型对象名称;视图对象创建单元,被配置成根据所创建的模型对象以及预设的第二映射列表,创建视图对象,其中,上述第二映射列表包括模型对象标识以及模型对象标识对应的视图对象名称;页面生成单元,被配置成对所创建的视图对象进行布局,生成页面。In the second aspect, the embodiment of the present application provides a device for generating a page, including: a data receiving unit configured to receive and analyze the data sent by the server, the above data includes the view object identifier and the data to be displayed; the model object The creating unit is configured to create a model object according to the view object identifier, the preset first mapping list, and the data to be displayed, wherein the first mapping list includes the view object identifier and the model object identifier corresponding to the view object identifier, Model object name; a view object creation unit configured to create a view object according to the created model object and a preset second mapping list, wherein the second mapping list includes a model object identifier and a view object corresponding to the model object identifier Name; page generation unit, configured to lay out the created view objects and generate pages.

在一些实施例中,上述模型对象创建单元进一步被配置成:根据预设的第一映射列表,确定与视图对象标识对应的模型对象标识以及模型对象名称;根据所确定的模型对象名称,调用预设的对象生成函数,生成对象;将所确定的模型对象标识以及上述待显示数据封装在所生成的对象中,得到模型对象。In some embodiments, the model object creation unit is further configured to: determine the model object identifier and the model object name corresponding to the view object identifier according to the preset first mapping list; call the preset model object name according to the determined model object name. The object generation function is set to generate the object; the determined model object identifier and the above data to be displayed are encapsulated in the generated object to obtain the model object.

在一些实施例中,上述视图对象创建单元进一步被配置成:解析所创建的模型对象,得到模型对象标识;根据上述第二映射列表,确定解析得到的模型对象标识对应的视图对象名称;根据所确定的视图对象名称,调用预设的对象生成函数,生成视图对象。In some embodiments, the view object creating unit is further configured to: parse the created model object to obtain the model object identifier; determine the name of the view object corresponding to the parsed model object identifier according to the second mapping list; With the determined view object name, call the preset object generation function to generate the view object.

在一些实施例中,上述装置还包括:请求发送单元,被配置成在上述数据接收单元接收以及解析服务端返回的数据之前,响应于检测到用户触发的页面生成操作,向服务端发送数据获取请求。In some embodiments, the above-mentioned device further includes: a request sending unit configured to send a data acquisition request to the server in response to detecting a user-triggered page generation operation before the data receiving unit receives and parses the data returned by the server. ask.

在一些实施例中,上述装置还包括视图切换单元,被配置成:响应于检测到用户触发的视图切换操作,调用与上述视图切换操作对应的布局函数以更改所创建的视图对象的布局;根据所创建的视图对象更改后的布局,得到切换视图的页面。In some embodiments, the above-mentioned apparatus further includes a view switching unit configured to: in response to detecting a user-triggered view switching operation, call a layout function corresponding to the above-mentioned view switching operation to change the layout of the created view object; The layout of the created view object is changed, and the page for switching views is obtained.

第三方面,本申请实施例提供了一种终端,包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当上述一个或多个程序被上述一个或多个处理器执行,使得上述一个或多个处理器实现上述任一实施例所描述的方法。In a third aspect, the embodiment of the present application provides a terminal, including: one or more processors; a storage device for storing one or more programs, when the above one or more programs are executed by the above one or more processors Executing, so that the above one or more processors implement the method described in any one of the above embodiments.

第四方面,本申请实施例提供了一种计算机可读介质,其上存储有计算机程序,该程序被处理器执行时实现上述任一实施例所描述的方法。In a fourth aspect, the embodiments of the present application provide a computer-readable medium, on which a computer program is stored, and when the program is executed by a processor, the method described in any one of the above-mentioned embodiments is implemented.

本申请的上述实施例提供的用于生成页面的方法和装置,首先接收并解析服务端发送的数据,上述数据包括视图对象标识以及待显示数据,然后根据上述视图对象标识、预设的第一映射列表以及上述待显示数据,创建模型对象,然后根据所创建的模型对象以及预设的第二映射列表,创建视图对象,最后对所创建的视图对象进行布局,生成页面。本实施例的方法和装置,当服务端发送的数据为更新的数据时,可以根据更新的数据生成视图对象,然后根据所生成的视图对象生成新的页面,从而提高了页面的生成速度,避免了生成页面或刷新页面时的卡顿现象。The method and device for generating pages provided by the above-mentioned embodiments of the present application first receive and parse the data sent by the server, the above-mentioned data includes the view object identifier and the data to be displayed, and then according to the above-mentioned view object identifier and the preset first Create a model object for the mapping list and the above-mentioned data to be displayed, and then create a view object according to the created model object and the preset second mapping list, and finally layout the created view object to generate a page. With the method and device of this embodiment, when the data sent by the server is updated data, a view object can be generated according to the updated data, and then a new page can be generated according to the generated view object, thereby improving the page generation speed and avoiding Fixed the lag when generating or refreshing the page.

附图说明Description of drawings

通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:Other characteristics, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

图1是本申请可以应用于其中的示例性系统架构图;FIG. 1 is an exemplary system architecture diagram to which the present application can be applied;

图2是根据本申请的用于生成页面的方法的一个实施例的流程图;FIG. 2 is a flowchart of an embodiment of a method for generating a page according to the present application;

图3是根据本申请的用于生成页面的方法的一个应用场景的示意图;FIG. 3 is a schematic diagram of an application scenario of a method for generating a page according to the present application;

图4是根据本申请的用于生成页面的装置的一个实施例的结构示意图;Fig. 4 is a schematic structural diagram of an embodiment of a device for generating a page according to the present application;

图5是适于用来实现本申请实施例的终端设备的计算机系统的结构示意图。Fig. 5 is a schematic structural diagram of a computer system suitable for implementing a terminal device according to an embodiment of the present application.

具体实施方式Detailed ways

下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。The application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain related inventions, rather than to limit the invention. It should also be noted that, for the convenience of description, only the parts related to the related invention are shown in the drawings.

需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。It should be noted that, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and embodiments.

图1示出了可以应用本申请的用于生成页面的方法或用于生成页面的装置的实施例的示例性系统架构100。FIG. 1 shows an exemplary system architecture 100 to which embodiments of the method for generating a page or the apparatus for generating a page of the present application can be applied.

如图1所示,系统架构100可以包括终端设备101、102、103,网络104和服务器105。网络104用以在终端设备101、102、103和服务器105之间提供通信链路的介质。网络104可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。As shown in FIG. 1 , a system architecture 100 may include terminal devices 101 , 102 , 103 , a network 104 and a server 105 . The network 104 is used as a medium for providing communication links between the terminal devices 101 , 102 , 103 and the server 105 . Network 104 may include various connection types, such as wires, wireless communication links, or fiber optic cables, among others.

用户可以使用终端设备101、102、103通过网络104与服务器105交互,以接收或发送数据等。终端设备101、102、103上可以安装有各种通讯客户端应用,例如网页浏览器应用、购物类应用、搜索类应用、即时通信工具、邮箱客户端、社交平台软件等。Users can use terminal devices 101 , 102 , 103 to interact with server 105 via network 104 to receive or send data and the like. Various communication client applications can be installed on the terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, and the like.

终端设备101、102、103硬件,也可以是软件。当终端设备101、102、103为硬件时,可以是具有显示屏并且支持网页浏览的各种电子设备,包括但不限于智能手机、平板电脑、电子书阅读器、MP3播放器(Moving Picture Experts Group Audio Layer III,动态影像专家压缩标准音频层面3)、MP4(Moving Picture Experts Group Audio Layer IV,动态影像专家压缩标准音频层面4)播放器、膝上型便携计算机和台式计算机等等。当终端设备101、102、103为软件时,可以安装在上述所列举的电子设备中。其可以实现成多个软件或软件模块(例如用来提供分布式服务),也可以实现成单个软件或软件模块。在此不做具体限定。The hardware of the terminal devices 101, 102, and 103 may also be software. When the terminal devices 101, 102, 103 are hardware, they can be various electronic devices with display screens and supporting web browsing, including but not limited to smartphones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, moving picture expert compression standard audio layer 3), MP4 (Moving Picture Experts Group Audio Layer IV, moving picture expert compression standard audio layer 4) player, laptop portable computer and desktop computer, etc. When the terminal devices 101, 102, 103 are software, they can be installed in the electronic devices listed above. It can be implemented as a plurality of software or software modules (for example, to provide distributed services), or as a single software or software module. No specific limitation is made here.

服务器105可以是提供各种服务的服务器,例如对终端设备101、102、103上显示的网页提供支持的后台网页服务器。后台网页服务器可以对接收到的数据获取请求等数据进行分析等处理,并将处理结果(例如待显示数据和视图对象标识)反馈给终端设备。The server 105 may be a server that provides various services, for example, a background web server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 . The background web server can analyze and process the received data such as the data acquisition request, and feed back the processing result (such as the data to be displayed and the view object identifier) to the terminal device.

需要说明的是,本申请实施例所提供的用于生成页面的方法一般由终端设备101、102、103执行,相应地,用于生成页面的装置一般设置于终端设备101、102、103中。It should be noted that the methods for generating pages provided by the embodiments of the present application are generally executed by terminal devices 101 , 102 , and 103 , and correspondingly, the means for generating pages are generally set in terminal devices 101 , 102 , and 103 .

需要说明的是,服务器可以是硬件,也可以是软件。当服务器为硬件时,可以实现成多个服务器组成的分布式服务器集群,也可以实现成单个服务器。当服务器为软件时,可以实现成多个软件或软件模块(例如用来提供分布式服务),也可以实现成单个软件或软件模块。在此不做具体限定。It should be noted that the server may be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or as a single server. When the server is software, it can be implemented as multiple software or software modules (for example, for providing distributed services), or as a single software or software module. No specific limitation is made here.

应该理解,图1中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。It should be understood that the numbers of terminal devices, networks and servers in Fig. 1 are only illustrative. According to the implementation needs, there can be any number of terminal devices, networks and servers.

继续参考图2,其示出了根据本申请的用于生成页面的方法的一个实施例的流程200。本实施例的用于生成页面的方法,包括以下步骤:Continue referring to FIG. 2 , which shows a flow 200 of an embodiment of the method for generating a page according to the present application. The method for generating a page in this embodiment includes the following steps:

步骤201,接收以及解析服务端发送的数据。Step 201, receiving and parsing the data sent by the server.

在本实施例中,用于生成页面的方法运行于其上的执行主体(例如图1所示的终端设备)可以通过有线连接方式或者无线连接方式从服务端接收数据。执行主体可以在服务端中存储的数据发生更新时接收到上述数据,也可以在向服务端发送数据请求后接收到上述数据。执行主体在接收到服务端发送的数据后,可以对上述数据进行解析。In this embodiment, the execution subject on which the method for generating the page runs (for example, the terminal device shown in FIG. 1 ) can receive data from the server through a wired connection or a wireless connection. The execution subject may receive the above-mentioned data when the data stored in the server is updated, or may receive the above-mentioned data after sending a data request to the server. After the execution subject receives the data sent by the server, it can analyze the above data.

在MVC这种设计模式中,模型(Model)中通过创建模型对象来封装应用程序的数据,视图(View)中通过创建视图对象显示应用程序的数据,控制器(Controller)中通过控制器对象来充当模型对象和视图对象的媒介,例如,视图对象通过控制器对象了解模型对象的更改。模型负责与服务端交互,以在服务端存取数据。本实施例中,上述数据可以包括视图对象标识和待显示数据。视图对象标识即为视图(View)所创建的视图对象的标识,上述标识可以为数字或字符串。上述待显示数据即为应用程序中的数据,例如,上述待显示数据可以为地址簿重的联系人信息,或者为应用程序中的商品信息。在一些实现方式中,上述来自服务端的数据中可以包括视图对象标识列表,该视图对象标识列表中包括多个视图对象标识。In the design pattern of MVC, the data of the application is encapsulated by creating model objects in the model (Model), the data of the application is displayed by creating view objects in the view (View), and the data of the application is displayed in the controller (Controller) through the controller object. Acts as an intermediary between model objects and view objects, for example, view objects learn about changes to model objects through controller objects. The model is responsible for interacting with the server to access data on the server. In this embodiment, the above data may include a view object identifier and data to be displayed. The view object identifier is the identifier of the view object created by the view (View), and the above identifier can be a number or a character string. The above-mentioned data to be displayed is the data in the application program, for example, the above-mentioned data to be displayed may be contact information in the address book, or product information in the application program. In some implementation manners, the data from the server may include a view object identifier list, and the view object identifier list includes multiple view object identifiers.

需要指出的是,上述无线连接方式可以包括但不限于3G/4G连接、WiFi连接、蓝牙连接、WiMAX连接、Zigbee连接、UWB(ultra wideband)连接、以及其他现在已知或将来开发的无线连接方式。It should be pointed out that the above wireless connection methods may include but not limited to 3G/4G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods known or developed in the future .

步骤202,根据视图对象标识、预设的第一映射列表以及待显示数据,创建模型对象。Step 202, create a model object according to the view object identifier, the preset first mapping list and the data to be displayed.

执行主体在获取了上述数据后,可以根据上述视图对象标识、预设的第一映射列表以及上述待显示数据,创建模型对象。上述第一映射列表中包括视图对象标识以及视图对象标识对应的模型对象标识、模型对象名称。模型对象标识即为模型(Model)所创建的模型对象的标识信息,模型对象名称即为上述模型对象的名称。After obtaining the above data, the execution subject can create a model object according to the above view object identifier, the preset first mapping list and the above data to be displayed. The above-mentioned first mapping list includes the view object identifier and the model object identifier and model object name corresponding to the view object identifier. The model object identifier is the identification information of the model object created by the model (Model), and the model object name is the name of the above-mentioned model object.

本实施例中,一个视图对象标识对应一个模型对象标识,同时对应一个模型对象名称。模型对象标识可以与视图对象标识相同,例如,模型对象标识和视图对象标识都用数字来表示,且模型对象标识值与视图对象标识值相等。模型对象标识可以与视图对象标识不相同,例如,模型对象标识为A11,对应的视图对象标识为B12。模型对象名称可以以字符串来表示。执行主体可以根据预设的模板以及模型对象名称来创建对象,然后将所确定的模型对象标识以及待显示数据封装在所创建的对象中,得到模型对象。In this embodiment, a view object identifier corresponds to a model object identifier, and also corresponds to a model object name. The model object ID can be the same as the view object ID, for example, both the model object ID and the view object ID are represented by numbers, and the value of the model object ID is equal to the value of the view object ID. The model object identifier may be different from the view object identifier, for example, the model object identifier is A11, and the corresponding view object identifier is B12. Model object names can be represented as strings. The execution subject can create the object according to the preset template and the name of the model object, and then encapsulate the determined model object identifier and the data to be displayed in the created object to obtain the model object.

可以理解的是,当来自服务端的数据中包括多个视图标识时,相应地,执行主体会创建多个模型对象。It can be understood that, when the data from the server includes multiple view identifiers, correspondingly, the execution subject will create multiple model objects.

在本实施例的一些可选的实现方式中,上述步骤202具体可以通过图2中未示出的以下步骤来实现:首先,根据预设的第一映射列表,确定与视图对象标识对应的模型对象标识以及模型对象名称。然后,根据所确定的模型对象名称,调用预设的对象生成函数,生成对象。最后,将所确定的模型对象标识以及待显示数据封装在所生成的对象中,得到模型对象。In some optional implementations of this embodiment, the above step 202 can be specifically implemented through the following steps not shown in FIG. 2: first, according to the preset first mapping list, determine the model corresponding to the view object identifier Object ID and model object name. Then, according to the determined name of the model object, a preset object generation function is invoked to generate the object. Finally, the determined model object identifier and the data to be displayed are encapsulated in the generated object to obtain the model object.

本实现方式中,执行主体首先可以在上述第一映射列表中查找视图对象标识,然后确定视图对象标识对应的模型对象标识和模型对象名称。然后根据所确定的模型对象名称,调用预设的对象生成函数,生成对象。上述对象生成函数可以是NSClassFormString,该函数为iOS系统中用于创建类和对象的函数。通过调用该函数,执行主体可以根据模型对象名称创建一个对象。然后将所确定的模型对象标识以及上述待显示数据封装在所生成的对象中,得到模型对象。In this implementation, the execution subject may first look up the view object identifier in the first mapping list, and then determine the model object identifier and model object name corresponding to the view object identifier. Then, according to the determined name of the model object, a preset object generation function is invoked to generate the object. The above-mentioned object generation function may be NSClassFormString, which is a function for creating classes and objects in the iOS system. By calling this function, the execution subject can create an object according to the model object name. Then encapsulate the determined model object identifier and the above-mentioned data to be displayed in the generated object to obtain a model object.

需要说明的是,当执行主体创建的模型对象有多个时,可以将所创建的对象加入数组,得到模型对象数组。It should be noted that when there are multiple model objects created by the execution subject, the created objects can be added to an array to obtain an array of model objects.

步骤203,根据所创建的模型对象以及预设的第二映射列表,创建视图对象。Step 203, create a view object according to the created model object and the preset second mapping list.

在创建了模型对象后,执行主体可以结合预设的第二映射列表,创建视图对象。上述第二映射列表中可以包括模型对象标识以及模型对象标识对应的视图对象名称。例如,上述第二映射列表中可以包括多个键值对(key-value),key值表示模型对象标识,value值可以是视图对象名称。执行主体在创建模型对象后,可以根据模型对象中的模型对象标识以及上述第二映射列表,确定视图对象名称,然后创建视图对象。After the model object is created, the execution subject can combine the preset second mapping list to create the view object. The above-mentioned second mapping list may include a model object identifier and a view object name corresponding to the model object identifier. For example, the above-mentioned second mapping list may include a plurality of key-value pairs (key-value), the key value represents the identifier of the model object, and the value value may be the name of the view object. After the execution subject creates the model object, it can determine the name of the view object according to the model object identifier in the model object and the above-mentioned second mapping list, and then create the view object.

在本实施例的一些可选的实现方式中,上述步骤203具体可以通过图2中未示出的以下步骤来实现:首先,解析所创建的模型对象,得到模型对象标识。然后,根据第二映射列表,确定解析得到的模型对象标识对应的视图对象名称。最后,根据所确定的视图对象名称,调用预设的对象生成函数,生成视图对象。In some optional implementation manners of this embodiment, the above step 203 may specifically be implemented through the following steps not shown in FIG. 2 : first, parse the created model object to obtain the model object identifier. Then, according to the second mapping list, determine the view object name corresponding to the parsed model object identifier. Finally, according to the determined name of the view object, a preset object generating function is invoked to generate the view object.

本实现方式中,执行主体可以首先解析所创建的模型对象,得到模型对象标识。然后根据第二映射列表,确定上述模型对象标识对应的视图对象名称。最后根据上述视图对象名称,调用对象生成函数,生成视图对象。上述对象生成函数可以是NSClassFormString。所生成的视图对象可以显示来自模型对象的数据。In this implementation manner, the execution subject may first parse the created model object to obtain the model object identifier. Then, according to the second mapping list, determine the name of the view object corresponding to the model object identifier. Finally, according to the name of the above view object, call the object generation function to generate the view object. The above object generation function may be NSClassFormString. The generated view objects can display data from the model objects.

需要说明的是,当执行主体创建了多个模型对象时,可以在创建视图对象前,首先建立一个数组,然后将所创建的视图对象加入上述数组。It should be noted that when the execution subject creates multiple model objects, before creating the view object, an array can be created first, and then the created view object can be added to the above array.

步骤204,对所创建的视图对象进行布局,生成页面。Step 204, layout the created view objects to generate a page.

执行主体在创建视图对象后,可以对上述视图对象进行布局,生成页面。对视图对象布局可以包括调整每个视图对象在页面中所占用的高度、对视图对象中显示的图片或文字的方式进行调整(例如图片在左侧显示、文字在右侧显示)。After the execution subject creates the view object, it can lay out the above view object and generate a page. The layout of the view objects may include adjusting the height occupied by each view object on the page, and adjusting the way of pictures or text displayed in the view objects (for example, pictures are displayed on the left and text is displayed on the right).

执行主体在执行本实施例的方法时,对于一个应用程序,可以运行多个线程来执行上述各步骤,例如,控制器、模型和视图分别运行在不同的线程中。另外,本实施例中可以在MVC的设计模式中,增加模型管理模块和视图管理模块。同样的,上述模型管理模块和视图管理模块分别运行在不同的线程中。When the execution subject executes the method of this embodiment, for an application program, multiple threads may be run to execute the above steps, for example, the controller, the model and the view run in different threads respectively. In addition, in this embodiment, a model management module and a view management module can be added in the MVC design mode. Similarly, the above-mentioned model management module and view management module run in different threads respectively.

上述模型管理模块可以读取第一映射列表,然后结合来自服务端的视图对象标识,确定模型对象标识和模型对象名称,然后模型根据上述模型对象标识、模型对象名称以及待显示数据,创建模型对象。在一些实现方式中,上述模型管理模块可以建立一个数组,模型可以将所创建的模型对象加入上述数组。The above-mentioned model management module can read the first mapping list, and then combine the view object identifier from the server to determine the model object identifier and model object name, and then the model creates a model object according to the above-mentioned model object identifier, model object name and data to be displayed. In some implementation manners, the above-mentioned model management module can create an array, and the model can add the created model objects to the above-mentioned array.

上述视图管理模块可以获取并解析模型所创建的模型对象,得到模型对象标识,然后读取第二映射列表,得到视图对象名称。视图根据得到的视图对象名称创建视图对象。在一些实现方式中,视图管理模块可以建立一个数组,视图可以将所创建的视图对象加入上述数组。The above-mentioned view management module can obtain and parse the model object created by the model to obtain the model object identifier, and then read the second mapping list to obtain the view object name. The view creates a view object based on the obtained view object name. In some implementation manners, the view management module may create an array, and the view may add the created view objects to the above array.

继续参见图3,图3是根据本实施例的用于生成页面的方法的应用场景的一个示意图。在图3的应用场景中,服务器301向终端302发送数据,终端在接收到上述数据后,解析得到视图对象标识。然后,结合第一映射列表,得到模型对象标识和模型对象名称。接着,创建模型对象。再解析模型对象得到模型对象标识,结合第二映射列表,得到视图对象名称。然后创建视图对象,最后对创建的对象进行布局,最终得到终端302上显示的如3021所示的页面。Continuing to refer to FIG. 3 , FIG. 3 is a schematic diagram of an application scenario of the method for generating a page according to this embodiment. In the application scenario of FIG. 3 , the server 301 sends data to the terminal 302 , and the terminal parses to obtain the view object identifier after receiving the above data. Then, combine the first mapping list to obtain the model object identifier and the model object name. Next, create the model object. Then parse the model object to obtain the model object identifier, combine with the second mapping list to obtain the view object name. Then the view object is created, and finally the created object is laid out, and finally the page shown in 3021 displayed on the terminal 302 is obtained.

本申请的上述实施例提供的用于生成页面的方法,首先接收并解析服务端发送的数据,上述数据包括视图对象标识以及待显示数据,然后根据上述视图对象标识、预设的第一映射列表以及上述待显示数据,创建模型对象,然后根据所创建的模型对象以及预设的第二映射列表,创建视图对象,最后对所创建的视图对象进行布局,生成页面。本实施例的方法,当服务端发送的数据为更新的数据时,可以根据更新的数据生成视图对象,然后根据所生成的视图对象生成新的页面,从而提高了页面的生成速度,避免了生成页面或刷新页面时的卡顿现象。The method for generating a page provided by the above-mentioned embodiments of the present application first receives and parses the data sent by the server, the above-mentioned data includes the view object identifier and the data to be displayed, and then according to the above-mentioned view object identifier and the preset first mapping list And the above data to be displayed, create a model object, then create a view object according to the created model object and the preset second mapping list, and finally layout the created view object to generate a page. With the method of this embodiment, when the data sent by the server is updated data, a view object can be generated according to the updated data, and then a new page can be generated according to the generated view object, thereby improving the page generation speed and avoiding the need to generate Stuck phenomenon when the page or page is refreshed.

在本实施例的一些可选的实现方式中,在步骤201之前,上述方法还可以包括图2中未示出的以下步骤:响应于检测到用户触发的页面生成操作,向服务端发送数据获取请求。In some optional implementations of this embodiment, before step 201, the above method may further include the following steps not shown in FIG. ask.

本实现方式中,执行主体为终端时,终端可以检测用户的操作,当检测到用户触发的页面生成操作时,可以向服务端发送数据获取请求。上述页面生成操作可以包括用户对已生成页面的刷新操作、对终端中安装的页面生成应用的点击操作等。上述刷新操作可以包括对页面的向下滑动、对刷新按钮的点击操作等,上述点击操作可以包括对页面生成应用图标的单击操作、双击操作等。In this implementation, when the execution subject is a terminal, the terminal can detect user operations, and when detecting a user-triggered page generation operation, can send a data acquisition request to the server. The above-mentioned page generation operation may include a user's refresh operation on a generated page, a click operation on a page generation application installed in a terminal, and the like. The above refresh operation may include sliding down the page, clicking a refresh button, etc., and the above click operation may include a single click operation, double click operation, etc. for generating an application icon on the page.

在本实施例的一些可选的实现方式中,上述方法还可以包括图2中未示出的以下步骤:首先,响应于检测到用户触发的视图切换操作,调用与视图切换操作对应的布局函数以更改所创建的视图对象的布局。然后,根据所创建的视图对象更改后的布局,得到切换视图的页面。In some optional implementations of this embodiment, the above method may further include the following steps not shown in FIG. 2: first, in response to detecting a view switching operation triggered by the user, calling a layout function corresponding to the view switching operation to change the layout of the created view object. Then, according to the changed layout of the created view object, the page for switching views is obtained.

本实现方式中,执行主体可以为终端设备,其可以检测用户的视图切换操作。上述视图切换操作可以为用户对视图切换按钮的点击操作,或者对页面的滑动操作等。执行主体在检测到上述视图切换操作后,可以调用与视图切换操作对应的布局函数以更改所创建的视图对象的布局。然后根据更改后的布局,得到切换视图的页面。例如,用户通过点击页面中的视图切换按钮,可以由大图模式切换到详细列表模式。In this implementation manner, the execution subject may be a terminal device, which may detect a user's view switching operation. The foregoing view switching operation may be a user's clicking operation on a view switching button, or a sliding operation on a page, and the like. After the execution subject detects the above view switching operation, it can call the layout function corresponding to the view switching operation to change the layout of the created view object. Then according to the changed layout, the page for switching views is obtained. For example, the user can switch from the large picture mode to the detailed list mode by clicking the view switching button on the page.

进一步参考图4,作为对上述各图所示方法的实现,本申请提供了一种用于生成页面的装置的一个实施例,该装置实施例与图2所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。Further referring to FIG. 4 , as an implementation of the methods shown in the above figures, the present application provides an embodiment of a device for generating pages, which corresponds to the method embodiment shown in FIG. 2 . The device can be specifically applied to various electronic devices.

如图4所示,本实施例的用于生成页面的装置400包括:数据接收单元401、模型对象创建单元402、视图对象创建单元403以及页面生成单元404。As shown in FIG. 4 , the apparatus 400 for generating a page in this embodiment includes: a data receiving unit 401 , a model object creating unit 402 , a view object creating unit 403 and a page generating unit 404 .

其中,数据接收单元401,被配置成接收以及解析服务端发送的数据,上述数据包括视图对象标识以及待显示数据。Wherein, the data receiving unit 401 is configured to receive and analyze the data sent by the server, the above data includes the view object identifier and the data to be displayed.

模型对象创建单元402,被配置成根据视图对象标识、预设的第一映射列表以及待显示数据,创建模型对象。The model object creating unit 402 is configured to create a model object according to the view object identifier, the preset first mapping list and the data to be displayed.

其中,第一映射列表包括视图对象标识以及视图对象标识对应的模型对象标识、模型对象名称。Wherein, the first mapping list includes a view object identifier, a model object identifier corresponding to the view object identifier, and a model object name.

视图对象创建单元403,被配置成根据所创建的模型对象以及预设的第二映射列表,创建视图对象。The view object creating unit 403 is configured to create a view object according to the created model object and the preset second mapping list.

其中,第二映射列表包括模型对象标识以及模型对象标识对应的视图对象名称。Wherein, the second mapping list includes the model object identifier and the view object name corresponding to the model object identifier.

页面生成单元404,被配置成对所创建的视图对象进行布局,生成页面。The page generation unit 404 is configured to lay out the created view objects to generate a page.

在本实施例的一些可选的实现方式中,上述模型对象创建单元402可以进一步被配置成:根据预设的第一映射列表,确定与视图对象标识对应的模型对象标识以及模型对象名称;根据所确定的模型对象名称,调用预设的对象生成函数,生成对象;将所确定的模型对象标识以及待显示数据封装在所生成的对象中,得到模型对象。In some optional implementations of this embodiment, the model object creation unit 402 may be further configured to: determine the model object identifier and the model object name corresponding to the view object identifier according to the preset first mapping list; The determined model object name is invoked to generate an object by calling a preset object generation function; the determined model object identifier and the data to be displayed are encapsulated in the generated object to obtain a model object.

在本实施例的一些可选的实现方式中,上述视图对象创建单元403可以进一步被配置成:解析所创建的模型对象,得到模型对象标识;根据第二映射列表,确定解析得到的模型对象标识对应的视图对象名称;根据所确定的视图对象名称,调用预设的对象生成函数,生成视图对象。In some optional implementations of this embodiment, the view object creating unit 403 may be further configured to: parse the created model object to obtain the model object identifier; determine the parsed model object identifier according to the second mapping list The corresponding view object name; according to the determined view object name, call a preset object generation function to generate a view object.

在本实施例的一些可选的实现方式中,上述装置还可以进一步包括图4中未示出的请求发送单元,被配置成在数据接收单元接收以及解析服务端返回的数据之前,响应于检测到用户触发的页面生成操作,向服务端发送数据获取请求。In some optional implementations of this embodiment, the above device may further include a request sending unit not shown in FIG. 4, configured to respond to the detection of To the page generation operation triggered by the user, send a data acquisition request to the server.

在本实施例的一些可选的实现方式中,上述装置还可以进一步包括图4中未示出的视图切换单元,被配置成:响应于检测到用户触发的视图切换操作,调用与上述视图切换操作对应的布局函数以更改所创建的视图对象的布局;根据所创建的视图对象更改后的布局,得到切换视图的页面。In some optional implementations of this embodiment, the above-mentioned apparatus may further include a view switching unit not shown in FIG. 4, configured to: respond to detecting a view switching operation triggered by the user, call the above-mentioned view switching Operate the corresponding layout function to change the layout of the created view object; according to the changed layout of the created view object, the page for switching views is obtained.

本申请的上述实施例提供的用于生成页面的装置,首先接收并解析服务端发送的数据,上述数据包括视图对象标识以及待显示数据,然后根据上述视图对象标识、预设的第一映射列表以及上述待显示数据,创建模型对象,然后根据所创建的模型对象以及预设的第二映射列表,创建视图对象,最后对所创建的视图对象进行布局,生成页面。本实施例的装置,当服务端发送的数据为更新的数据时,可以根据更新的数据生成视图对象,然后根据所生成的视图对象生成新的页面,从而提高了页面的生成速度,避免了生成页面或刷新页面时的卡顿现象。The device for generating a page provided by the above-mentioned embodiments of the present application first receives and parses the data sent by the server, the above-mentioned data includes the view object identifier and the data to be displayed, and then according to the above-mentioned view object identifier and the preset first mapping list And the above data to be displayed, create a model object, then create a view object according to the created model object and the preset second mapping list, and finally layout the created view object to generate a page. The device of this embodiment, when the data sent by the server is updated data, can generate a view object according to the updated data, and then generate a new page according to the generated view object, thereby improving the generation speed of the page and avoiding the need to generate Stuck phenomenon when the page or page is refreshed.

应当理解,用于生成页面的装置400中记载的单元401至单元404分别与参考图2中描述的方法中的各个步骤相对应。由此,上文针对用于生成页面的方法描述的操作和特征同样适用于装置400及其中包含的单元,在此不再赘述。It should be understood that the units 401 to 404 described in the apparatus 400 for generating a page respectively correspond to the steps in the method described with reference to FIG. 2 . Therefore, the operations and features described above for the method for generating a page are also applicable to the device 400 and the units contained therein, and will not be repeated here.

下面参考图5,其示出了适于用来实现本申请实施例的终端设备的计算机系统500的结构示意图。图5示出的终端设备仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。Referring now to FIG. 5 , it shows a schematic structural diagram of a computer system 500 suitable for implementing a terminal device according to an embodiment of the present application. The terminal device shown in FIG. 5 is only an example, and should not limit the functions and scope of use of this embodiment of the present application.

如图5所示,计算机系统500包括中央处理单元(CPU)501,其可以根据存储在只读存储器(ROM)502中的程序或者从存储部分508加载到随机访问存储器(RAM)503中的程序而执行各种适当的动作和处理。在RAM 503中,还存储有系统500操作所需的各种程序和数据。CPU 501、ROM 502以及RAM 503通过总线504彼此相连。输入/输出(I/O)接口505也连接至总线504。As shown in FIG. 5 , a computer system 500 includes a central processing unit (CPU) 501 that can be programmed according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage section 508 into a random-access memory (RAM) 503 Instead, various appropriate actions and processes are performed. In the RAM 503, various programs and data necessary for the operation of the system 500 are also stored. The CPU 501 , ROM 502 , and RAM 503 are connected to each other through a bus 504 . An input/output (I/O) interface 505 is also connected to the bus 504 .

以下部件连接至I/O接口505:包括键盘、鼠标等的输入部分506;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分507;包括硬盘等的存储部分508;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分509。通信部分509经由诸如因特网的网络执行通信处理。驱动器510也根据需要连接至I/O接口505。可拆卸介质511,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器510上,以便于从其上读出的计算机程序根据需要被安装入存储部分508。The following components are connected to the I/O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 508 including a hard disk, etc. and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I/O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is mounted on the drive 510 as necessary so that a computer program read therefrom is installed into the storage section 508 as necessary.

特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在机器可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分509从网络上被下载和安装,和/或从可拆卸介质511被安装。在该计算机程序被中央处理单元(CPU)501执行时,执行本申请的方法中限定的上述功能。In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments of the present disclosure include a computer program product including a computer program carried on a machine-readable medium, the computer program including program code for executing the method shown in the flowchart. In such an embodiment, the computer program may be downloaded and installed from a network via communication portion 509 and/or installed from removable media 511 . When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the method of the present application are performed.

需要说明的是,本申请所描述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本申请中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本申请中,计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、电线、光缆、RF等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium described in this application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. A computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, in which computer-readable program codes are carried. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. . Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

可以以一种或多种程序设计语言或其组合来编写用于执行本申请的操作的计算机程序代码,上述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing the operations of the present application may be written in one or more programming languages or combinations thereof, including object-oriented programming languages—such as Java, Smalltalk, C++, and conventional Procedural Programming Language - such as "C" or a similar programming language. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In cases involving a remote computer, the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through an Internet service provider). Internet connection).

附图中的流程图和框图,图示了按照本申请各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more logical functions for implementing specified executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved. It should also be noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.

描述于本申请实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元也可以设置在处理器中,例如,可以描述为:一种处理器包括数据接收单元、模型对象创建单元、视图对象创建单元和页面生成单元。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定,例如,数据接收单元还可以被描述为“接收以及解析服务端发送的数据的单元”。The units involved in the embodiments described in the present application may be implemented by means of software or by means of hardware. The described units can also be set in a processor, for example, it can be described as: a processor includes a data receiving unit, a model object creating unit, a view object creating unit and a page generating unit. Wherein, the names of these units do not limit the unit itself under certain circumstances, for example, the data receiving unit may also be described as "a unit that receives and parses data sent by the server".

作为另一方面,本申请还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的装置中所包含的;也可以是单独存在,而未装配入该装置中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该装置执行时,使得该装置:接收以及解析服务端发送的数据,上述数据包括视图对象标识以及待显示数据;根据上述视图对象标识、预设的第一映射列表以及上述待显示数据,创建模型对象,其中,上述第一映射列表包括视图对象标识以及视图对象标识对应的模型对象标识、模型对象名称;根据所创建的模型对象以及预设的第二映射列表,创建视图对象,其中,上述第二映射列表包括模型对象标识以及模型对象标识对应的视图对象名称;对所创建的视图对象进行布局,生成页面。As another aspect, the present application also provides a computer-readable medium. The computer-readable medium may be included in the device described in the above embodiments, or it may exist independently without being assembled into the device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by the device, the device: receives and parses the data sent by the server, the data includes the view object identifier and the data to be displayed; Create a model object according to the above-mentioned view object identifier, the preset first mapping list and the above-mentioned data to be displayed, wherein the above-mentioned first mapping list includes the view object identifier and the model object identifier and model object name corresponding to the view object identifier; according to the The created model object and the preset second mapping list are used to create a view object, wherein the second mapping list includes the model object identifier and the view object name corresponding to the model object identifier; the created view object is laid out to generate a page.

以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本申请中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述发明构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本申请中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is only a preferred embodiment of the present application and an illustration of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to the technical solution formed by the specific combination of the above-mentioned technical features, and should also cover the technical solutions formed by the above-mentioned technical features or without departing from the above-mentioned inventive concept. Other technical solutions formed by any combination of equivalent features. For example, a technical solution formed by replacing the above-mentioned features with technical features with similar functions disclosed in (but not limited to) this application.

Claims (12)

1.一种用于生成页面的方法,包括:1. A method for generating a page comprising: 接收以及解析服务端发送的数据,所述数据包括视图对象标识以及待显示数据;Receive and parse the data sent by the server, the data includes the view object identifier and the data to be displayed; 根据所述视图对象标识、预设的第一映射列表以及所述待显示数据,创建模型对象,其中,所述第一映射列表包括视图对象标识以及视图对象标识对应的模型对象标识、模型对象名称;Create a model object according to the view object identifier, the preset first mapping list, and the data to be displayed, wherein the first mapping list includes the view object identifier, the model object identifier corresponding to the view object identifier, and the model object name ; 根据所创建的模型对象以及预设的第二映射列表,创建视图对象,其中,所述第二映射列表包括模型对象标识以及模型对象标识对应的视图对象名称;Create a view object according to the created model object and a preset second mapping list, where the second mapping list includes a model object identifier and a view object name corresponding to the model object identifier; 对所创建的视图对象进行布局,生成页面。Lay out the created view objects to generate pages. 2.根据权利要求1所述的方法,其中,所述根据视图对象标识、预设的第一映射列表以及所述待显示数据,创建模型对象,包括:2. The method according to claim 1, wherein said creating a model object according to the view object identifier, the preset first mapping list and the data to be displayed comprises: 根据预设的第一映射列表,确定与视图对象标识对应的模型对象标识以及模型对象名称;Determine the model object identifier and the model object name corresponding to the view object identifier according to the preset first mapping list; 根据所确定的模型对象名称,调用预设的对象生成函数,生成对象;According to the determined model object name, call the preset object generation function to generate the object; 将所确定的模型对象标识以及所述待显示数据封装在所生成的对象中,得到模型对象。Encapsulate the determined model object identifier and the data to be displayed in the generated object to obtain a model object. 3.根据权利要求1所述的方法,其中,所述根据所创建的模型对象以及预设的第二映射列表,创建视图对象,包括:3. The method according to claim 1, wherein said creating a view object according to the created model object and the preset second mapping list comprises: 解析所创建的模型对象,得到模型对象标识;Parse the created model object to obtain the model object identifier; 根据所述第二映射列表,确定解析得到的模型对象标识对应的视图对象名称;According to the second mapping list, determine the name of the view object corresponding to the model object identifier obtained by parsing; 根据所确定的视图对象名称,调用预设的对象生成函数,生成视图对象。According to the determined name of the view object, a preset object generation function is invoked to generate the view object. 4.根据权利要求1所述的方法,其中,在所述接收以及解析服务端返回的数据之前,所述方法还包括:4. The method according to claim 1, wherein, before receiving and analyzing the data returned by the server, the method further comprises: 响应于检测到用户触发的页面生成操作,向服务端发送数据获取请求。In response to detecting the page generation operation triggered by the user, a data acquisition request is sent to the server. 5.根据权利要求1所述的方法,其中,所述方法还包括:5. The method of claim 1, wherein the method further comprises: 响应于检测到用户触发的视图切换操作,调用与所述视图切换操作对应的布局函数以更改所创建的视图对象的布局;In response to detecting a user-triggered view switching operation, calling a layout function corresponding to the view switching operation to change the layout of the created view object; 根据所创建的视图对象更改后的布局,得到切换视图的页面。According to the changed layout of the created view object, the page for switching views is obtained. 6.一种用于生成页面的装置,包括:6. An apparatus for generating a page, comprising: 数据接收单元,被配置成接收以及解析服务端发送的数据,所述数据包括视图对象标识以及待显示数据;The data receiving unit is configured to receive and parse the data sent by the server, the data includes the view object identifier and the data to be displayed; 模型对象创建单元,被配置成根据所述视图对象标识、预设的第一映射列表以及所述待显示数据,创建模型对象,其中,所述第一映射列表包括视图对象标识以及视图对象标识对应的模型对象标识、模型对象名称;The model object creation unit is configured to create a model object according to the view object identifier, the preset first mapping list and the data to be displayed, wherein the first mapping list includes the view object identifier and the view object identifier corresponding The model object identifier and model object name of ; 视图对象创建单元,被配置成根据所创建的模型对象以及预设的第二映射列表,创建视图对象,其中,所述第二映射列表包括模型对象标识以及模型对象标识对应的视图对象名称;The view object creating unit is configured to create a view object according to the created model object and a preset second mapping list, wherein the second mapping list includes a model object identifier and a view object name corresponding to the model object identifier; 页面生成单元,被配置成对所创建的视图对象进行布局,生成页面。The page generation unit is configured to lay out the created view objects to generate a page. 7.根据权利要求6所述的装置,其中,所述模型对象创建单元进一步被配置成:7. The apparatus according to claim 6, wherein the model object creation unit is further configured to: 根据预设的第一映射列表,确定与视图对象标识对应的模型对象标识以及模型对象名称;Determine the model object identifier and the model object name corresponding to the view object identifier according to the preset first mapping list; 根据所确定的模型对象名称,调用预设的对象生成函数,生成对象;According to the determined model object name, call the preset object generation function to generate the object; 将所确定的模型对象标识以及所述待显示数据封装在所生成的对象中,得到模型对象。Encapsulate the determined model object identifier and the data to be displayed in the generated object to obtain a model object. 8.根据权利要求6所述的装置,其中,所述视图对象创建单元进一步被配置成:8. The apparatus according to claim 6, wherein the view object creation unit is further configured to: 解析所创建的模型对象,得到模型对象标识;Parse the created model object to obtain the model object identifier; 根据所述第二映射列表,确定解析得到的模型对象标识对应的视图对象名称;According to the second mapping list, determine the name of the view object corresponding to the model object identifier obtained by parsing; 根据所确定的视图对象名称,调用预设的对象生成函数,生成视图对象。According to the determined name of the view object, a preset object generation function is invoked to generate the view object. 9.根据权利要求6所述的装置,其中,所述装置还包括:9. The apparatus of claim 6, wherein the apparatus further comprises: 请求发送单元,被配置成在所述数据接收单元接收以及解析服务端返回的数据之前,响应于检测到用户触发的页面生成操作,向服务端发送数据获取请求。The request sending unit is configured to send a data acquisition request to the server in response to detecting a user-triggered page generation operation before the data receiving unit receives and parses the data returned by the server. 10.根据权利要求6所述的装置,其中,所述装置还包括视图切换单元,被配置成:10. The device according to claim 6, wherein the device further comprises a view switching unit configured to: 响应于检测到用户触发的视图切换操作,调用与所述视图切换操作对应的布局函数以更改所创建的视图对象的布局;In response to detecting a user-triggered view switching operation, calling a layout function corresponding to the view switching operation to change the layout of the created view object; 根据所创建的视图对象更改后的布局,得到切换视图的页面。According to the changed layout of the created view object, the page for switching views is obtained. 11.一种终端,包括:11. A terminal, comprising: 一个或多个处理器;one or more processors; 存储装置,其上存储有一个或多个程序,a storage device on which one or more programs are stored, 当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-5中任一所述的方法。When the one or more programs are executed by the one or more processors, the one or more processors are made to implement the method according to any one of claims 1-5. 12.一种计算机可读介质,其上存储有计算机程序,其中,该程序被处理器执行时实现如权利要求1-5中任一所述的方法。12. A computer-readable medium, on which a computer program is stored, wherein, when the program is executed by a processor, the method according to any one of claims 1-5 is realized.
CN201810380514.2A 2018-04-25 2018-04-25 Method and device for generating pages Pending CN110413920A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810380514.2A CN110413920A (en) 2018-04-25 2018-04-25 Method and device for generating pages

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810380514.2A CN110413920A (en) 2018-04-25 2018-04-25 Method and device for generating pages

Publications (1)

Publication Number Publication Date
CN110413920A true CN110413920A (en) 2019-11-05

Family

ID=68345489

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810380514.2A Pending CN110413920A (en) 2018-04-25 2018-04-25 Method and device for generating pages

Country Status (1)

Country Link
CN (1) CN110413920A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113176952A (en) * 2021-04-20 2021-07-27 海南视联大健康智慧医疗科技有限公司 Data processing method and device and readable storage medium
CN115328606A (en) * 2022-09-01 2022-11-11 杭州长川科技股份有限公司 Data visualization method and device and server
CN115618147A (en) * 2022-09-29 2023-01-17 北京车智赢科技有限公司 Page updating method, device, computing device and storage medium
CN118484185A (en) * 2024-05-27 2024-08-13 国电南瑞南京控制系统有限公司 A scenario-based application customization method and system for a substation digital system

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1614927A (en) * 2004-11-18 2005-05-11 北京锐安科技有限公司 Method for realizing tree-shaped structure in B/S structure
CN1749995A (en) * 2004-09-15 2006-03-22 微软公司 Creation and management of content-related objects
US20080201339A1 (en) * 2007-02-21 2008-08-21 Mcgrew Robert J Providing unique views of data based on changes or rules
US8966356B1 (en) * 2012-07-19 2015-02-24 Google Inc. Providing views of three-dimensional (3D) object data models
CN106126249A (en) * 2016-06-29 2016-11-16 武汉斗鱼网络科技有限公司 A kind of method and system realizing behavior, data, view linkage in front end
CN106446292A (en) * 2016-11-16 2017-02-22 北京集奥聚合科技有限公司 Front-end data two-way binding achieving method and device
CN106528601A (en) * 2016-09-23 2017-03-22 北京五八信息技术有限公司 Method and device for dynamically configuring module
CN106874471A (en) * 2017-02-16 2017-06-20 北京百度网讯科技有限公司 Information-pushing method and device
CN107391736A (en) * 2017-08-07 2017-11-24 玫瑰视界(北京)网络科技有限公司 A kind of page display method and device
CN107609199A (en) * 2017-10-24 2018-01-19 网易无尾熊(杭州)科技有限公司 A kind of method, equipment and storage medium for handling and recovering the page
EP3282679A1 (en) * 2015-04-27 2018-02-14 Huawei Technologies Co. Ltd. Method for displaying view and terminal device
CN107766428A (en) * 2017-09-15 2018-03-06 北京大学 A kind of automatic method and system for realizing data visualization

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1749995A (en) * 2004-09-15 2006-03-22 微软公司 Creation and management of content-related objects
CN1614927A (en) * 2004-11-18 2005-05-11 北京锐安科技有限公司 Method for realizing tree-shaped structure in B/S structure
US20080201339A1 (en) * 2007-02-21 2008-08-21 Mcgrew Robert J Providing unique views of data based on changes or rules
US8966356B1 (en) * 2012-07-19 2015-02-24 Google Inc. Providing views of three-dimensional (3D) object data models
EP3282679A1 (en) * 2015-04-27 2018-02-14 Huawei Technologies Co. Ltd. Method for displaying view and terminal device
CN106126249A (en) * 2016-06-29 2016-11-16 武汉斗鱼网络科技有限公司 A kind of method and system realizing behavior, data, view linkage in front end
CN106528601A (en) * 2016-09-23 2017-03-22 北京五八信息技术有限公司 Method and device for dynamically configuring module
CN106446292A (en) * 2016-11-16 2017-02-22 北京集奥聚合科技有限公司 Front-end data two-way binding achieving method and device
CN106874471A (en) * 2017-02-16 2017-06-20 北京百度网讯科技有限公司 Information-pushing method and device
CN107391736A (en) * 2017-08-07 2017-11-24 玫瑰视界(北京)网络科技有限公司 A kind of page display method and device
CN107766428A (en) * 2017-09-15 2018-03-06 北京大学 A kind of automatic method and system for realizing data visualization
CN107609199A (en) * 2017-10-24 2018-01-19 网易无尾熊(杭州)科技有限公司 A kind of method, equipment and storage medium for handling and recovering the page

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
JOE CONWAY 等: "《IOS编程 第3版》", 31 March 2013, 华中科技大学出版社, pages: 8 - 11 *
乔淑夷: "基于MVC模式的Web前端框架关键技术研究与实现", 中国优秀硕士学位论文全文数据库 *
科尔 等: "《iOS编程》", 31 January 2015, 华中科技大学出版社, pages: 3 - 5 *
陆惠恩 等: "《软件工程》", 31 August 2016, 上海交通大学出版社, pages: 284 - 288 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113176952A (en) * 2021-04-20 2021-07-27 海南视联大健康智慧医疗科技有限公司 Data processing method and device and readable storage medium
CN115328606A (en) * 2022-09-01 2022-11-11 杭州长川科技股份有限公司 Data visualization method and device and server
CN115618147A (en) * 2022-09-29 2023-01-17 北京车智赢科技有限公司 Page updating method, device, computing device and storage medium
CN118484185A (en) * 2024-05-27 2024-08-13 国电南瑞南京控制系统有限公司 A scenario-based application customization method and system for a substation digital system

Similar Documents

Publication Publication Date Title
US10990644B2 (en) Systems and methods for contextual vocabularies and customer segmentation
CN108022586B (en) Method and apparatus for controlling pages
US9495881B2 (en) System and method for displaying multiple applications
US10614155B2 (en) Single page application authoring in a content management system
WO2021223752A1 (en) Display method and apparatus, and electronic device
WO2023040443A1 (en) Method and device for drawing canvas
CN104995601B (en) Switching to and from native web applications
CN110321544A (en) Method and apparatus for generating information
CN111324833A (en) Page display method, apparatus, electronic design and computer readable medium
US20240292052A1 (en) Page display method and apparatus, electronic device and storage medium
CN110413920A (en) Method and device for generating pages
WO2020199659A1 (en) Method and apparatus for determining push priority information
CN113342450A (en) Page processing method and device, electronic equipment and computer readable medium
CN113407882A (en) Component generation method and device, computer-readable storage medium and electronic equipment
CN112486482A (en) Page display method and device
WO2024011899A1 (en) Widget loading method and apparatus, device, and storage medium
CN115080154A (en) Page display method and device, storage medium and electronic equipment
WO2018177032A1 (en) Method and device for processing response data, client device and electronic device
CN106886594A (en) For the method and apparatus of exhibition information
CN115145560B (en) Business orchestration method, apparatus, device, computer-readable medium, and program product
CN110618811B (en) Information presentation methods and devices
WO2022216926A1 (en) Intelligent assistant content generation
CN111506848A (en) Webpage processing method, device, equipment and readable storage medium
CN111767290B (en) Method and device for updating user portrait
CN107341237A (en) Method and apparatus for processing information

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20191105

RJ01 Rejection of invention patent application after publication