CN112698824A - View element state management method and device, electronic equipment and storage medium - Google Patents
View element state management method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN112698824A CN112698824A CN202110013533.3A CN202110013533A CN112698824A CN 112698824 A CN112698824 A CN 112698824A CN 202110013533 A CN202110013533 A CN 202110013533A CN 112698824 A CN112698824 A CN 112698824A
- Authority
- CN
- China
- Prior art keywords
- state
- target
- management
- behavior
- view element
- 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.)
- Granted
Links
Images
Landscapes
- Stored Programmes (AREA)
Abstract
In the method, the target state behavior of the target view element is first obtained, then, in a state management library, a target management tool is determined according to the target state behavior, and then, the target management tool is called to process the target state behavior to determine a new state of the target view element. The state management library of the embodiment of the present disclosure combines the state behavior and the logic processor for processing the state behavior together to form a management tool, and when the state behavior is processed, the management tool is directly instantiated, so that the state update can be completed, and the state behavior transmission through a plurality of transfer modules is not needed like the prior art, thereby solving the technical problems of excessive template codes, weak type support and complex interface definition of the state management framework in the prior art. The method has the technical effects of simplifying the state management framework, greatly reducing the template codes and being suitable for a TypeScript type system.
Description
Technical Field
The embodiment of the disclosure relates to the technical field of computer and network communication, and in particular, to a method and an apparatus for managing a view element state, an electronic device, and a storage medium.
Background
In recent years, with the rise of single-page applications, JavaScript has been required to manage more states than ever, or data to speak, these states include: server responses, caching data, locally generating data that has not persisted to the server, and also UI state such as active routes, selected tags, whether to display load campaigns or paginators, etc., are challenges not encountered in web development twenty years ago. Because the single-page application proportion of the front-end rendering page is higher and higher, the complexity of the front-end work is increased, and more information displayed on the front-end page is more and more complex. This makes the management of the state more important.
Currently, a large number of front-end projects are being developed using or turning to using the vue. Among them, in the third-party framework of front-end state management, Flux, reduce, Vuex, Mobx, etc. are used more often, and reduce is most widely used. There are two modes of Redux use: the first is the pure use of the pure reduce library, which has obvious disadvantages, a state library store needs to be introduced at the place where the data is changed and monitored, and the association with the component is performed manually, thus generating the second way; the second method is to use the reduce + exact-reduce method, which does not use manual handling of the relationship between the global state and the exact (response) compared with the first method, and the code is simplified, but in this method, two modules, action creator and reducer, are needed. an action creator writes a large amount of repeated codes, reducers and switch case statements frequently used by the action creator; moreover, the Redox frame excessively uses character string types for parameter transmission, so that the method is difficult to adapt to a Typescript type system, difficult to realize strict constraint of codes and easy to write wrong codes; moreover, Redux splits many modules, so that modification of one data requires modification of many associated modules, which brings great inconvenience to the state management development work.
Namely, the state management framework in the prior art has the technical problems of excessive template codes, weak type support and complex interface definition.
Disclosure of Invention
The embodiment of the disclosure provides a view element state management method and device, an electronic device and a storage medium, so as to overcome the technical problems of excessive template codes, weak type support and complex interface definition of a state management framework in the prior art.
In a first aspect, an embodiment of the present disclosure provides a view element state management method, including:
acquiring a target state behavior of the target view element, wherein the target state behavior is used for determining the change type of the state, and the state is the logic state of the target view element;
determining a target management tool according to the target state behaviors in a state management library, wherein the state management library comprises a plurality of management tools, each management tool comprises a logic processor, and the logic processor is used for processing the logic relationship between the state and the state behaviors of the view elements in the management tools;
the target management tool is invoked to process the target state behavior to determine a new state of the target view element.
In a second aspect, an embodiment of the present disclosure provides a view element state management apparatus, including:
the acquisition module is used for acquiring a target state behavior of the target view element, wherein the target state behavior is used for determining the change type of the state, and the state is the logic state of the target view element;
the state management library module is used for determining a target management tool according to the target state behaviors, the state management library module comprises a plurality of management tools, each management tool comprises a logic processor, and each logic processor is used for processing the logic relationship between the state and the state behaviors of the view components in the management tools;
and the processing module is used for calling the target management tool to process the target state behavior so as to determine the new state of the target view element.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing the computer-executable instructions stored by the memory causes the at least one processor to perform the view element state management method as described above in the first aspect and in various possible designs of the first aspect.
In a fourth aspect, the embodiments of the present disclosure provide a computer-readable storage medium, in which computer-executable instructions are stored, and when a processor executes the computer-executable instructions, the view element state management method according to the first aspect and various possible designs of the first aspect is implemented.
In a fifth aspect, embodiments of the present disclosure provide a computer program product comprising a computer program that, when executed by a processor, implements a view element state management method as described above in the first aspect and in various possible designs of the first aspect.
In the method, a target state behavior of a target view element is first obtained, then a target management tool is determined in a state management library according to the target state behavior, and then the target management tool is called to process the target state behavior to determine a new state of the target view element. The state management library of the embodiment of the present disclosure combines the state behavior and the logic processor for processing the state behavior together to form a management tool, and when the state behavior is processed, the management tool is directly instantiated, so that the state update can be completed, and the state behavior transmission through a plurality of transfer modules is not needed like the prior art, thereby solving the technical problems of excessive template codes, weak type support and complex interface definition of the state management framework in the prior art. The method has the technical effects of simplifying the state management framework, greatly reducing the template codes and being suitable for a TypeScript type system.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present disclosure, and for those skilled in the art, other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a schematic diagram of a state management logic according to an embodiment of the present disclosure;
FIG. 2 is a logic diagram of a Redox framework management state provided by an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a state library of FIG. 2 according to an embodiment of the present disclosure;
fig. 4 is a schematic view of a structure and an application scenario of a state management library according to an embodiment of the present disclosure;
fig. 5 is a first flowchart illustrating a view element status management method according to an embodiment of the present disclosure;
fig. 6 is a schematic view of an application scenario of a view element state management method according to an embodiment of the present application;
fig. 7 is a second flowchart illustrating a view element status management method according to an embodiment of the disclosure;
fig. 8 is a third flowchart illustrating a view element state management method according to an embodiment of the present disclosure;
FIG. 9 is a schematic diagram of the logical relationship of the state management library, the context providers, and the context components provided by the embodiments of the present application;
fig. 10 is a block diagram of a view element status management apparatus according to an embodiment of the present disclosure;
fig. 11 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present disclosure.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are some, but not all embodiments of the present disclosure. All other embodiments, including but not limited to combinations of embodiments, which can be derived by one of ordinary skill in the art from the embodiments disclosed herein without making any inventive step are within the scope of the present disclosure.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present disclosure and in the drawings described above, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
To facilitate understanding of the terminology used in the present application, reference will be made to the following terms.
The state is as follows: the state in this disclosure is the source of data used to control the effect of the presentation of the view element.
And (3) state management: the data source for controlling the display effect of the view element is separately extracted, is independent of the logic flow of the processing method, is managed in a unified way, and the logic of the state change can be better predicted, and only the logic relation is highlighted, so that the logic realization is more orderly, and the state change is easier to control.
The reason why the state management is performed is explained here. Because there is usually some shared state between view elements, we will generally promote this part of the state to global variables, the global component manages the shared state uniformly, and the view elements need to be notified of updates when the state changes. However, as the state is increased and the project is more and more complex, a state management tool is urgently needed to help the logic of the shared state, and the state management tool is produced accordingly.
The basic logic of the framework mode of state management proceeds as follows:
firstly, storing the state of a view element in an external state library store;
secondly, controlling the display effect or display effect of the view element by using the state;
and thirdly, the view element changes the state by triggering logic behavior or state behavior actions, and updates the view element to show the new state.
The first inventive concept of the present disclosure is formed according to the above-described modes, and the corresponding flow of state management is shown in fig. 1.
Referring to fig. 1, fig. 1 is a schematic diagram of a state management logic according to an embodiment of the disclosure. As shown in fig. 1, the state library Store10 receives the state behavior notification of the view element 11, and as shown in fig. 1, the view element 11 includes at least two view elements, i.e., a view element 111 and a view element 112, which may trigger the state behavior notification separately or simultaneously. After receiving the view element 11 notification status behavior, the status library Store10 sends the shared status 101 of the view element 111 and the view element 112 to the corresponding view element 111 or view element 112, respectively, or to both the view element 111 and the view element 112 through status management.
In this process, the most complicated problem is how to perform state management.
For the purpose of explaining the inventive concept of the disclosed embodiments, the management logic of the Redox framework for state management in the prior art is described below.
In the Redox framework, there are three core modules, namely a state base Store, an Action, and an Action processing module Reducer.
(1) The state library Store:
the method is used for storing the State states of various view elements in the application, and the dispatch method used for triggering the update of the State states, and the like, and only one State library Store exists in the whole application.
Several interface tools API are provided in the State library Store to manage the State:
■ store. getState (): acquiring a current State;
■ store. dispatch (Action): sending an Action to an Action processing module Reducer for processing;
■ store. describe (listener): a listening function listener is set that listens for changes in State (if a view element update function is passed in as the listening function listener, view auto-rendering may be triggered).
(2) And (4) Action:
an Action is a parameter generated by the Action Package Creator and received by the Action processing Module Reducer, which was originally issued as triggered by the View element.
The Action contains the following information:
● type field of a string type to indicate the Action to be executed;
● require other data information to be passed to the application, the data form or type being user-definable.
(3) Behavior processing module Reducer:
is a function that calculates the new State newState from the Action and the State. Namely, a new state newState is derived by applying the current state previousState and the Action:
can be expressed as: (previous state, Action) > newState.
Referring to fig. 2, fig. 2 is a logic diagram of a reduce framework management state provided by the embodiment of the present disclosure. As shown in fig. 2, after the user performs an interactive operation on the view element on the front-end page, the tracker trigger captures the Action, the tracker trigger triggers the Action Creator to generate a string corresponding to the Action, then the Store.
It should be noted that a connection handler for handling connection relationships generally exists in the state library Store for receiving the Action and passing new/old states. The behavior processing module Reducer may generally include a plurality of modules corresponding to different logic behaviors, when the logic behaviors have a progressive inclusion relationship or have a logic sequence relationship therebetween, the relationship between the behavior processing modules Reducer is as shown in fig. 2, the root behavior processing module represents the logic behavior with the largest coverage, and the corresponding logic behavior may be further subdivided into two branches, such as a behavior processing module 1 to a behavior processing module 2, and a behavior processing module 3 to a behavior processing module 4, where the two branches represent two parallel logics. The root logic processing module is a four-element operation module, the behavior processing module 1 represents accumulation behavior, the behavior processing module 3 represents accumulation and multiplication behavior, the behavior processing module 2 represents the behavior of adding two variables, and the behavior processing module 4 represents the behavior of multiplying two variables.
As can be seen from fig. 2, when the existing reduce framework performs state management, an Action needs to encapsulate a string representing an Action Type through an Action Creator, and other data related to the Action, so as to be passed to the state base Store using Store. The two steps of operations make application development workers need to prepare a large amount of repetitive template codes to enable the Redox framework to take effect, and because the behavior encapsulation Creator attaches a character String of the behavior Type to the behavior Action, the character String causes Type contradiction on a Type Type system taking a variable Type as an important core, because the behavior Action itself can be regarded as an Array Type, but the Redox framework is endowed with the character String Type, so that the Type conflict is caused, and the Redox framework cannot support the Type Type system.
How to improve the Redux framework to reduce the occurrence of a large amount of repetitive template codes when managing a large number of states and to enable the new state management framework to support the Typescript system with the variable increment type as the core becomes a technical problem to be solved urgently, namely, an innovative starting point of the present disclosure.
After intensive research, the inventor of the present disclosure finds that how to omit Action Creator and store.dispatch (Action) to achieve the state base Store update state directly triggered by the state behavior as shown in fig. 1 is the biggest technical obstacle faced by the embodiments of the present disclosure.
After intensive research, the inventor of the present disclosure finds that a core module in the reduce framework, which really functions to acquire a new State, is a "behavior processing module Reducer", and the State library Store only functions to Store the State, but this simple storage manner cannot meet the requirement of efficient utilization. In order to make it easier to understand the problems of the existing Redox framework, a brief description is given below in conjunction with FIG. 3.
Referring to fig. 3, fig. 3 is a schematic structural diagram of the state library in fig. 2 according to an embodiment of the present disclosure. As shown in fig. 3, the state library 300 in the reduce framework simply stores the state classifications corresponding to the various view elements, such as the first state set 301, the second state set 302, the third state set 303, the fourth state set 304, the fifth state set 305, the sixth state set 306, and the seventh state set 307 shown in fig. 3, which correspond to different states of different view elements respectively. If the State is regarded as a part, the behavior processing module Reducer is a machine for processing the part, an old part is processed by the machine to obtain a new part, and the behavior Action is a switch button of the machine. The relationship among the state base Store, the behavior processing module Reducer and the behavior Action in the existing Redux framework is shown.
In view of the above relationship, after intensive research, the inventor of the present disclosure finds that the existing reduce framework needs many template codes to connect, and it is necessary to ensure that the behavior processing module Reducer used by the State of the behavior Action change is already registered, otherwise, a logic call error is caused, and the reduce framework cannot complete the State update. That is, the machine corresponding to the switch button is an existing machine and can process the component, and if the machine corresponding to the switch button is not installed and ready, the component cannot be processed, thereby causing an error.
The inventive concept of the present disclosure is thus obtained: the disclosed embodiment creatively breaks the way or logical structure of the prior art Redox framework to respond to Action. The behavior processing module Reducer, the behavior Action and the State are combined together to form a management tool. Therefore, when the Action is captured, the management tool matched with the Action can be correspondingly found, the management tool is instantiated, namely, an instance corresponding to the management tool is generated, the instance exists along with the view element and is specially used for managing the state generated by the preset Action corresponding to the view element. The original state library is correspondingly changed into a state management library for storing each state management tool. The state management library can be set as a type system, namely, related variables specify data types of the state management library, accurate calling of each data is guaranteed through type limitation of the type system, the condition that a behavior processing module Reducer in the existing Redox framework is called without being registered is avoided, a large amount of object codes are not needed for constructing a behavior encapsulation Creator Action Creator and a store. Meanwhile, variable type limitation is added in both the state management library and the state management tool so as to meet the support requirement of a Typescript type system, and the technical problem that the existing state management framework is weak in type support is solved.
For ease of understanding, the state management library of the embodiments of the present disclosure is described below with reference to fig. 4.
Referring to fig. 4, fig. 4 is a schematic view illustrating a structure and an application scenario of a state management library according to an embodiment of the present disclosure. As shown in fig. 4, the state management library 400 includes a plurality of management tools, such as a first management tool 401, a second management tool 402, and a third management tool 403. After the state behavior 411 is captured by the tracker trigger, an Application Programming Interface (API) of the state management library finds a corresponding management tool, i.e., the first management tool 401, and instantiates the management tool as the first instance 4011. The first instance 4011 is then activated with the state behavior 411, and after processing by the first instance 4011, a new state 412 is output.
The following describes specific steps of a view element status management method provided by an embodiment of the present disclosure in detail.
Referring to fig. 5, fig. 5 is a first flowchart illustrating a view element state management method according to an embodiment of the present disclosure. The method of the embodiment is applied to terminal equipment and/or a server at a user side, and the view element state management method comprises the following steps:
s501: target state behavior of the target view element is obtained.
In this step, the target state behavior is used to determine the type of change in the state, which is the logical state of the target view element.
Specifically, after the user operates the target view element, that is, after the user interacts with the target view element, the state of each view element in the application may be detected in real time by setting a patrol thread or a state tracker trigger in the application. The user's interaction with the target view element thus constitutes a trigger for a change in the state of the target view element, i.e. a target state behavior.
Referring to fig. 6, fig. 6 is a schematic view of an application scenario of the view element state management method according to the embodiment of the present application. As shown in fig. 6, when the user clicks the "add 1 button 601" or the "multiply 2 button 602" on the application interface, the patrol thread or the state tracker trigger captures the interaction operation, i.e., the target state behavior. Note that, in fig. 6, the target view element is a digital display element 603.
S502: and in the state management library, determining a target management tool according to the target state behavior.
In this step, a plurality of management tools are included in the state management library, and each management tool includes a logical processor for processing the logical relationship between the state and the state behavior of the view element in the management tool.
Specifically, the target management tool corresponding to the target state behavior can be retrieved from the state management library through an interface component of the state management library, such as a hook Hooks component. It should be noted that, the number of target management tools required for different target state behaviors is different, and for example, an addition management tool and a multiplication management tool may be used separately for one weighted average calculation button, or a weighted average management tool may be used directly. Thus, a target management tool can be found in the state management library for the target state behavior.
For example, as shown in fig. 6, the add 1 button 601 corresponds to an "add 1" management tool, i.e. a target management tool, the "add 1" management tool handles the logical behavior of "add", and the logical behavior of "add" requires an "addend" and an "addend", the "addend" corresponds to the old status previoussstate of the digital display element 603, the "addend" is a status variable defining a variable type in a logical processor in the "add 1" management tool, where the status variable is 1 and the variable type is a digital type. It should be noted that the difference between the logical processor in the "add 1" management tool and the behavior processing module Reducer in the prior art includes the variable type defining the state variable, so that if a developer calls a wrong logical processor or target management tool, the compiler or the compilation environment tool will automatically prompt a logical error, and there is no need to build the behavior encapsulation Creator Action Creator and store. The method saves a large amount of repeated template code work, improves the application development efficiency, simplifies the application code volume and improves the processing and compiling efficiency.
It should be noted that in one possible design, the previous state PreviousState of the target view element is included in all the management tools used in the previous state, and when the previous state is updated to the new state, all the management tools are updated simultaneously.
It should be noted that, in another possible design, in addition to the logical processor, the target management tool further includes a parameter defining a type, such as the old status PreviousState, so that the target management tool can well support a Typescript type system.
That is, the parameters in the management tool and the logical processor define parameter types, which include: at least one of a value, an array, a text, and a function;
the parameter type is used to ensure that no logic errors occur when the target management tool is invoked to process the target state behavior.
S503: the target management tool is invoked to process the target state behavior to determine a new state of the target view element.
In this step, since the target management tool already includes the logical processor, the basic design of processing the corresponding logical relationship according to the state behavior directly in fig. 1 to determine the new state is realized. The above-mentioned problems in the Redux framework are really avoided.
According to the view element state management method provided by the embodiment of the disclosure, the target state behavior of the target view element is firstly obtained, then, in the state management library, the target management tool is determined according to the target state behavior, and then, the target management tool is called to process the target state behavior so as to determine the new state of the target view element. The state management library of the embodiment of the present disclosure combines the state behavior and the logic processor for processing the state behavior together to form a management tool, and when the state behavior is processed, the management tool is directly instantiated, so that the state update can be completed, and the state behavior transmission through a plurality of transfer modules is not needed like the prior art, thereby solving the technical problems of excessive template codes, weak type support and complex interface definition of the state management framework in the prior art. The method has the technical effects of simplifying the state management framework, greatly reducing the template codes and being suitable for a TypeScript type system.
Referring to fig. 7, fig. 7 is a second flowchart illustrating a view element status management method according to an embodiment of the present disclosure. The method of the embodiment is applied to terminal equipment and/or a server at a user side, and the view element state management method comprises the following steps:
s701: target state behavior of the target view element is obtained.
In this step, the target state behavior is used to determine the type of change in the state, which is the logical state of the target view element.
Specifically, after the user operates the target view element, that is, after the user interacts with the target view element, the state of each view element in the application may be detected in real time by setting a patrol thread or a state tracker trigger in the application. The user's interaction with the target view element thus constitutes a trigger for a change in the state of the target view element, i.e. a target state behavior.
S702: and determining a target management tool in the state management library through a target pointer of the hook interface component according to the target state behavior.
In this step, the state management library includes: the system comprises a logic processor set, a state behavior set, an initial state set and a management tool set; the management tool set comprises a plurality of management tools, and each management tool comprises a logic processor which is used for processing the logic relation between the state and the state behavior of the view element in the management tool.
It should be noted that the set of logical processors includes logical processors in each management tool, the set of state behaviors includes state behaviors involved in each management tool, and the initial state set includes initial states of each state behavior.
In this embodiment, the set of logical processors, the set of state behaviors, and the initial state set are used to provide the logical processors, the state behaviors, and the initial states of the states involved in a new management tool when the management tool is newly built. After a management tool is established for the first time, the management tool is added into the management tool set, and a corresponding pointer is established for the management tool, so that the management tool can be quickly found when the management tool is called, and the search is not needed to be traversed one by one.
It should be further noted that the hook interface component, such as a hooks-like function object, is an API interface component corresponding to the state management library, and each management tool in the management tool set has its corresponding pointer, and the pointers are stored in the hook interface component.
S703: and calling a target management tool according to the target pointer to process the target state behavior so as to determine the new state of the target view element.
In this step, after the hook interface component finds the corresponding target management tool through the target pointer, the hook interface component transmits the state behavior to the target management tool for logic processing, so as to obtain a new state of the target view element.
The view element state management method provided by the embodiment of the disclosure includes the steps of firstly obtaining a target state behavior of a target view element, then determining a target management tool in a state management library through a target pointer of a hook interface component according to the target state behavior, and then calling the target management tool to process the target state behavior according to the target pointer so as to determine a new state of the target view element. On the basis of the embodiment shown in fig. 5, the target management tool is quickly located by using the pointer, and a set of logical processors, a set of state behaviors, an initial state set and a set of management tools are added into the state management library so as to update or newly build the management tool or initialize the management tool. The state management library of the embodiment of the present disclosure combines the state behavior and the logic processor for processing the state behavior together to form a management tool, and when the state behavior is processed, the management tool is directly instantiated, so that the state update can be completed, and the state behavior transmission through a plurality of transfer modules is not needed like the prior art, thereby solving the technical problems of excessive template codes, weak type support and complex interface definition of the state management framework in the prior art. The method has the technical effects of simplifying the state management framework, greatly reducing the template codes and being suitable for a TypeScript type system.
Referring to fig. 8, fig. 8 is a third schematic flowchart of a view element state management method according to an embodiment of the present disclosure. The method of the embodiment is applied to terminal equipment and/or a server at a user side, and the view element state management method comprises the following steps:
s801: target state behavior of the target view element is obtained through the hook interface component.
In this step, the target state behavior includes: the current state of the target behavior object and the target logical behavior. Logical behavior is a trigger factor for an intrinsic logical relationship that triggers a state change, including: operational logic behavior, judgment logic behavior, selection logic behavior, and the like. Such as: addition, subtraction, multiplication, division, integration and differentiation belong to operation logic behaviors, and Boolean type belongs to judgment logic behaviors.
S802: and determining a target pointer corresponding to the target management tool according to the target logic behavior by utilizing the hook interface component.
In this step, the target pointer is included in the hook interface component, a corresponding mapping relationship exists between the target logical behavior and the target pointer, and the corresponding target pointer can be searched from a mapping table.
It should be noted that, when the new state corresponding to the target state behavior is a state shared by multiple view elements, a context component is required to obtain a target pointer corresponding to a shared target management tool.
Specifically, when determining the target pointer, the target logic behavior must have support of a certain context, that is, logic settings of various transfer parameters and definition limits of parameter types must be made, and the specific steps include:
s8021: context providers for the target pointer are obtained based on the logical behavior.
In this step, a plurality of context providers, such as contextProvider in Java, are attached to the state management library or the hook interface component of the state management library to provide corresponding interface APIs for interfacing the logical behavior with the target pointer.
S8022: a target pointer is determined from the context provider.
In this step, the corresponding target pointer is directly pulled from the hook interface component by the context provider. Specifically, the method comprises the following steps:
obtaining context components packaged by a context provider;
the target pointer is determined from the context component.
It should be noted that the context provider is used to provide a connection interface between the state management library and a context component (e.g. context in Java), and the target context component is used to provide a logical call environment support for calling the target management tool.
To facilitate understanding of the implementation principle of step S802, the following description is made in conjunction with fig. 9.
Referring to fig. 9, fig. 9 is a schematic diagram illustrating a logical relationship between a state management library, a context provider, and a context component according to an embodiment of the present application. As shown in fig. 9, the state management library 91 includes a plurality of management tools, namely, a management tool 911, a management tool 912 and a management tool 913, each management tool corresponds to a specific transmission pipeline of the context provider 92 only, that is, the context provider 921, the context provider 922 and the context provider 923 can be regarded as a management tool 911, a management tool 912 and a management tool 913 that leave the door of the state management library when being called or a corresponding library manager, and can be called only by the corresponding door or the corresponding library manager's consent, and the context component corresponds to a transportation channel or a transportation vehicle after being taken out, the management tool 911 can be transported only in the context component 931, and the management tool 912 can be transported only in the context component 932, similarly, the administrative tool 913 can only be transported out in the context component 933, eventually reaching the invoked site. This is the specific flow that the management tool is called in the state library, and this flow ensures that the management tool is strictly limited in the logic of the call, and a compiling alarm is triggered when a logic error occurs in the context provider and/or the context component, so that it is ensured that no logic error occurs when the state behavior directly calls the management tool, and it is avoided that the Redux framework needs to use a large number of repeated behaviors to encapsulate the template codes corresponding to the Creator of the created template code and the method tool of store.
S803: the target state behavior is processed by invoking a target management tool according to the target context component to determine a new state of the target view element.
In this step, the target context component passes intermediate parameters such as global variables for the target management tool to process the state change corresponding to the target state behavior, so that the target management tool finally generates a new state.
S804: and updating the new configuration state for the target view element through the state provider.
After the new state generation is completed, the state management library is equivalent to the original Store, and the new state is updated to the target view element through a corresponding state provider, i.e. a function tool for resetting or updating the view element, such as a render method tool, so that the target view element shows the new state.
Optionally, each management tool related to the state of the target view element also updates the state synchronously, or replaces the initial state in the state management library with the new state.
In one possible design, in order for the state assignor to satisfy the preparation requirement for configuring the new state, before step S808, the method further includes:
and acquiring a function selector for configuring each parameter in the state assigner and/or the called target configuration model.
The state assignor is configured according to the function selector such that the state assignor satisfies the new state configuration requirements of the target view element.
The view element state management method provided by the embodiment of the disclosure includes the steps of firstly obtaining a target state behavior of a target view element, then determining a target management tool in a state management library through a target pointer of a hook interface component according to the target state behavior, and then calling the target management tool to process the target state behavior according to the target pointer so as to determine a new state of the target view element. On the basis of the embodiment shown in fig. 5, pointers are utilized to quickly locate a target management tool, and context providers and context components are added to a state management library to provide a more compact multiplexing interface tool for the invocation of the management tool. The state management library of the embodiment of the present disclosure combines the state behavior and the logic processor for processing the state behavior together to form a management tool, and when the state behavior is processed, the management tool is directly instantiated, so that the state update can be completed, and the state behavior transmission through a plurality of transfer modules is not needed like the prior art, thereby solving the technical problems of excessive template codes, weak type support and complex interface definition of the state management framework in the prior art. The method has the technical effects of simplifying the state management framework, greatly reducing the template codes and being suitable for a TypeScript type system.
Corresponding to the media push method in the foregoing embodiment, fig. 10 is a block diagram of a view element status management apparatus provided in the embodiment of the present disclosure. For ease of illustration, only portions that are relevant to embodiments of the present disclosure are shown. Referring to fig. 10, the apparatus includes:
an obtaining module 1001, configured to obtain a target state behavior of a target view element, where the target state behavior is used to determine a change type of a state, and the state is a logic state of the target view element;
the state management library module 1002 is configured to determine a target management tool according to the target state behavior, where the state management library module includes multiple management tools, each management tool includes a logic processor, and the logic processor is configured to process a logic relationship between a state and a state behavior of a view element in the management tool;
a processing module 1003, configured to invoke the target management tool to process the target state behavior, so as to determine a new state of the target view element.
In one embodiment of the disclosure, the management tool and the parameters in the logical processor define parameter types, the parameter types including: at least one of a value, an array, a text, and a function;
the parameter type is used for being correctly called when the target management tool is called to process the target state behavior.
In one embodiment of the present disclosure, the status management library module 1002 further includes: the system comprises a logic processor set, a state behavior set, an initial state set and a management tool set;
the set of logical processors comprises the logical processors in each of the management tools;
the set of state behaviors includes the state behaviors in the respective management tools;
the initial state set comprises initial states of the respective state behaviors;
the set of management tools includes all of the management tools.
In an embodiment of the present disclosure, the status management library module 1002 is configured to determine a target management tool according to the target status behavior, and includes:
the state management library module 1002 is configured to determine at least one target management tool in the state management library through a target pointer of the hook interface component according to the target state behavior;
the hook interface component comprises pointers corresponding to the management tools.
In an embodiment of the present disclosure, the processing module 1003 is configured to invoke the target management tool to process the target state behavior, including:
the processing module 1003 is configured to invoke the target management tool to process the target state behavior according to the target pointer.
In one embodiment of the present disclosure, the target state behavior comprises: the obtaining module 1001, configured to obtain the target state behavior of the target view element, where the obtaining module is configured to:
the obtaining module 1001 is configured to obtain the current state and the target logic behavior through a hook interface component;
correspondingly, the state management library module 1002 is configured to determine a target management tool according to the target state behavior, and includes:
the state management library module 1002 is configured to determine, by using the hook interface component, a target pointer corresponding to the target management tool according to the target logic behavior, where the target pointer is included in the hook interface component;
the state management library module 1002 is further configured to determine the target management tool according to the target pointer and the state management library.
In an embodiment of the present disclosure, when the new state corresponding to the target state behavior is a state shared by multiple view components, the state management library module 1002 is configured to determine a target pointer corresponding to the target management tool according to the target logical behavior, and includes:
the state management library module 1002 is configured to obtain a context provider of the target pointer according to the target logic behavior;
the state management library module 1002 is further configured to determine the target pointer according to the context provider.
In an embodiment of the present disclosure, the context provider is configured to provide a connection interface for the state management library and a context component, and the processing module 1003 is configured to determine the target pointer according to the context provider, including:
the processing module 1003 is configured to obtain the context component encapsulated by the context provider;
the processing module 1003 is further configured to determine the target pointer according to the context component.
In an embodiment of the present disclosure, the processing module 1003 is configured to invoke the target management tool to process the target state behavior to determine a new state of the target view element, including:
the processing module 1003 is configured to invoke the target management tool to process the target state behavior according to the target context component, so as to determine a new state of the target view element.
In one embodiment of the present disclosure, the view element state management apparatus 1000 further includes:
the processing module 1003 is further configured to update and configure the new state for the target view element through a state provider.
In an embodiment of the present disclosure, before the processing module 1003 is further configured to update and configure the new state for the target view element through a state assignor, the method further includes:
the obtaining module 1001 is further configured to obtain a function selector, where the function selector is used to configure each parameter and/or called target configuration model in the state provider;
the processing module 1003 is further configured to configure the state assignor according to the function selector, so that the state assignor meets a new state configuration requirement of the target view element.
The apparatus 1000 provided in this embodiment may be configured to perform steps related to the user side in the technical solution of the foregoing method embodiment, and the implementation principle and the technical effect are similar, which are not described herein again.
Referring to fig. 11, which shows a schematic structural diagram of an electronic device 1100 suitable for implementing the embodiment of the present disclosure, the electronic device 1100 may be a terminal device or a server. Among them, the terminal Device may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a Digital broadcast receiver, a Personal Digital Assistant (PDA), a tablet computer (PAD), a Portable Multimedia Player (PMP), a car terminal (e.g., car navigation terminal), etc., and a fixed terminal such as a Digital TV, a desktop computer, etc. The electronic device shown in fig. 11 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 11, the electronic device 1100 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 1101, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 1102 or a program loaded from a storage means 1108 into a Random Access Memory (RAM) 1103. In the RAM 1103, various programs and data necessary for the operation of the electronic device 1100 are also stored. The processing device 1101, the ROM1102, and the RAM 1103 are connected to each other by a bus 1104. An input/output (I/O) interface 1105 is also connected to bus 1104.
Generally, the following devices may be connected to the I/O interface 1105: input devices 1106 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 1107 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 1108, including, for example, magnetic tape, hard disk, etc.; and a communication device 1109. The communication means 1109 may allow the electronic device 1100 to communicate wirelessly or wiredly with other devices to exchange data. While fig. 11 illustrates an electronic device 1100 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via the communication device 1109, or installed from the storage device 1108, or installed from the ROM 1102. The computer program, when executed by the processing device 1101, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection 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: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above embodiments.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. 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 the case of a remote computer, the remote computer may be connected to the user's computer through any type of Network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
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 disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). 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 the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a limitation of the unit itself, for example, the first retrieving unit may also be described as a "unit for retrieving at least two internet protocol addresses".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer program product is also provided in the disclosed embodiments, comprising a computer program that, when executed by a processor, implements the methods in the embodiments described above.
In a first aspect, according to one or more embodiments of the present disclosure, there is provided a view element state management method, including:
acquiring a target state behavior of a target view element, wherein the target state behavior is used for determining a change type of a state, and the state is a logic state of the target view element;
determining a target management tool according to the target state behavior in a state management library, wherein the state management library comprises a plurality of management tools, each management tool comprises a logic processor, and each logic processor is used for processing the logic relationship between the state and the state behavior of a view element in each management tool;
invoking the target management tool to process the target state behavior to determine a new state of the target view element.
In accordance with one or more embodiments of the present disclosure, the management tool and the parameters in the logical processor define parameter types, the parameter types including: at least one of a value, an array, a text, and a function;
the parameter type is used for being correctly called when the target management tool is called to process the target state behavior.
According to one or more embodiments of the present disclosure, the state management library further includes: the system comprises a logic processor set, a state behavior set, an initial state set and a management tool set;
the set of logical processors comprises the logical processors in each of the management tools;
the set of state behaviors includes the state behaviors in the respective management tools;
the initial state set comprises initial states of the respective state behaviors;
the set of management tools includes all of the management tools.
According to one or more embodiments of the present disclosure, the determining, in the state management library, a target management tool according to the target state behavior includes:
determining the target management tool in the state management library through a target pointer of a hook interface component according to the target state behavior;
the hook interface component comprises a pointer corresponding to the management tool.
According to one or more embodiments of the present disclosure, the invoking the target management tool to process the target state behavior includes:
and calling the target management tool to process the target state behavior according to the target pointer.
In accordance with one or more embodiments of the present disclosure, the target state behavior comprises: the current state of the target behavior object and the target logic behavior, and the acquiring the target state behavior of the target view element includes:
acquiring the current state and the target logic behavior through a hook interface component;
correspondingly, the determining a target management tool according to the target state behavior in the state management library includes:
determining a target pointer corresponding to the target management tool according to the target logic behavior by using the hook interface component, wherein the target pointer is contained in the hook interface component;
and determining the target management tool according to the target pointer and the state management library.
According to one or more embodiments of the present disclosure, when the new state corresponding to the target state behavior is a state shared by a plurality of view elements, the determining a target pointer corresponding to the target management tool according to the target logical behavior includes:
obtaining a context provider of the target pointer according to the target logic behavior;
determining the target pointer from the context provider.
According to one or more embodiments of the present disclosure, the context provider is configured to provide a connection interface to the state management library and a context component, and the determining the target pointer according to the context provider includes:
obtaining the context component encapsulated by the context provider;
determining the target pointer from the context component.
According to one or more embodiments of the present disclosure, the invoking the target management tool to process the target state behavior to determine a new state of the target view element comprises:
invoking the target management tool to process the target state behavior according to the target context component to determine a new state of the target view element.
According to one or more embodiments of the present disclosure, the method further comprises:
updating the configuration of the new state to the target view element by a state giver.
According to one or more embodiments of the present disclosure, before the updating and configuring the new state to the target view element by the state giver, the method further comprises:
acquiring a function selector for configuring each parameter in the state provider and/or the called target configuration model;
configuring the state giver according to the function selector so that the state giver meets a new state configuration requirement of the target view element.
In a second aspect, according to one or more embodiments of the present disclosure, there is provided a view element state management apparatus including:
the system comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for acquiring a target state behavior of a target view element, the target state behavior is used for determining a change type of a state, and the state is a logic state of the target view element;
the state management library module is used for determining a target management tool according to the target state behaviors, the state management library module comprises a plurality of management tools, the management tools comprise logic processors, and the logic processors are used for processing the logic relationship between the states and the state behaviors of the view components in the management tools;
a processing module for invoking the target management tool to process the target state behavior to determine a new state of the target view element.
In accordance with one or more embodiments of the present disclosure, the management tool and the parameters in the logical processor define parameter types, the parameter types including: at least one of a value, an array, a text, and a function;
the parameter type is used for being correctly called when the target management tool is called to process the target state behavior.
According to one or more embodiments of the present disclosure, the status management library module further includes: the system comprises a logic processor set, a state behavior set, an initial state set and a management tool set;
the set of logical processors comprises the logical processors in each of the management tools;
the set of state behaviors includes the state behaviors in the respective management tools;
the initial state set comprises initial states of the respective state behaviors;
the set of management tools includes all of the management tools.
According to one or more embodiments of the present disclosure, the status management library module, configured to determine a target management tool according to the target status behavior, includes:
the state management library module is used for determining at least one target management tool in the state management library through a target pointer of the hook interface component according to the target state behavior;
the hook interface component comprises pointers corresponding to the management tools.
According to one or more embodiments of the present disclosure, the processing module, configured to invoke the target management tool to process the target state behavior, includes:
and the processing module is used for calling the target management tool to process the target state behavior according to the target pointer.
In accordance with one or more embodiments of the present disclosure, the target state behavior comprises: the obtaining module is configured to obtain a target state behavior of the target view element, where the target state behavior includes:
the acquisition module is used for acquiring the current state and the target logic behavior through a hook interface component;
correspondingly, the state management library module is used for determining a target management tool according to the target state behavior, and comprises:
the state management library module is used for determining a target pointer corresponding to the target management tool according to the target logic behavior by using the hook interface component, and the target pointer is contained in the hook interface component;
and the state management library module is also used for determining the target management tool according to the target pointer and the state management library.
According to one or more embodiments of the present disclosure, when the new state corresponding to the target state behavior is a state shared by a plurality of view components, the state management library module is configured to determine a target pointer corresponding to the target management tool according to the target logical behavior, including:
the state management library module is used for acquiring a context provider of the target pointer according to the target logic behavior;
and the state management library module is also used for determining the target pointer according to the context provider.
According to one or more embodiments of the present disclosure, the context provider is configured to provide a connection interface for the state management library and a context component, and the processing module is configured to determine the target pointer according to the context provider, including:
the processing module is used for acquiring the context components packaged by the context provider;
the processing module is further configured to determine the target pointer based on the context component.
According to one or more embodiments of the present disclosure, the processing module, configured to invoke the target management tool to process the target state behavior to determine a new state of the target view element, includes:
the processing module is used for calling the target management tool to process the target state behavior according to the target context component so as to determine the new state of the target view element.
According to one or more embodiments of the present disclosure, the view element state management apparatus further includes:
the processing module is further configured to update and configure the new state for the target view element through a state provider.
According to one or more embodiments of the present disclosure, before the processing module is further configured to update and configure the new state for the target view element through a state giver, the method further includes:
the obtaining module is further configured to obtain a function selector for configuring each parameter in the state provider and/or the called target configuration model;
the processing module is further configured to configure the state assignor according to the function selector, so that the state assignor satisfies a new state configuration requirement of the target view element.
In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device including:
at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing the computer-executable instructions stored by the memory causes the at least one processor to perform the view element state management method as described above in the first aspect and in various possible designs of the first aspect.
In a fourth aspect, according to one or more embodiments of the present disclosure, there is provided a computer-readable storage medium having stored therein computer-executable instructions that, when executed by a processor, implement the view element state management method as described in the first aspect above and in various possible designs of the first aspect.
In a fifth aspect, according to one or more embodiments of the present disclosure, there is provided a computer program, comprising a computer program which, when executed by a processor, implements the view element state management method as described above in the various possible designs of the first aspect.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.
Claims (15)
1. A view element state management method, comprising:
acquiring a target state behavior of a target view element, wherein the target state behavior is used for determining a change type of a state, and the state is a logic state of the target view element;
determining a target management tool according to the target state behavior in a state management library, wherein the state management library comprises a plurality of management tools, each management tool comprises a logic processor, and each logic processor is used for processing the logic relationship between the state and the state behavior of a view element in each management tool;
invoking the target management tool to process the target state behavior to determine a new state of the target view element.
2. The view element state management method of claim 1, wherein the management tool and the parameters in the logical processor define parameter types, the parameter types comprising: at least one of a value, an array, a text, and a function;
the parameter type is used for being correctly called when the target management tool is called to process the target state behavior.
3. The view element state management method according to claim 1 or 2, wherein the state management library further comprises: the system comprises a logic processor set, a state behavior set, an initial state set and a management tool set;
the set of logical processors comprises the logical processors in each of the management tools;
the set of state behaviors includes the state behaviors in the respective management tools;
the initial state set comprises initial states of the respective state behaviors;
the set of management tools includes all of the management tools.
4. The view element state management method according to claim 3, wherein determining a target management tool according to the target state behavior in the state management library comprises:
determining the target management tool in the state management library through a target pointer of a hook interface component according to the target state behavior;
the hook interface component comprises a pointer corresponding to the management tool.
5. The view element state management method of claim 4, wherein said invoking the target management tool to process the target state behavior comprises:
and calling the target management tool to process the target state behavior according to the target pointer.
6. The view element state management method according to claim 1, wherein the target state behavior comprises: the current state of the target behavior object and the target logic behavior, and the acquiring the target state behavior of the target view element includes:
acquiring the current state and the target logic behavior through a hook interface component;
correspondingly, the determining at least one target management tool according to the target state behavior in the state management library includes:
determining a target pointer corresponding to the target management tool according to the target logic behavior by using the hook interface component, wherein the target pointer is contained in the hook interface component;
and determining the target management tool according to the target pointer and the state management library.
7. The method according to claim 6, wherein when the new state corresponding to the target state behavior is a state shared by a plurality of view elements, the determining, by the hook interface component, a target pointer corresponding to the target management tool according to the target logical behavior includes:
obtaining a context provider of the target pointer according to the target logic behavior;
determining the target pointer from the context provider.
8. The view element state management method according to claim 7, wherein the context provider is configured to provide a connection interface to the state management library and a context component, and wherein determining the target pointer according to the context provider comprises:
obtaining the context component encapsulated by the context provider;
determining the target pointer from the context component.
9. The view element state management method of claim 8, wherein said invoking the target management tool to process the target state behavior to determine a new state of the target view element comprises:
invoking the target management tool to process the target state behavior according to the target context component to determine a new state of the target view element.
10. The view element state management method according to any one of claims 1, 6 to 9, wherein the method further comprises:
updating the configuration of the new state to the target view element by a state giver.
11. The view element state management method according to claim 10, further comprising, before said configuring the new state for the target view element update by the state giver,:
acquiring a function selector for configuring each parameter in the state provider and/or the called target configuration model;
configuring the state giver according to the function selector so that the state giver meets a new state configuration requirement of the target view element.
12. A view element state management apparatus, comprising:
the system comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for acquiring a target state behavior of a target view element, the target state behavior is used for determining a change type of a state, and the state is a logic state of the target view element;
the state management library module is used for determining a target management tool according to the target state behaviors, the state management library module comprises a plurality of management tools, the management tools comprise logic processors, and the logic processors are used for processing the logic relationship between the states and the state behaviors of the view components in the management tools;
a processing module for invoking the target management tool to process the target state behavior to determine a new state of the target view element.
13. An electronic device, comprising:
at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing the memory-stored computer program causes the at least one processor to perform the view element state management method of any of claims 1 to 11.
14. A computer-readable storage medium having stored thereon computer-executable instructions which, when executed by a processor, implement the view element state management method of any of claims 1 to 11.
15. A computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements the view element state management method of any of claims 1 to 11.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110013533.3A CN112698824B (en) | 2021-01-06 | 2021-01-06 | View element state management method, device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110013533.3A CN112698824B (en) | 2021-01-06 | 2021-01-06 | View element state management method, device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112698824A true CN112698824A (en) | 2021-04-23 |
CN112698824B CN112698824B (en) | 2024-10-18 |
Family
ID=75514882
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110013533.3A Active CN112698824B (en) | 2021-01-06 | 2021-01-06 | View element state management method, device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112698824B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113377870A (en) * | 2021-06-21 | 2021-09-10 | 京东方科技集团股份有限公司 | Storage method, device and equipment of shared data |
CN114567623A (en) * | 2022-02-20 | 2022-05-31 | 中国银联股份有限公司 | Page display method and device |
CN115545213A (en) * | 2022-10-13 | 2022-12-30 | 北京鼎成智造科技有限公司 | Modeling method and device based on graphical behavior tree and reinforcement learning |
CN116610319A (en) * | 2023-06-06 | 2023-08-18 | 北京捷泰云际信息技术有限公司 | Method and system for constructing map application based on low-code platform |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100153907A1 (en) * | 2008-12-11 | 2010-06-17 | International Business Machines Corporation | Configurable Unified Modeling Language Building Blocks |
JP2010182287A (en) * | 2008-07-17 | 2010-08-19 | Steven C Kays | Intelligent adaptive design |
CN109597611A (en) * | 2018-11-29 | 2019-04-09 | 北京京东尚科信息技术有限公司 | Front end data flow control Components Development system, method, equipment and storage medium |
-
2021
- 2021-01-06 CN CN202110013533.3A patent/CN112698824B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2010182287A (en) * | 2008-07-17 | 2010-08-19 | Steven C Kays | Intelligent adaptive design |
US20100153907A1 (en) * | 2008-12-11 | 2010-06-17 | International Business Machines Corporation | Configurable Unified Modeling Language Building Blocks |
CN109597611A (en) * | 2018-11-29 | 2019-04-09 | 北京京东尚科信息技术有限公司 | Front end data flow control Components Development system, method, equipment and storage medium |
Non-Patent Citations (2)
Title |
---|
DJIKSTRA: "Solving Problems Differently with Flux and Redux", REACT NATIVE FOR MOBILE DEVELOPMENT * |
张政: "基于Redux架构的企业库存管理系统", 中国新通信, vol. 21, no. 15 * |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113377870A (en) * | 2021-06-21 | 2021-09-10 | 京东方科技集团股份有限公司 | Storage method, device and equipment of shared data |
CN114567623A (en) * | 2022-02-20 | 2022-05-31 | 中国银联股份有限公司 | Page display method and device |
CN114567623B (en) * | 2022-02-20 | 2023-09-08 | 中国银联股份有限公司 | Page display method and device |
CN115545213A (en) * | 2022-10-13 | 2022-12-30 | 北京鼎成智造科技有限公司 | Modeling method and device based on graphical behavior tree and reinforcement learning |
CN115545213B (en) * | 2022-10-13 | 2023-04-18 | 北京鼎成智造科技有限公司 | Modeling method and device based on graphical behavior tree and reinforcement learning |
CN116610319A (en) * | 2023-06-06 | 2023-08-18 | 北京捷泰云际信息技术有限公司 | Method and system for constructing map application based on low-code platform |
CN116610319B (en) * | 2023-06-06 | 2024-05-14 | 易智瑞信息技术有限公司 | A method and system for building map applications based on a low-code platform |
Also Published As
Publication number | Publication date |
---|---|
CN112698824B (en) | 2024-10-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110489101B (en) | Interface simulation method, system, medium and electronic equipment | |
CN112698824B (en) | View element state management method, device, electronic equipment and storage medium | |
CN109523187B (en) | Task scheduling method, device and equipment | |
US9805114B2 (en) | Composable selection model through reusable component | |
CN109634490B (en) | List display method, device, equipment and storage medium | |
CN111488285B (en) | Interface testing method, device, electronic equipment and computer readable storage medium | |
CN108897538A (en) | Page view display method and device, storage medium and electronic terminal | |
CN109783158A (en) | Using starting task processing method and device | |
WO2020119804A1 (en) | Page view display method, apparatus, device and storage medium | |
CN115145560A (en) | Business orchestration method, device, equipment, computer readable medium and program product | |
CN115357350A (en) | Task configuration method and device, electronic equipment and computer readable medium | |
CN111414152B (en) | Method, system, readable medium and electronic device for realizing business logic | |
US20120072891A1 (en) | Computer Language Syntax for Automatic Callback Function Generation | |
CN111143464B (en) | Data acquisition method and device and electronic equipment | |
CN114510334A (en) | Class instance calling method and device, electronic equipment and automatic driving vehicle | |
CN111381813B (en) | Front-end page debugging method and device, computer equipment and storage medium | |
CN113448550B (en) | Method and device for realizing collection management of classes, electronic equipment and computer medium | |
WO2023273617A1 (en) | Engine capability-based entity function implementation method and apparatus and electronic device | |
CN112346728B (en) | Device adaptation method, apparatus, device and computer readable medium | |
CN114489660B (en) | Buried point code adding method, device and equipment | |
CN112364050B (en) | Method, device, electronic equipment and storage medium for acquiring time period based on time control | |
CN110647405A (en) | System message processing method, electronic device, and computer-readable storage medium | |
CN112199187B (en) | Content display method, device, electronic equipment and computer readable storage medium | |
CN116302142A (en) | Lifecycle event management method, lifecycle event management device, storage medium, and electronic apparatus | |
CN117311838A (en) | File processing method, device, equipment and storage medium based on dynamic plug-in |
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 |