Nothing Special   »   [go: up one dir, main page]

CN114416085B - Data processing method and device, electronic equipment and storage medium - Google Patents

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

Info

Publication number
CN114416085B
CN114416085B CN202111676626.0A CN202111676626A CN114416085B CN 114416085 B CN114416085 B CN 114416085B CN 202111676626 A CN202111676626 A CN 202111676626A CN 114416085 B CN114416085 B CN 114416085B
Authority
CN
China
Prior art keywords
view
fragment
offset address
application program
views
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.)
Active
Application number
CN202111676626.0A
Other languages
Chinese (zh)
Other versions
CN114416085A (en
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 58 Information Technology Co Ltd
Original Assignee
Beijing 58 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 58 Information Technology Co Ltd filed Critical Beijing 58 Information Technology Co Ltd
Priority to CN202111676626.0A priority Critical patent/CN114416085B/en
Publication of CN114416085A publication Critical patent/CN114416085A/en
Application granted granted Critical
Publication of CN114416085B publication Critical patent/CN114416085B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Computing Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides a data processing method, a data processing device, electronic equipment and a storage medium. By the application, the offset address of Fragment in the application program can be searched in the attribute field of View in the stage of developing the application program. And under the condition that the offset address of the Fragment in the application program is not found in the attribute field of the View, the offset address of the Fragment in the application program is found in the attribute field of the View at the upper stage of the cascade of the views in the cascade of the plurality of views, and the like, until the offset address of the Fragment in the application program is found in the attribute field of the View with the cascade sequence of the first order in the cascade of the plurality of views, the method is packaged into a calling function, and the calling function can be called by the views and has a function name. The application can reduce the workload of developers, can reduce the labor cost, can reduce the code quantity in fragments, can reduce the complexity of the codes of fragments, and can reduce the later maintenance cost.

Description

Data processing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a data processing method, a data processing device, an electronic device, and a storage medium.
Background
A Fragment is a display control in the android operating system, on which a View can be created, and on which a View can be created in superposition to form a cascade of views.
View is a control in the android operating system for displaying a user interface, and displaying data on a Fragment can be considered displaying data on View in the Fragment.
In order to separate the data to be displayed, the logic of displaying the data and the logic of processing the user interaction data so as to conform to the principle of single responsibility, view may be responsible for displaying the data and processing the user interaction data, but may not be responsible for storing and acquiring the data, etc., and the storing and acquiring of the data may be submitted to View-Model in Fragment. That is, the data that the View needs to render can be obtained through the View-Model, and the data that the View needs to render can be stored in the View-Model.
Disclosure of Invention
The application discloses a data processing method, a data processing device, electronic equipment and a storage medium.
In a first aspect, the present application shows a data processing method, applied to a terminal, where an application is installed on the terminal, the application has a Fragment, the Fragment includes a View Model View-Model and a plurality of cascaded views, an offset address of the Fragment in the application is stored in an attribute field in a View in which a cascade order in the plurality of cascaded views is a first order, and the View-Model includes data that the views need to render, and the method includes:
For a target View in a plurality of views in cascade, searching an offset address of the Fragment in the application program in an attribute field of the target View under the condition that the target View needs to render data;
Searching the offset address of the Fragment in the application program in the attribute field of the last-level View of the target View in the cascade of multiple views under the condition that the offset address of the Fragment in the application program is not searched in the attribute field of the target View, and the like until the offset address of the Fragment in the application program is searched in the attribute field of the View with the cascade sequence of the first in the cascade of multiple views;
Retrieving data to be rendered of the target View from the View-Model at least according to the offset address of the Fragment in the application program;
Rendering the retrieved data based on the target View.
In an optional implementation manner, the searching the offset address of the Fragment in the application program in the attribute field of the target View includes:
Acquiring the identification information of the Fragment of the target View recorded in the target View;
searching an offset address bound with the identification information of the Fragment in an attribute field of the target View;
In the case that the offset address bound to the identification information of the Fragment is not found, determining that the offset address of the Fragment in the application is not found;
Or under the condition that the offset address bound with the identification information of the Fragment is found, the offset address of the Fragment in the application program can be obtained according to the found offset address.
In an alternative implementation, the View-Model included in the Fragment is a plurality of, and the different views-Model includes data that needs to be rendered by different views in the Fragment;
The method for calling the data to be rendered of the target View from the View-Model at least according to the offset address of the Fragment in the application program comprises the following steps:
And invoking data to be rendered of the target View from the View-Model corresponding to the target View at least according to the offset address of the Fragment in the application program and the identification information of the target View.
In a second aspect, the present application shows a data processing method, a development environment of an application program is provided on a terminal, the development environment has developed a Fragment of the application program, the Fragment includes a View Model View-Model and a plurality of views cascaded, each View is used for rendering data, and the View-Model includes data that the View needs to render, the method includes:
For a target View needing to render data in a plurality of views in cascade, adding a calling function in the target View according to input writing operation of a developer;
And determining a View with a cascade order being the first in a plurality of views in cascade during compiling the fragments developed in the development environment, and storing an offset address of the Fragment in the application in an attribute field in the View with the cascade order being the first;
wherein the calling function is used for: searching the offset address of the Fragment in the application program in the attribute field of the View, and searching the offset address of the Fragment in the application program in the attribute field of the last-level View of the cascade of views in the cascade of multiple views under the condition that the offset address of the Fragment in the application program is not found in the attribute field of the View, and the like until the offset address of the Fragment in the application program is found in the attribute field of the View with the cascade sequence of the first in the cascade of multiple views.
In an optional implementation manner, the storing, in an attribute field in View of which cascade order is first, an offset address of the Fragment in the application program includes:
Acquiring the identification information of the fragments;
Binding the identification information of the fragments and the offset address of the fragments in the application program;
And storing the identification information of the fragments and the offset address of the fragments in the application program which are bound in an attribute field in the View with the cascade sequence being the first bit.
In a third aspect, the present application provides a data processing apparatus, applied to a terminal, where an application is installed on the terminal, the application has a Fragment, the Fragment includes a View Model View-Model and multiple views cascaded, an offset address of the Fragment in the application is stored in an attribute field in a View in which a cascade order in the multiple views cascaded is a first order, and the View-Model includes data that the View needs to render, and the apparatus includes:
The first searching module is used for searching an offset address of the Fragment in the application program in an attribute field of the target View under the condition that the target View needs to render data for the target View in the plurality of cascaded views;
A second search module, configured to search, when the offset address of the Fragment in the application is not found in the attribute fields of the target View, the offset address of the Fragment in the application in the attribute field of the last-level View in the cascade of the target views in the plurality of views in the cascade, and so on, until the offset address of the Fragment in the application is found in the attribute field in the View in which the cascade order in the plurality of views in the cascade is the first;
the calling module is used for calling the data needing to be rendered of the target View from the View-Model at least according to the offset address of the Fragment in the application program;
and the rendering module is used for rendering the fetched data based on the target View.
In an alternative implementation, the first search module includes:
a first obtaining unit, configured to obtain identification information of the Fragment, where the target View belongs to, recorded in the target View;
The searching unit is used for searching an offset address bound with the identification information of the Fragment in the attribute field of the target View;
A determining unit, configured to determine that an offset address of the Fragment in the application program is not found, in a case where the offset address bound to the identification information of the Fragment is not found;
And the second acquisition unit is used for acquiring the offset address of the Fragment in the application program according to the searched offset address under the condition that the offset address bound with the identification information of the Fragment is searched.
In an alternative implementation, the View-Model included in the Fragment is a plurality of, and the different views-Model includes data that needs to be rendered by different views in the Fragment;
The calling module is specifically used for: and invoking data to be rendered of the target View from the View-Model corresponding to the target View at least according to the offset address of the Fragment in the application program and the identification information of the target View.
In a fourth aspect, the present application shows a data processing apparatus, having a development environment of an application program on a terminal, where a Fragment of the application program has been developed in the development environment, the Fragment includes a View Model View-Model and a plurality of views in cascade, each View is used for rendering data, and the View-Model includes data that the View needs to render, the apparatus includes:
The adding module is used for adding a calling function into a target View to be rendered of data in a plurality of views in cascade according to input writing operation of a developer;
The determining module is used for determining a View with the cascade sequence being the first in a plurality of views in cascade in the process of compiling the fragments developed in the development environment, and the storing module is used for storing the offset address of the Fragment in the application program in an attribute field in the View with the cascade sequence being the first;
wherein the calling function is used for: searching the offset address of the Fragment in the application program in the attribute field of the View, and searching the offset address of the Fragment in the application program in the attribute field of the last-level View of the cascade of views in the cascade of multiple views under the condition that the offset address of the Fragment in the application program is not found in the attribute field of the View, and the like until the offset address of the Fragment in the application program is found in the attribute field of the View with the cascade sequence of the first in the cascade of multiple views.
In an alternative implementation, the storage module includes:
a third obtaining unit, configured to obtain identification information of the Fragment;
A binding unit, configured to bind the identification information of the Fragment and an offset address of the Fragment in an application program;
and the storage unit is used for storing the identification information of the fragments and the offset address of the fragments in the application program in the attribute field in the View with the cascade sequence being the first bit.
In a fifth aspect, the present application shows an electronic device comprising:
A processor;
a memory for storing processor-executable instructions;
Wherein the processor is configured to perform the data processing method according to the first aspect.
In a sixth aspect, the application features a non-transitory computer readable storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform the data processing method of the first aspect.
In a seventh aspect, the application shows a computer program product, which when executed by a processor of an electronic device, causes the electronic device to perform the data processing method according to the first aspect.
In an eighth aspect, the present application shows an electronic device comprising:
A processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the data processing method as described in the second aspect.
In a ninth aspect, the application features a non-transitory computer readable storage medium that, when executed by a processor of an electronic device, enables the electronic device to perform a data processing method as described in the second aspect.
In a tenth aspect, the application shows a computer program product which, when executed by a processor of an electronic device, enables the electronic device to perform the data processing method according to the second aspect.
The technical scheme provided by the application can comprise the following beneficial effects:
In the application, for a target View in a plurality of views in cascade, when the target View needs to render data, the offset address of Fragment in an application program is searched in the attribute field of the target View. And under the condition that the offset address of the Fragment in the application program is not found in the attribute field of the target View, the offset address of the Fragment in the application program is found in the attribute field of the higher-level View of the cascade of the target views in the plurality of cascaded views, and the like until the offset address of the Fragment in the application program is found in the attribute field of the View with the cascade sequence of the first in the plurality of cascaded views. And calling the data to be rendered of the target View from the View-Model at least according to the offset address of the Fragment in the application program. The invoked data is rendered based on the target View.
By the application, the offset address of Fragment in the application program can be searched in the attribute field of View in the stage of developing the application program. And under the condition that the offset address of the Fragment in the application program is not found in the attribute field of the View, the offset address of the Fragment in the application program is found in the attribute field of the View at the upper stage of the cascade of the views in the cascade of the plurality of views, and the like, until the offset address of the Fragment in the application program is found in the attribute field of the View with the cascade sequence of the first order in the cascade of the plurality of views, the method is packaged into a calling function, and the calling function can be called by the views and has a function name.
Second, the offset address of Fragment in the application may be stored in the attribute field in the View of which cascade order is the first in the plurality of views of cascade in the stage of developing the application,
Thus, for any View in the fragments, if the View has a need to call the data to be rendered of the View from the View-Model according to the offset address of the Fragment in the application, a developer can directly introduce the function name of the function in the View when writing the computer program code of the Fragment, so that the effect that the attribute field of the View is provided with the offset address of the Fragment in the application. And searching the offset address of the Fragment in the application program in the attribute field of the higher-level View of the cascade of the plurality of views under the condition that the offset address of the Fragment in the application program is not searched in the attribute field of the View, and the like until the offset address of the Fragment in the application program is searched in the attribute field of the View with the cascade sequence of the first in the cascade of the plurality of views. That is, the function of acquiring the offset address of the Fragment in the application program for the View can be realized.
The same is true for each of the other views in the Fragment.
Thus, the developer can realize the function of acquiring the offset address of the Fragment in the application program for each of the plurality of views by developing the calling function and multiplexing the calling function for the plurality of views in the Fragment. The same is true for other fragments in the application. That is, other fragments may multiplex the calling function.
Thus, the application can reduce the workload of developers, can reduce the labor cost, can reduce the code quantity in fragments, can reduce the complexity of the codes of fragments, and can reduce the maintenance cost in the later period.
Drawings
FIG. 1 is a flow chart of the steps of a data processing method of the present application.
Fig. 2 is a block diagram of a data processing apparatus of the present application.
Fig. 3 is a block diagram of a data processing apparatus of the present application.
Fig. 4 is a block diagram of an electronic device of the present application.
Fig. 5 is a block diagram of an electronic device of the present application.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
When the View needs to render data, the View-Model can be accessed through a View Model provider of function, and the data needed to be rendered by the View in the View-Model is called, and then the data needed to be rendered by the View can be rendered in the View.
However, in one case, for any one of the fragments, if the View-Model is accessed through a ViewModelProviders. Of function, then the "Fragment's offset address in the application" needs to be entered in the ViewModelProviders. Of function.
But before entering the "Fragment in offset address in application" in the viewmodelprovider. Of function, it is first necessary to get the "Fragment in application offset address".
However, for any one View in the Fragment, the View can only interact directly with the View of the previous level in the View cascade, i.e., the View can only pass data with the View of the previous level in the View cascade.
In one case, the cascade between multiple views in a Fragment is more in level, and if it is required to obtain "offset address of Fragment in application" for a View at a deeper level, it is required to pass "offset address of Fragment in application" to the View sequentially through all views of the View cascade via Fragment.
However, in this case, when a developer develops the computer program code of the Fragment, it is necessary to write the computer program code of "transfer the offset address' of the Fragment in the application from the Fragment to the View" sequentially through all the upper-level views of the View cascade.
Thus, for each higher-level View of the Fragment and the View cascade, the computer program code for transmitting (or called acquiring, etc) "the offset address of the Fragment in the application program" needs to be written, and for one View in a deeper level, several higher-level views are cascaded, and the computer program code for transmitting "the offset address of the Fragment in the application program" needs to be written for several views for several times, which results in large development workload of developers, high labor cost, and large code quantity in the Fragment, which results in high post-maintenance cost.
Through analysis of the foregoing manner, the inventors have abandoned the idea of the foregoing manner, and have not written computer program code for "passing the offset address of 'Fragment in application from Fragment' to the View through all the upper-level views of the View cascade in order, but set the offset address of Fragment in application in attribute fields in the View of which cascade order is the first among the plurality of views of the cascade.
And, a developer may develop a calling function.
Among other things, the function may take the following roles: "find the offset address of Fragment in application in the attribute field of View". If the offset address of the Fragment in the application program is not found in the attribute field of the View, the offset address of the Fragment in the application program is found in the attribute field of the View at the upper level of the cascade of the views in the cascade of the views, and so on until the offset address of the Fragment in the application program is found in the attribute field of the View in the cascade order of the first View in the cascade of the views.
The call function may be called by View, the call function having a function name.
Thus, for any View in the fragments, if the View has a need to call the data to be rendered of the View from the View-Model according to the offset address of the Fragment in the application, a developer can directly introduce the function name of the function in the View when writing the computer program code of the Fragment, so that the effect that the attribute field of the View is provided with the offset address of the Fragment in the application. And searching the offset address of the Fragment in the application program in the attribute field of the higher-level View of the cascade of the plurality of views under the condition that the offset address of the Fragment in the application program is not searched in the attribute field of the View, and the like until the offset address of the Fragment in the application program is searched in the attribute field of the View with the cascade sequence of the first in the cascade of the plurality of views. That is, the function of acquiring the offset address of the Fragment in the application program for the View can be realized.
The same is true for each of the other views in the Fragment.
Thus, the developer can realize the function of acquiring the offset address of the Fragment in the application program for each of the plurality of views by developing the calling function and multiplexing the calling function for the plurality of views in the Fragment. The same is true for other fragments in the application. That is, other fragments may multiplex the calling function.
Thus, the application can reduce the workload of developers, can reduce the labor cost, can reduce the code quantity in fragments, can reduce the complexity of the codes of fragments, and can reduce the maintenance cost in the later period.
Specifically, referring to fig. 1, a step flow chart of a data processing method of the present application is shown, and the step flow chart is applied to a terminal, an application program is installed on the terminal, the application program has fragments, the fragments include View-Model and multiple views in cascade, and an offset address of the Fragment in the application program is stored in an attribute field in the View of which cascade order in the multiple views in cascade is the first. Each View is used for rendering data, the View-Model includes data that the View needs to render, and the method specifically includes the following steps:
In step S101, for a target View of the multiple views in cascade, if the target View needs to render data, an offset address of Fragment in the application is searched in an attribute field of the target View.
In the present application, the target View may be any one View among a plurality of views, and the like. The flow of step S101 to step S104 of the present application may be executed for a target View among a plurality of views, and the flow of step S101 to step S104 of the present application may be executed for each other View among a plurality of views.
Wherein, a page of the application program can be developed based on fragments, and the fragments comprise a plurality of views in cascade, so that the page is represented as follows: the page includes a plurality of views cascaded, etc.
Each View has data to be rendered. The data to be rendered by the View in the present application may be uniformly managed by the View-Model included in the Fragment, and thus, for the View, only the data to be rendered may be concerned with the View-Model included in the Fragment, and the data may be rendered without the need for the View to be concerned with how the data to be rendered is generated or where from, and the like.
Under the condition that the target View needs to render data, the data to be rendered of the target View can be called from the View-Model, in order to call the data to be rendered of the target View from the View-Model, an offset address of the Fragment in the application program needs to be obtained, then the data to be rendered of the target View is called from the View-Model according to the offset address of the Fragment in the application program, and then the data to be rendered of the target View is rendered based on the target View.
In order to obtain the offset address of the Fragment in the application program, in one embodiment of the present application, in the process of developing the application program in advance, (a developer) develops the Fragment for the application program in the development environment of the application program, and develops a plurality of views cascaded for the Fragment.
In the case of compiling fragments in a development environment, a View whose cascade order is the first may be automatically determined among a plurality of views cascaded.
In this case, the cascade order among the plurality of views included in the Fragment may be set by a developer, for example, in a development environment, etc., and thus, the View, etc., whose cascade order is the first, may be automatically determined among the plurality of views in cascade according to the cascade relationship among the plurality of views included in the Fragment set by the developer.
In addition, an offset address of the Fragment in the application program can be determined, and then the offset address of the Fragment in the application program can be stored in an attribute field in the View with the cascade order being the first.
In one embodiment, the data may be stored in the form of key-value pairs in the attribute field in the View with the concatenation order first.
In this way, when the offset address of the Fragment in the application is stored in the attribute field in the View with the cascade order being the first, in order to uniquely identify the offset address of the Fragment in the application, the identification information of the Fragment may be acquired, where the identification information of different fragments in the application may be different, and the identification information of the Fragment may be located in the attribute field of the Fragment, so that the identification information of the Fragment may be acquired from the attribute field of the Fragment.
The identification information of fragments is then bound to the offset address of the fragments in the application. For example, identification information of fragments and offset addresses of fragments in an application are combined into key-value pairs. In one example, for example, in the case where the key-value pair is a "key-value pair, then the identification information of the Fragment may be key, and the offset address of the Fragment in the application may be value, or the like.
The identification information of the binding fragments and the offset address of the fragments in the application may then be stored in the attribute field in the View with the concatenation order first, for example, a "key-value" key value pair including the identification information of the fragments and the offset address of the fragments in the application is stored.
Thus, when the offset address of the Fragment in the application program is searched in the attribute field of the target View, the identification information of the Fragment which belongs to the target View and is recorded in the target View can be obtained.
For example, the identification information of the Fragment to which the target View belongs may be stored in a specific field in the target View, and thus the identification information of the Fragment to which the target View belongs may be acquired in the specific field in the target View.
The offset address bound to the identification information of the Fragment may then be found in the attribute field of the target View, e.g., a key-value peer including "key with identification information of Fragment" may be found in the attribute field of the target View.
In the case where a key value pair including the identification information of Fragment as a key is not found in the attribute field of the target View, it may be determined that an offset address bound to the identification information of Fragment is not found. Or when a key value pair including "key information about Fragment" is found in the attribute field of the target View, the found value "offset address" in the key value pair "key information about Fragment" may be used as the offset address bound to the identification information about Fragment.
In the case where the offset address bound to the identification information of the Fragment is not found, it may be determined that the offset address of the Fragment in the application is not found.
Or in the case of finding an offset address bound to the identification information of the Fragment, the offset address of the Fragment in the application may be obtained according to the found offset address, for example, the found offset address may be used as the offset address of the Fragment in the application, or the like.
In step S102, when the offset address of the Fragment in the application is not found in the attribute field of the target View, the offset address of the Fragment in the application is found in the attribute field of the last-level View of the cascade of the target views in the plurality of views of the cascade, and so on, until the offset address of the Fragment in the application is found in the attribute field of the View in the cascade order first in the plurality of views of the cascade.
When the offset address of the Fragment in the application is searched in the attribute field of the target View, in one embodiment of the present application, if the target View is the View with the cascade order of the Fragment being the first, the offset address of the Fragment in the application can be searched in the attribute field of the target View, and then step S103 can be executed.
However, in another embodiment of the present application, if the target View is not the View with the cascade order first in the fragments, the offset address of the Fragment in the application is not found in the attribute field of the target View, and in order to obtain the offset address of the Fragment in the application, the offset address of the Fragment in the application may be found in the attribute field of the last-level View (adjacent) of the cascade of the target views in the multiple cascaded views.
In this case, a cascade relationship between multiple views in a Fragment is recorded in the Fragment of the application, and for example, identification information and the like of views (adjacent) of the upper stage of the View cascade of the lower stage are recorded in a cascade field in the views of the lower stage.
In this way, when the offset address of the Fragment in the application program is not found in the attribute field of the target View, the identification information of the last-level View (and adjacent) of the cascade of the target views can be obtained in the cascade field of the target View, the identification information of different views is different, then the last-level View of the cascade of the target views can be determined in the multiple views of the cascade according to the identification information of the last-level View of the cascade of the target views, and then the offset address of the Fragment in the application program is found in the attribute field of the last-level View of the cascade of the target views in the multiple views of the cascade.
In one embodiment of the present application, if the View of the upper level of the target View cascade is the View of which cascade order is the first in the fragments, the offset address of the fragments in the application program can be found in the attribute field of the View of the upper level of the target View cascade, and then step S103 can be executed.
However, in another embodiment of the present application, if the previous View of the target View cascade is a View whose cascade order is not the first order in the views, the offset address of the Fragment in the application is not found in the attribute field of the previous View of the target View cascade, and in order to be able to obtain the offset address of the Fragment in the application, the offset address of the Fragment in the application may be found in the attribute field of the next-to-last View (adjacent) of the previous View cascade of the multiple views cascade, and so on, until the offset address of the Fragment in the application is found in the attribute field of the View whose cascade order is the first order in the multiple views, and then step S103 may be performed.
In step S103, the data to be rendered of the target View is fetched from the View-Model at least according to the offset address of the Fragment in the application.
In one embodiment of the present application, the data returned by the ViewModelProviders. Of function may be obtained by entering the "offset address of Fragment in the application" in the acquisition function (e.g. ViewModel Providers. Of, etc.), and the data to be rendered of the target View may be screened out from the returned data.
In the above embodiment, the Fragment includes one View-Model, and the View-Model includes data that all views in the Fragment need to be rendered, that is, the View-Model in the Fragment and the views in the Fragment are in one-to-many relation, the acquisition function may return the data that all views included in the Fragment need to be rendered, and then screen the data that the target View needs to be rendered based on the data that the target View needs to be rendered in all views included in the returned Fragment.
However, the logic in the above manner is complex, which consumes more system resources. Therefore, in order to save system resources, in another embodiment of the present application, in the process of developing an application program, respective corresponding View-models may be developed for different views in the Fragment, where each View-Model is used to manage data that needs to be rendered by different views.
Thus, the View-Model included in the Fragment is multiple, and different views may include data that needs to be rendered by different views.
Thus, when the data to be rendered of the target View is called from the View-Model at least according to the offset address of the Fragment in the application program, the data to be rendered of the target View can be called from the View-Model corresponding to the target View at least according to the offset address of the Fragment in the application program and the identification information of the target View.
The identification information of the View recorded in the View-Model corresponding to each View can be used for indexing the View-Model corresponding to the View according to the identification information of the View.
For example, the developer may modify the acquisition function (e.g., viewModel displays of the related art) in advance, so that the acquisition function may have at least two input parameters, where the at least two input parameters may include an offset address of the Fragment in the application program and identification information of the target View, so that the acquisition function may access a View-Model corresponding to the target View according to the offset address of the Fragment in the application program and the identification information of the target View, and access data to be rendered of the target View from the View-Model corresponding to the target View, and return the data to be rendered of the target View. The terminal can obtain the data which is returned by the acquisition function and needs to be rendered of the target View.
In addition, the embodiment can manage the data needing to be rendered by different views through different views-Model, so that the independence of the views-Model corresponding to each View is improved.
Thus, in the case where one View is multiplexed in different fragments as needed, the View developed in one Fragment and the View-Model corresponding to the View can be directly copied or imported into another Fragment, without the need to import one View-Model of the View and the data to be rendered including all views in the one Fragment into another Fragment, redundancy of the other Fragment can be reduced, and the like.
In step S104, the retrieved data is rendered based on the target View.
In the application, any currently existing rendering mode can be used for rendering the fetched data based on the target View, and the application is not limited to the specific rendering mode.
In the application, for a target View in a plurality of views in cascade, when the target View needs to render data, the offset address of Fragment in an application program is searched in the attribute field of the target View. And under the condition that the offset address of the Fragment in the application program is not found in the attribute field of the target View, the offset address of the Fragment in the application program is found in the attribute field of the higher-level View of the cascade of the target views in the plurality of cascaded views, and the like until the offset address of the Fragment in the application program is found in the attribute field of the View with the cascade sequence of the first in the plurality of cascaded views. And calling the data to be rendered of the target View from the View-Model at least according to the offset address of the Fragment in the application program. The invoked data is rendered based on the target View.
By the application, the offset address of Fragment in the application program can be searched in the attribute field of View in the stage of developing the application program. And under the condition that the offset address of the Fragment in the application program is not found in the attribute field of the View, the offset address of the Fragment in the application program is found in the attribute field of the View at the upper stage of the cascade of the views in the cascade of the plurality of views, and the like, until the offset address of the Fragment in the application program is found in the attribute field of the View with the cascade sequence of the first order in the cascade of the plurality of views, the method is packaged into a calling function, and the calling function can be called by the views and has a function name.
Second, the offset address of Fragment in the application may be stored in the attribute field in the View of which cascade order is the first in the plurality of views of cascade in the stage of developing the application,
Thus, for any View in the fragments, if the View has a need to call the data to be rendered of the View from the View-Model according to the offset address of the Fragment in the application, a developer can directly introduce the function name of the function in the View when writing the computer program code of the Fragment, so that the effect that the attribute field of the View is provided with the offset address of the Fragment in the application. And searching the offset address of the Fragment in the application program in the attribute field of the higher-level View of the cascade of the plurality of views under the condition that the offset address of the Fragment in the application program is not searched in the attribute field of the View, and the like until the offset address of the Fragment in the application program is searched in the attribute field of the View with the cascade sequence of the first in the cascade of the plurality of views. That is, the function of acquiring the offset address of the Fragment in the application program for the View can be realized.
The same is true for each of the other views in the Fragment.
Thus, the developer can realize the function of acquiring the offset address of the Fragment in the application program for each of the plurality of views by developing the calling function and multiplexing the calling function for the plurality of views in the Fragment. The same is true for other fragments in the application. That is, other fragments may multiplex the calling function.
Thus, the application can reduce the workload of developers, can reduce the labor cost, can reduce the code quantity in fragments, can reduce the complexity of the codes of fragments, and can reduce the maintenance cost in the later period.
It should be noted that, for simplicity of explanation, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the present application is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the application. Further, those skilled in the art will appreciate that the embodiments described in the specification are all alternative embodiments and that the actions involved are not necessarily required for the present application.
Referring to fig. 2, there is shown a block diagram of a data processing apparatus of the present application, applied to a terminal on which an application program is installed, the application program having a Fragment, the Fragment including a View Model View-Model and a plurality of views cascaded, an offset address of the Fragment in the application program being stored in an attribute field in a View of which cascade order is first in the plurality of views cascaded, the View-Model including data that the View needs to render, the apparatus comprising:
The first searching module 11 is configured to search, for a target View of multiple views in cascade, an offset address of the Fragment in the application program in an attribute field of the target View when the target View needs to render data;
a second lookup module 12, configured to, if the offset address of the Fragment in the application is not found in the attribute fields of the target View, find the offset address of the Fragment in the application in the attribute fields of the last-level View in the cascade of the target views in the plurality of views in the cascade, and so on, until the offset address of the Fragment in the application is found in the attribute fields in the views in which the cascade order in the plurality of views is the first;
A retrieving module 13, configured to retrieve data to be rendered of the target View from the View-Model at least according to an offset address of the Fragment in the application program;
and a rendering module 14, configured to render the retrieved data based on the target View.
In an alternative implementation, the first search module includes:
a first obtaining unit, configured to obtain identification information of the Fragment, where the target View belongs to, recorded in the target View;
The searching unit is used for searching an offset address bound with the identification information of the Fragment in the attribute field of the target View;
A determining unit, configured to determine that an offset address of the Fragment in the application program is not found, in a case where the offset address bound to the identification information of the Fragment is not found;
And the second acquisition unit is used for acquiring the offset address of the Fragment in the application program according to the searched offset address under the condition that the offset address bound with the identification information of the Fragment is searched.
In an alternative implementation, the View-Model included in the Fragment is a plurality of, and the different views-Model includes data that needs to be rendered by different views in the Fragment;
The calling module is specifically used for: and invoking data to be rendered of the target View from the View-Model corresponding to the target View at least according to the offset address of the Fragment in the application program and the identification information of the target View.
In the application, for a target View in a plurality of views in cascade, when the target View needs to render data, the offset address of Fragment in an application program is searched in the attribute field of the target View. And under the condition that the offset address of the Fragment in the application program is not found in the attribute field of the target View, the offset address of the Fragment in the application program is found in the attribute field of the higher-level View of the cascade of the target views in the plurality of cascaded views, and the like until the offset address of the Fragment in the application program is found in the attribute field of the View with the cascade sequence of the first in the plurality of cascaded views. And calling the data to be rendered of the target View from the View-Model at least according to the offset address of the Fragment in the application program. The invoked data is rendered based on the target View.
By the application, the offset address of Fragment in the application program can be searched in the attribute field of View in the stage of developing the application program. And under the condition that the offset address of the Fragment in the application program is not found in the attribute field of the View, the offset address of the Fragment in the application program is found in the attribute field of the View at the upper stage of the cascade of the views in the cascade of the plurality of views, and the like, until the offset address of the Fragment in the application program is found in the attribute field of the View with the cascade sequence of the first order in the cascade of the plurality of views, the method is packaged into a calling function, and the calling function can be called by the views and has a function name.
Second, the offset address of Fragment in the application may be stored in the attribute field in the View of which cascade order is the first in the plurality of views of cascade in the stage of developing the application,
Thus, for any View in the fragments, if the View has a need to call the data to be rendered of the View from the View-Model according to the offset address of the Fragment in the application, a developer can directly introduce the function name of the function in the View when writing the computer program code of the Fragment, so that the effect that the attribute field of the View is provided with the offset address of the Fragment in the application. And searching the offset address of the Fragment in the application program in the attribute field of the higher-level View of the cascade of the plurality of views under the condition that the offset address of the Fragment in the application program is not searched in the attribute field of the View, and the like until the offset address of the Fragment in the application program is searched in the attribute field of the View with the cascade sequence of the first in the cascade of the plurality of views. That is, the function of acquiring the offset address of the Fragment in the application program for the View can be realized.
The same is true for each of the other views in the Fragment.
Thus, the developer can realize the function of acquiring the offset address of the Fragment in the application program for each of the plurality of views by developing the calling function and multiplexing the calling function for the plurality of views in the Fragment. The same is true for other fragments in the application. That is, other fragments may multiplex the calling function.
Thus, the application can reduce the workload of developers, can reduce the labor cost, can reduce the code quantity in fragments, can reduce the complexity of the codes of fragments, and can reduce the maintenance cost in the later period.
Referring to fig. 3, there is shown a block diagram of a data processing apparatus of the present application, a terminal having a development environment of an application program, in which fragments of the application program have been developed, the fragments including a View Model View-Model and a plurality of views in cascade, each View being used for rendering data, and the View-Model including data that the View needs to render, the apparatus comprising:
an adding module 21, configured to add, for a target View that needs to render data from multiple views in cascade, a calling function to the target View according to an input writing operation of a developer;
a determining module 22, configured to determine, in compiling the fragments developed in the development environment, a View with a cascade order being first among multiple views in cascade, and a storing module 23, configured to store an offset address of the Fragment in the application in an attribute field in the View with the cascade order being first;
wherein the calling function is used for: searching the offset address of the Fragment in the application program in the attribute field of the View, and searching the offset address of the Fragment in the application program in the attribute field of the last-level View of the cascade of views in the cascade of multiple views under the condition that the offset address of the Fragment in the application program is not found in the attribute field of the View, and the like until the offset address of the Fragment in the application program is found in the attribute field of the View with the cascade sequence of the first in the cascade of multiple views.
In an alternative implementation, the storage module includes:
a third obtaining unit, configured to obtain identification information of the Fragment;
A binding unit, configured to bind the identification information of the Fragment and an offset address of the Fragment in an application program;
and the storage unit is used for storing the identification information of the fragments and the offset address of the fragments in the application program in the attribute field in the View with the cascade sequence being the first bit.
By the application, the offset address of Fragment in the application program can be searched in the attribute field of View in the stage of developing the application program. And under the condition that the offset address of the Fragment in the application program is not found in the attribute field of the View, the offset address of the Fragment in the application program is found in the attribute field of the View at the upper stage of the cascade of the views in the cascade of the plurality of views, and the like, until the offset address of the Fragment in the application program is found in the attribute field of the View with the cascade sequence of the first order in the cascade of the plurality of views, the method is packaged into a calling function, and the calling function can be called by the views and has a function name.
Second, the offset address of Fragment in the application may be stored in the attribute field in the View of which cascade order is the first in the plurality of views of cascade in the stage of developing the application,
Thus, for any View in the fragments, if the View has a need to call the data to be rendered of the View from the View-Model according to the offset address of the Fragment in the application, a developer can directly introduce the function name of the function in the View when writing the computer program code of the Fragment, so that the effect that the attribute field of the View is provided with the offset address of the Fragment in the application. And searching the offset address of the Fragment in the application program in the attribute field of the higher-level View of the cascade of the plurality of views under the condition that the offset address of the Fragment in the application program is not searched in the attribute field of the View, and the like until the offset address of the Fragment in the application program is searched in the attribute field of the View with the cascade sequence of the first in the cascade of the plurality of views. That is, the function of acquiring the offset address of the Fragment in the application program for the View can be realized.
The same is true for each of the other views in the Fragment.
Thus, the developer can realize the function of acquiring the offset address of the Fragment in the application program for each of the plurality of views by developing the calling function and multiplexing the calling function for the plurality of views in the Fragment. The same is true for other fragments in the application. That is, other fragments may multiplex the calling function.
Thus, the application can reduce the workload of developers, can reduce the labor cost, can reduce the code quantity in fragments, can reduce the complexity of the codes of fragments, and can reduce the maintenance cost in the later period.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
Optionally, an embodiment of the present invention further provides an electronic device, including: the processor, the memory, store the computer program on the memory and can run on the processor, this computer program realizes each process of the above-mentioned data processing method embodiment when being carried out by the processor, and can reach the same technical result, in order to avoid repetition, will not be repeated here.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, realizes the processes of the above data processing method embodiment, and can achieve the same technical effects, and in order to avoid repetition, the description is omitted here. The computer readable storage medium is, for example, a Read-Only Memory (ROM), a random access Memory (Random Access Memory RAM), a magnetic disk or an optical disk.
Fig. 4 is a block diagram of an electronic device 800 in accordance with the present application. For example, electronic device 800 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, exercise device, personal digital assistant, or the like.
Referring to fig. 4, the electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and a communication component 816.
The processing component 802 generally controls overall operation of the electronic device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interactions between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, images, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power supply component 806 provides power to the various components of the electronic device 800. The power components 806 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device 800.
The multimedia component 808 includes a screen between the electronic device 800 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and/or a rear camera. The front camera and/or the rear camera may receive external multimedia data when the device 800 is in an operational mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 further includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 814 includes one or more sensors for providing status assessment of various aspects of the electronic device 800. For example, the sensor assembly 814 may detect an on/off state of the device 800, a relative positioning of the components, such as a display and keypad of the electronic device 800, the sensor assembly 814 may also detect a change in position of the electronic device 800 or a component of the electronic device 800, the presence or absence of a user's contact with the electronic device 800, an orientation or acceleration/deceleration of the electronic device 800, and a change in temperature of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communication between the electronic device 800 and other devices, either wired or wireless. The electronic device 800 may access a wireless network based on a communication standard, such as WiFi, an operator network (e.g., 2G, 3G, 4G, or 5G), or a combination thereof. In one exemplary embodiment, the communication component 816 receives broadcast signals or broadcast operation information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for executing the methods described above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 804 including instructions executable by processor 820 of electronic device 800 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
Fig. 5 is a block diagram of an electronic device 1900 in accordance with the present application. For example, electronic device 1900 may be provided as a server.
Referring to FIG. 5, electronic device 1900 includes a processing component 1922 that further includes one or more processors and memory resources represented by memory 1932 for storing instructions, such as application programs, that can be executed by processing component 1922. The application programs stored in memory 1932 may include one or more modules each corresponding to a set of instructions. Further, processing component 1922 is configured to execute instructions to perform the methods described above.
The electronic device 1900 may also include a power component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input/output (I/O) interface 1958. The electronic device 1900 may operate based on an operating system stored in memory 1932, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, or the like.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The embodiments of the present invention have been described above with reference to the accompanying drawings, but the present invention is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those having ordinary skill in the art without departing from the spirit of the present invention and the scope of the claims, which are to be protected by the present invention.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk, etc.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (12)

1. The data processing method is characterized in that the method is applied to a terminal, an application program is installed on the terminal, the application program is provided with fragments, the fragments comprise View models View-Model and a plurality of cascaded views, the attribute fields in the views with cascade sequences of first positions in the plurality of cascaded views store offset addresses of the fragments in the application program, and the views-Model comprises data required to be rendered by the views, and the method comprises the following steps:
For a target View in a plurality of views in cascade, searching an offset address of the Fragment in the application program in an attribute field of the target View under the condition that the target View needs to render data;
Searching the offset address of the Fragment in the application program in the attribute field of the last-level View of the target View in the cascade of multiple views under the condition that the offset address of the Fragment in the application program is not searched in the attribute field of the target View, and the like until the offset address of the Fragment in the application program is searched in the attribute field of the View with the cascade sequence of the first in the cascade of multiple views;
Retrieving data to be rendered of the target View from the View-Model at least according to the offset address of the Fragment in the application program;
Rendering the retrieved data based on the target View;
the searching the offset address of the Fragment in the application program in the attribute field of the target View comprises the following steps:
Acquiring the identification information of the Fragment of the target View recorded in the target View;
searching an offset address bound with the identification information of the Fragment in an attribute field of the target View;
under the condition that the offset address bound with the identification information of the Fragment is not found, determining that the offset address of the Fragment in the application program is not found;
Or under the condition that the offset address bound with the identification information of the Fragment is found, acquiring the offset address of the Fragment in the application program according to the found offset address.
2. The method of claim 1, wherein the View-Model included in the Fragment is a plurality of, and different views-models include data that different views in the Fragment need to render;
The method for calling the data to be rendered of the target View from the View-Model at least according to the offset address of the Fragment in the application program comprises the following steps:
And invoking data to be rendered of the target View from the View-Model corresponding to the target View at least according to the offset address of the Fragment in the application program and the identification information of the target View.
3. The data processing method is characterized in that a development environment of an application program is provided on a terminal, a Fragment of the application program is developed in the development environment, the Fragment comprises a View Model View-Model and a plurality of cascaded views, each View is respectively used for rendering data, and the View-Model comprises data which need to be rendered by the views, and the method comprises the following steps:
For a target View needing to render data in a plurality of views in cascade, adding a calling function in the target View according to input writing operation of a developer;
And determining a View with a cascade order being the first in a plurality of views in cascade during compiling the fragments developed in the development environment, and storing an offset address of the Fragment in the application in an attribute field in the View with the cascade order being the first;
Wherein the calling function is used for: searching the offset address of the Fragment in the application program in the attribute field of the View, and searching the offset address of the Fragment in the application program in the attribute field of the last-level View of the cascade of views in the cascade of views under the condition that the offset address of the Fragment in the application program is not found in the attribute field of the View, and the like until the offset address of the Fragment in the application program is found in the attribute field of the View with the cascade sequence of the first in the cascade of views;
the searching the offset address of the Fragment in the application program in the attribute field of View comprises the following steps:
acquiring the identification information of the Fragment to which the View belongs, which is recorded in the View;
searching an offset address bound with the identification information of the Fragment in an attribute field of the View;
under the condition that the offset address bound with the identification information of the Fragment is not found, determining that the offset address of the Fragment in the application program is not found;
Or under the condition that the offset address bound with the identification information of the Fragment is found, acquiring the offset address of the Fragment in the application program according to the found offset address.
4. The method of claim 3, wherein storing the offset address of the Fragment in the application in the attribute field in View of the first concatenation order comprises:
Acquiring the identification information of the fragments;
Binding the identification information of the fragments and the offset address of the fragments in the application program;
And storing the identification information of the fragments and the offset address of the fragments in the application program which are bound in an attribute field in the View with the cascade sequence being the first bit.
5. The data processing device is characterized in that the device is applied to a terminal, an application program is installed on the terminal, the application program is provided with fragments, the fragments comprise View models View-Model and a plurality of cascaded views, the attribute fields in the views with cascade sequences of first positions in the plurality of cascaded views store offset addresses of the fragments in the application program, and the views-Model comprises data needed to be rendered by the views, and the device comprises:
The first searching module is used for searching an offset address of the Fragment in the application program in an attribute field of the target View under the condition that the target View needs to render data for the target View in the plurality of cascaded views;
A second search module, configured to search, when the offset address of the Fragment in the application is not found in the attribute fields of the target View, the offset address of the Fragment in the application in the attribute field of the last-level View in the cascade of the target views in the plurality of views in the cascade, and so on, until the offset address of the Fragment in the application is found in the attribute field in the View in which the cascade order in the plurality of views in the cascade is the first;
the calling module is used for calling the data needing to be rendered of the target View from the View-Model at least according to the offset address of the Fragment in the application program;
The rendering module is used for rendering the fetched data based on the target View;
The first search module includes:
a first obtaining unit, configured to obtain identification information of the Fragment, where the target View belongs to, recorded in the target View;
The searching unit is used for searching an offset address bound with the identification information of the Fragment in the attribute field of the target View;
a determining unit, configured to determine that an offset address of the Fragment in the application program is not found, if the offset address bound to the identification information of the Fragment is not found;
And the second acquisition unit is used for acquiring the offset address of the Fragment in the application program according to the searched offset address under the condition that the offset address bound with the identification information of the Fragment is searched.
6. The apparatus of claim 5, wherein the View-Model included in the Fragment is a plurality of, and different views-models include data that different views in the Fragment need to render;
The calling module is specifically used for: and invoking data to be rendered of the target View from the View-Model corresponding to the target View at least according to the offset address of the Fragment in the application program and the identification information of the target View.
7. A data processing apparatus, characterized in that a terminal has a development environment of an application program, in which fragments of the application program have been developed, the fragments including a View Model View-Model and a plurality of views in cascade, each View being used for rendering data, and the View-Model including data that the View needs to render, the apparatus comprising:
The adding module is used for adding a calling function into a target View to be rendered of data in a plurality of views in cascade according to input writing operation of a developer;
The determining module is used for determining a View with the cascade sequence being the first in a plurality of views in cascade in the process of compiling the fragments developed in the development environment, and the storing module is used for storing the offset address of the Fragment in the application program in an attribute field in the View with the cascade sequence being the first;
Wherein the calling function is used for: searching the offset address of the Fragment in the application program in the attribute field of the View, and searching the offset address of the Fragment in the application program in the attribute field of the last-level View of the cascade of views in the cascade of views under the condition that the offset address of the Fragment in the application program is not found in the attribute field of the View, and the like until the offset address of the Fragment in the application program is found in the attribute field of the View with the cascade sequence of the first in the cascade of views;
the searching the offset address of the Fragment in the application program in the attribute field of View comprises the following steps:
acquiring the identification information of the Fragment to which the View belongs, which is recorded in the View;
searching an offset address bound with the identification information of the Fragment in an attribute field of the View;
under the condition that the offset address bound with the identification information of the Fragment is not found, determining that the offset address of the Fragment in the application program is not found;
Or under the condition that the offset address bound with the identification information of the Fragment is found, acquiring the offset address of the Fragment in the application program according to the found offset address.
8. The apparatus of claim 7, wherein the storage module comprises:
a third obtaining unit, configured to obtain identification information of the Fragment;
A binding unit, configured to bind the identification information of the Fragment and an offset address of the Fragment in an application program;
and the storage unit is used for storing the identification information of the fragments and the offset address of the fragments in the application program in the attribute field in the View with the cascade sequence being the first bit.
9. An electronic device, comprising: a processor, a memory and a computer program stored on the memory and executable on the processor, which when executed by the processor performs the steps of the data processing method according to any one of claims 1 to 2.
10. A computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the steps of the data processing method according to any of claims 1 to 2.
11. An electronic device, comprising: a processor, a memory and a computer program stored on the memory and executable on the processor, which when executed by the processor performs the steps of the data processing method according to any of claims 3 to 4.
12. A computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the steps of the data processing method according to any of claims 3 to 4.
CN202111676626.0A 2021-12-31 2021-12-31 Data processing method and device, electronic equipment and storage medium Active CN114416085B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111676626.0A CN114416085B (en) 2021-12-31 2021-12-31 Data processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111676626.0A CN114416085B (en) 2021-12-31 2021-12-31 Data processing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114416085A CN114416085A (en) 2022-04-29
CN114416085B true CN114416085B (en) 2024-09-20

Family

ID=81270916

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111676626.0A Active CN114416085B (en) 2021-12-31 2021-12-31 Data processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114416085B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10956392B1 (en) * 2018-07-23 2021-03-23 Allscripts Software, Llc Methods, apparatuses, and computer program products for identifying fields in a data tree
CN113590091A (en) * 2021-06-30 2021-11-02 五八有限公司 Data processing method and device, electronic equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5361351A (en) * 1990-09-21 1994-11-01 Hewlett-Packard Company System and method for supporting run-time data type identification of objects within a computer program

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10956392B1 (en) * 2018-07-23 2021-03-23 Allscripts Software, Llc Methods, apparatuses, and computer program products for identifying fields in a data tree
CN113590091A (en) * 2021-06-30 2021-11-02 五八有限公司 Data processing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN114416085A (en) 2022-04-29

Similar Documents

Publication Publication Date Title
CN107329743B (en) Application page display method and device and storage medium
KR101770931B1 (en) Method, apparatus, program and computer-readable recording medium of generating communication module firmware and plug-in
CN108008955B (en) Method and device for displaying user-defined control information
CN105930536B (en) Index establishing method, page jumping method and device
CN104679599A (en) Application program duplicating method and device
CN110704053B (en) Style information processing method and device
CN107463372B (en) Data-driven page updating method and device
CN107885571B (en) Display page control method and device
CN113590091A (en) Data processing method and device, electronic equipment and storage medium
CN113010157A (en) Code generation method and device
CN112306702B (en) Data sharing method and device, electronic equipment and storage medium
CN106293683B (en) Project compiling method and device
CN114416085B (en) Data processing method and device, electronic equipment and storage medium
CN112988822B (en) Data query method, device, equipment, readable storage medium and product
CN115373763A (en) Plug-in loading method and device, electronic equipment and storage medium
CN108427568B (en) User interface updating method and device
CN110457084B (en) Loading method and device
CN110995767B (en) Request processing method and device
CN108549570B (en) User interface updating method and device
CN113946346B (en) Data processing method and device, electronic equipment and storage medium
CN111597106A (en) Point burying management method and device
CN113934452B (en) Data processing method and device, electronic equipment and storage medium
CN111767063A (en) Resource updating method, device and equipment for application program
CN114020505B (en) Data processing method and device, electronic equipment and storage medium
CN114489641B (en) Data processing method and device, electronic equipment and storage medium

Legal Events

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