CN106560787A - MVVM-framework-based view page displaying method and apparatus - Google Patents
MVVM-framework-based view page displaying method and apparatus Download PDFInfo
- Publication number
- CN106560787A CN106560787A CN201611248881.4A CN201611248881A CN106560787A CN 106560787 A CN106560787 A CN 106560787A CN 201611248881 A CN201611248881 A CN 201611248881A CN 106560787 A CN106560787 A CN 106560787A
- Authority
- CN
- China
- Prior art keywords
- view
- data
- viewdata
- datacontroller
- initial data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/20—Software design
- G06F8/24—Object-oriented
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Human Computer Interaction (AREA)
- Controls And Circuits For Display Device (AREA)
Abstract
The invention provides an MVVM-framework-based view page displaying method and apparatus. The method comprises: when receiving of a first external input by a view controller is determined, the view controller sends an original data request to a data controller; after the data controller receives the original data request, the data controller makes a request of corresponding original data to a data storage device, receives the original data, generates a view data array, and sends the view data array to a view data processing controller; the view data processing controller processes the view data array to obtain view display data; and after receiving of a second external input by a view control element is determined, the view control element sends a view display data request to the view data processing controller, receives view display data sent by the view data processing controller, and displays the view display data at a view page. In addition, the invention also discloses a corresponding MVVM-framework-based view page displaying apparatus.
Description
Technical field
The present invention relates to technical field of mobile terminals, aobvious in particular to a kind of view page based on MVVM frameworks
Show method and apparatus.
Background technology
Generally need to show each bar information in the form of the page in various applications in mobile terminal, page presentation is typically
It is shown using model-view-controller (Model-View-Controller, MVC) framework.Conventional MVC framework bags
Include:Model layer (Model), view layer (View) and key-course (Controller).It is being shown using traditional MVC frameworks
When, similar with other kinds of view is shown, model layer is laid out envelope to table data after data are obtained by key-course
After dress, notify to be shown to view layer, wherein key-course is as an entirety when encapsulation is laid out to viewdata
Develop, be that concept is simple using the maximum advantage of this framework, it is easy to use.But, due to MVC concepts excessively
Simply, substantial amounts of code logic be not defined in MVC it is clear that causing to be easy for being stacked into controller
(Controller) it is inner, cause MVC to become Massive View Controller.
The content of the invention
In view of this, it is an object of the invention to provide a kind of view page display methods and dress based on MVVM frameworks
Put, to try hard to solve the problems, such as or at least alleviate above.
In a first aspect, the present invention provides a kind of view page display methods based on MVVM frameworks, the method includes:
When it is determined that view controller ViewController receives the first outside input, make described
ViewController to recording controller DataController sends initial data request;
After confirming that the DataController receives the initial data request, the DataController is made
Asked to ask corresponding initial data to data storage Model according to the initial data, receive the institute that the Model is returned
State initial data and generate viewdata array, the viewdata array is sent to viewdata processing controller
ViewModel;
It is determined that after the viewdata arrays that receive of the ViewModel, making the ViewModel regard to described
Diagram data array carries out process and obtains view display data;
It is determined that after the second outside input for receiving of view control View, making the View send out to the ViewModel
Send view display data to ask, make the View receive the view display data that the ViewModel sends, and in view page
It is middle to show the view display data.
Alternatively, in the method according to the invention, it is described to receive the original in the confirmation DataController
After beginning request of data, the DataController is set to be asked to ask phase to data storage Model according to the initial data
The initial data answered, receives the initial data of the Model returns and generates viewdata array, including:
The DataController is set to obtain at least one initial data from the Model using data acquisition function,
Process is carried out at least one initial data and obtains at least one original data model, at least one initial data
Model carries out process and obtains the viewdata array.
Alternatively, in the method according to the invention, it is described it is determined that the number of views that receives of the ViewModel
After according to array, make the ViewModel carry out process to the viewdata array and obtain view display data, including:
View page attribute information is set in the viewdata array, the view display data is obtained.
Alternatively, in the method according to the invention, the initial data and the life that the Model is returned is received described
Into before viewdata array, also include:
The ViewController is set to detect whether the DataController successfully gets according to call back function
The initial data.
Alternatively, in the method according to the invention, further, also include:
Before the ViewController receives the first outside input, the ViewController is being carried out
Initialization, makes the ViewController perform loading view approach, after the loading view approach is performed, creates described
The DataController and View.
Second aspect, the present invention provides a kind of view page display device based on MVVM frameworks, and the device includes:
Request unit, for when it is determined that view controller ViewController receives the first outside input, making institute
State ViewController and send initial data request to recording controller DataController;
Acquiring unit, for after confirming that the DataController receives the initial data request, making described
DataController asks to ask corresponding initial data to data storage Model according to the initial data, receives institute
State the initial data of Model returns and generate viewdata array, the viewdata array is sent to viewdata
Processing controller ViewModel;
Processing unit, for it is determined that after the viewdata arrays that receive of the ViewModel, making described
ViewModel carries out process and obtains view display data to the viewdata array;
Display unit, for it is determined that after the second outside input for receiving of view control View, making the View to institute
State ViewModel and send the request of view display data, make the View receive the view display number that the ViewModel sends
According to, and the view display data is shown in view page.
Alternatively, in a device in accordance with the invention, the acquiring unit is additionally operable to:
The DataController is set to obtain at least one initial data from the Model using data acquisition function,
Process is carried out at least one initial data and obtains at least one original data model, at least one initial data
Model carries out process and obtains the viewdata array.
Alternatively, in a device in accordance with the invention, the processing unit is additionally operable to:
View page attribute information is set in the viewdata array, the view display data is obtained.
Alternatively, in a device in accordance with the invention, also include:Detector unit, the detector unit is described for making
ViewController detects whether the DataController successfully gets the initial data according to call back function.
Alternatively, in a device in accordance with the invention, also include:Initialization unit, the initialization unit is additionally operable to
The ViewController is received before the first outside input, and the ViewController is being initialized, and is made
The ViewController performs loading view approach, after the loading view approach is performed, creates described
The DataController and View.
Technology according to the present invention scheme, DataController is combined by Model by ViewController
View logical sum mathematical logic is transferred in ViewModel, alleviates the burden of ViewController so that research staff compiles
The code level write is apparent, and the responsibility of each controller is clearer and more definite, reduces the degree of coupling, improves testability and durability, meanwhile,
Learning cost, development cost and reconfiguration cost are reduced, with higher implementation.
To enable the above objects, features and advantages of the present invention to become apparent, preferred embodiment cited below particularly, and coordinate
Appended accompanying drawing, is described in detail below.
Description of the drawings
In order to be illustrated more clearly that the technical scheme of the embodiment of the present invention, below will be attached to what is used needed for embodiment
Figure is briefly described, it will be appreciated that the following drawings illustrate only certain embodiments of the present invention, thus be not construed as it is right
The restriction of scope, for those of ordinary skill in the art, on the premise of not paying creative work, can be with according to this
A little accompanying drawings obtain other related accompanying drawings.
Fig. 1 shows the block diagram of the Example Computing Device of the view page display device of the present invention;
Fig. 2 shows a kind of flow chart of view page display methods that the embodiment of the present invention is provided;
Fig. 3 shows a kind of diagram of MVVM architecture designs that the embodiment of the present invention is provided;
Fig. 4 shows a kind of structure chart of view page display device 400 that the embodiment of the present invention is provided.
Specific embodiment
To make purpose, technical scheme and the advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention
Middle accompanying drawing, is clearly and completely described to the technical scheme in the embodiment of the present invention, it is clear that described embodiment is only
It is a part of embodiment of the invention, rather than the embodiment of whole.The present invention generally described and illustrated in accompanying drawing herein is real
Applying the component of example can be arranged and be designed with a variety of configurations.Therefore, it is of the invention to what is provided in the accompanying drawings below
The detailed description of embodiment is not intended to limit the scope of claimed invention, but is merely representative of the selected reality of the present invention
Apply example.Based on embodiments of the invention, the institute that those skilled in the art are obtained on the premise of creative work is not made
There is other embodiment, belong to the scope of protection of the invention.
The present invention's is resided in computing device based on the view page display device 400 of MVVM frameworks, and Fig. 1 is arranged as reality
The block diagram of the Example Computing Device 100 of the existing view page display device based on MVVM frameworks of the invention.Basic
In configuration 102, computing device 100 typically comprises system storage 106 and one or more processor 104.Memory is total
The communication that line 108 can be used between processor 104 and system storage 106.
Depending on desired configuration, processor 104 can be any kind of process, including but not limited to:Microprocessor
((μ P), microcontroller (μ C), digital information processor (DSP) or any combination of them.Processor 104 can include all
Such as cache, the processor core of one or more rank of on-chip cache 110 and second level cache 112 etc
114 and register 116.The processor core 114 of example can include arithmetic and logical unit (ALU), floating-point unit (FPU),
Digital signal processing core (DSP core) or any combination of them.The Memory Controller 118 of example can be with processor
104 are used together, or in some implementations, Memory Controller 118 can be an interior section of processor 104.
Depending on desired configuration, system storage 106 can be any type of memory, including but not limited to:Easily
The property lost memory (RAM), nonvolatile memory (ROM, flash memory etc.) or any combination of them.System is stored
Device 106 can include operating system 120, one or more is using 122 and routine data 124.In some embodiments,
May be arranged to be operated using routine data 124 on an operating system using 122.
Computing device 100 can also include contributing to from various interface equipments (for example, output equipment 142, Peripheral Interface
144 and communication equipment 146) to basic configuration 102 via the communication of bus/interface controller 130 interface bus 140.Example
Output equipment 142 include GPU 148 and audio treatment unit 150.They can be configured to contribute to via
One or more A/V port 152 is communicated with the various external equipments of such as display or loudspeaker etc.Outside example
If interface 144 can include serial interface controller 154 and parallel interface controller 156, they can be configured to contribute to
Via one or more I/O port 158 and such as input equipment (for example, keyboard, mouse, pen, voice-input device, touch
Input equipment) or the external equipment of other peripheral hardwares (such as printer, scanner etc.) etc communicated.The communication of example sets
Standby 146 can include network controller 160, and it can be arranged to be easy to via one or more COM1 164 and
The communication that individual or multiple other computing devices 162 pass through network communication link.
Network communication link can be an example of communication media.Communication media generally can be presented as in such as carrier wave
Or computer-readable instruction, data structure, the program module in the modulated data signal of other transmission mechanisms etc, and can
With including any information delivery media." modulated data signal " can be with such signal, in its data set or many
It is individual or it change can the mode of coding information in the signal carry out.Used as nonrestrictive example, communication media can be with
It is including the wire medium of such as cable network or private line network etc and such as sound, radio frequency (RF), microwave, infrared
Or other wireless mediums are in interior various wireless mediums (IR).Term computer-readable medium used herein can include depositing
Both storage media and communication media.
Computing device 100 can be implemented as a part for portable (or mobile) electronic equipment of small size, and these electronics set
Standby can be such as cell phone, personal digital assistant (PDA), personal media player device, wireless network browsing apparatus, individual
People's helmet, application specific equipment or can include any of the above function mixing apparatus.Computing device 100 can be with
It is embodied as including the personal computer of desktop computer and notebook computer configuration.
Fig. 2 shows a kind of flow chart of the view page display methods for being provided according to embodiments of the present invention.Such as Fig. 2 institutes
Show, the method is performed in computing device, and said method starts from step S210.
In step S210, when it is determined that view controller ViewController receives the first outside input, make
ViewController to recording controller DataController sends initial data request.Wherein, the first outside input can
Think touch input, input etc. clicked on, in actual applications, according to the difference of computing device touch-screen, above-mentioned input mode
Also it is different, specifically should be defined by actual conditions.
The present invention has Apple Macintosh operating system (iOS system) to show based on the view page that MVVM frameworks are carried out for operation,
MVVM is writing a Chinese character in simplified form for Model-View-ViewModel, i.e. Model-View-view model, and MVVM is from model-view-control structure
The design pattern evolved in device (Model-View-Controller, MVC) pattern and come.In MVVM frameworks, by view control
Recording controller (DataController) in device (ViewController) processed obtains original number from model layer (Model)
According to initial data is sent into data processing controller (ViewModel) and processed by DataController, view control
(View) obtaining from ViewModel needs the data of display and shows., wherein it is desired to measure for each view control (View)
It need to correspond that body customizes a ViewModel, Model and ViewModel.ViewModel is comprising all specific by UI
Interface and attribute, for View the data for needing to show are provided.When being designed based on MVVM frameworks, can be being placed on originally in a large number
View logical sum mathematical logic in ViewController is moved in ViewModel, so as to effectively alleviate
The burden of ViewController, detailed architecture design figure refers to Fig. 2.
Numerous view controls (View) in view controller (ViewController) management application, generally comprise:With
In the ViewController for showing content for user, such as UITableViewController, UIViewController;
Or, for controlling and showing the ViewController of other ViewController, this ViewController is general
All it is the container of a ViewController, such as UINavigationController, UITabbarController.This
ViewController in invention can be container.
In one embodiment, before ViewController receives the first outside input, right
When ViewController is initialized, make ViewController perform loading view approach, perform loading view side
After method, DataController and View is created.
In a particular application, view controller is initialized by init methods, ViewController holds first
Row loading view approach (viewDidLoad methods), after viewDidLoad methods are performed, ViewController is loaded into
Work(.Subsequently, View is added in ViewController, View can add multiple such as picture controls, button control etc.,
Due to multiple View can be created in the present invention, hereafter to be named as multiple View of firstView in a View
As a example by illustrate, and create recording controller (DataController), the DataController is original for obtaining
The instrument of data.Specific code is as follows:
Wherein, Subview is child control, and firstView is the view control (View) in the present invention, viewDidLoad
To load view approach.
In one embodiment, when user's point opens the page, ViewController is initialised, and in initialization procedure
Middle establishment DataController and View, when user clicks on such as button control, button control receives the first outside input
Afterwards, trigger ViewController and the request for obtaining the related data of button control is sent to DataController.
In step S220, after confirming that DataController receives the initial data request, make
DataController asks to ask corresponding initial data to data storage Model according to initial data, receives Model and returns
Return initial data and generate viewdata array, viewdata array is sent to viewdata processing controller
ViewModel。
In one embodiment, DataController is made to obtain at least one from Model using data acquisition function
Initial data, carries out process and obtains at least one original data model, at least one original number at least one initial data
Process is carried out according to model obtain viewdata array.
In one embodiment, make ViewController according to call back function detect DataController whether into
Work(gets the initial data.
In a particular application, DataController obtains original number by the fetchdata methods of itself to Model
According to.Identifying code is as follows:
Wherein, the method for the acquisition initial data that fetchdata is provided for dataController, error is readjustment side
Method.
DataController judges original number by the call back function (CallBack functions) to ViewController
According to whether successfully getting.After it is determined that DataController successfully gets initial data, DataController can be by
The each initial data that Model is returned all generates an original data model, and e.g., fModel1, fModel2 etc. will be generated
All of original data model be stored in viewdata array, such as firstSubjects arrays, DataController will
Initial data array is sent to ViewModel.Identifying code is as follows:
Wherein, renderFistView is the method for showing FistView, and fModel is original data model,
FirstSubjects is viewdata array, and callBack is readjustment letters of the DataController to ViewController
Number.
In step S230, it is determined that after the viewdata arrays that receive of ViewModel, making ViewModel to described
Viewdata array carries out process and obtains view display data.
In one embodiment, view page attribute information is set in viewdata array, is obtained view and is shown number
According to.
In a particular application, ViewModel can arrange the background face of view page by backgroundcolor attributes
Color, by reloadCollectionView methods collectionView interfaces are refreshed.ViewModel get view show
View display data, using the bindDataWithViewModel methods of itself, is supplied to View by registration according to after.With reference to generation
Code is as follows:
Wherein, backgroundColor is background color, and reloadCollectionView is refreshing
The method of CollectionView view interfaces.
It being understood, however, that all codes shown in the present invention are only schematic, concrete application should regard concrete condition
Depending on, the present invention is not only restricted to this.
In step S240, it is determined that after the second outside input for receiving of view control View, make View to
ViewModel sends the request of view display data, makes View receive the view display data that ViewModel sends, and in view
View display data is shown in the page.Wherein, the second outside input is for different touch-screens, and input mode is also different,
For example, for PC ends, outside input can be that the click of mouse is input into, and for smart mobile phone, outside input can be defeated to touch
Enter etc..
In a particular application, user, in browsing pages, needs after view page such as webpage, wechat article is opened
The slide downward page, in user's slip page, the data that View be able to will show in ViewModel requests for page,
ViewModel sends corresponding view display data to View according to the request of View, view display data such as word, picture etc.
Shown by view page.
Technology according to the present invention scheme, DataController is combined by Model by ViewController
View logical sum mathematical logic is transferred in ViewModel, alleviates the burden of ViewController so that research staff compiles
The code level write is apparent, and the responsibility of each controller is clearer and more definite, reduces the degree of coupling, improves testability and durability, meanwhile,
Learning cost, development cost and reconfiguration cost are reduced, with higher implementation.
Fig. 4 shows a kind of structure chart of view page display device of offer according to embodiments of the present invention.Such as Fig. 4 institutes
Show, the device is resided in computing device, including:Request unit 410, acquiring unit 420, processing unit 430, display unit
440th, detector unit 450 and initialization unit 460.
Request unit 410 is used for when it is determined that view controller ViewController receives the first outside input, makes
The ViewController to recording controller DataController sends initial data request.Wherein, initialization unit
460 were additionally operable to before the ViewController receives the first outside input, and the ViewController is being entered
Row initialization, makes the ViewController perform loading view approach, after the loading view approach is performed, creates institute
State the DataController and View.
Acquiring unit 420 is used for after confirming that the DataController receives the initial data request, makes institute
State DataController to be asked to ask corresponding initial data to data storage Model according to the initial data, receive
The initial data of the Model returns simultaneously generates viewdata array, and the viewdata array is sent to number of views
According to processing controller ViewModel.Wherein, acquiring unit 420 is additionally operable to make the DataController utilize data acquisition
Function obtains at least one initial data from the Model, carries out process at least one initial data and obtains at least one
Individual original data model, carries out process and obtains the viewdata array at least one original data model.Detection is single
Unit 450 is used to make the ViewController detect whether the DataController successfully gets according to call back function
The initial data.
Processing unit 430 is used for it is determined that after the viewdata arrays that receive of the ViewModel, making described
ViewModel carries out process and obtains view display data to the viewdata array.Wherein, processing unit 430 is additionally operable to
View page attribute information is set in the viewdata array, the view display data is obtained.
Display unit 440 be used for it is determined that after the second outside input for receiving of view control View, make the View to
The ViewModel sends the request of view display data, makes the View receive the view display number that the ViewModel sends
According to, and the view display data is shown in view page.
A kind of view page display device based on MVVM frameworks that the embodiment of the present invention is provided can be on equipment
Specific hardware or the software being installed on equipment or firmware etc..The device that the embodiment of the present invention is provided, its realize principle and
The technique effect of generation is identical with preceding method embodiment, is brief description, and device embodiment part does not refer to part, refers to
Corresponding contents in preceding method embodiment.Those skilled in the art can be understood that, be convenience and the letter of description
Clean, the specific work process of system, device and unit described above may be referred to corresponding in said method embodiment
Journey, will not be described here.
In embodiment provided by the present invention, it should be understood that disclosed apparatus and method, other sides can be passed through
Formula is realized.Device embodiment described above is only schematic, and for example, the division of the unit, only one kind are patrolled
Volume function is divided, and can have other dividing mode when actually realizing, and for example, multiple units or component can with reference to or can
To be integrated into another system, or some features can be ignored, or not perform.It is another, it is shown or discussed each other
Coupling or direct-coupling or communication connection can be INDIRECT COUPLING or communication link by some communication interfaces, device or unit
Connect, can be electrical, mechanical or other forms.
The unit as separating component explanation can be or may not be it is physically separate, it is aobvious as unit
The part for showing can be or may not be physical location, you can with positioned at a place, or can also be distributed to multiple
On NE.Some or all of unit therein can according to the actual needs be selected to realize the mesh of this embodiment scheme
's.
In addition, each functional unit in the embodiment that the present invention is provided can be integrated in a processing unit, also may be used
Being that unit is individually physically present, it is also possible to which two or more units are integrated in a unit.
If the function is realized and as independent production marketing or when using using in the form of SFU software functional unit, can be with
In being stored in a computer read/write memory medium.Based on such understanding, technical scheme is substantially in other words
The part contributed to prior art or the part of the technical scheme can be embodied in the form of software product, the meter
Calculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be individual
People's computer, server, or network equipment etc.) perform all or part of step of each embodiment methods described of the invention.
And aforesaid storage medium includes:USB flash disk, portable hard drive, read-only storage (ROM, Read-Only Memory), arbitrary access are deposited
Reservoir (RAM, Random Access Memory), magnetic disc or CD etc. are various can be with the medium of store program codes.
It should be noted that:Similar label and letter represents similar terms in following accompanying drawing, therefore, once a certain Xiang Yi
It is defined in individual accompanying drawing, then it need not be further defined and is explained in subsequent accompanying drawing, additionally, term " the
One ", " second ", " the 3rd " etc. are only used for distinguishing description, and it is not intended that indicating or implying relative importance.
Finally it should be noted that:Embodiment described above, specific embodiment only of the invention, to illustrate the present invention
Technical scheme, rather than a limitation, protection scope of the present invention is not limited thereto, although with reference to the foregoing embodiments to this
It is bright to be described in detail, it will be understood by those within the art that:Any those familiar with the art
The invention discloses technical scope in, it still can modify to the technical scheme described in previous embodiment or can be light
Change is readily conceivable that, or equivalent is carried out to which part technical characteristic;And these modifications, change or replacement, do not make
The essence of appropriate technical solution departs from the spirit and scope of embodiment of the present invention technical scheme.The protection in the present invention should all be covered
Within the scope of.Therefore, protection scope of the present invention described should be defined by scope of the claims.
Claims (10)
1. a kind of view page display methods based on MVVM frameworks, it is characterised in that the method includes:
When it is determined that view controller ViewController receives the first outside input, make the ViewController to
Recording controller DataController sends initial data request;
After confirming that the DataController receives the initial data request, make the DataController according to
The initial data asks to ask corresponding initial data to data storage Model, receives the original that the Model is returned
Beginning data simultaneously generate viewdata array, and the viewdata array is sent to viewdata processing controller ViewModel;
It is determined that after the viewdata arrays that receive of the ViewModel, making the ViewModel to the number of views
Process is carried out according to array obtain view display data;
It is determined that after the second outside input for receiving of view control View, making the View send to the ViewModel and regarding
Figure display data is asked, and makes the View receive the view display data that the ViewModel sends, and is shown in view page
Show the view display data.
2. the method for claim 1, it is characterised in that described to confirm that it is described that the DataController is received
After initial data request, the DataController is set to be asked to be asked to data storage Model according to the initial data
Corresponding initial data, receives the initial data of the Model returns and generates viewdata array, including:
The DataController is set to obtain at least one initial data from the Model using data acquisition function, to institute
State at least one initial data and carry out process and obtain at least one original data model, at least one original data model
Carry out process and obtain the viewdata array.
3. the method for claim 1, it is characterised in that it is described it is determined that the ViewModel receive described in regard
After diagram data array, make the ViewModel carry out process to the viewdata array and obtain view display data, including:
View page attribute information is set in the viewdata array, the view display data is obtained.
4. the method for claim 1, it is characterised in that receive the initial data that the Model is returned described
And generate before viewdata array, also include:
The ViewController is made according to call back function detects whether the DataController successfully get
Initial data.
5. the method for claim 1, it is characterised in that further, also include:
Before the ViewController receives the first outside input, the ViewController is being carried out initially
Change, make the ViewController perform loading view approach, after the loading view approach is performed, create described
The DataController and View.
6. a kind of view page display device based on MVVM frameworks, it is characterised in that the device includes:
Request unit, it is described for when it is determined that view controller ViewController receives the first outside input, making
ViewController to recording controller DataController sends initial data request;
Acquiring unit, for after confirming that the DataController receives the initial data request, making described
DataController asks to ask corresponding initial data to data storage Model according to the initial data, receives institute
State the initial data of Model returns and generate viewdata array, the viewdata array is sent to viewdata
Processing controller ViewModel;
Processing unit, for it is determined that after the viewdata arrays that receive of the ViewModel, making described
ViewModel carries out process and obtains view display data to the viewdata array;
Display unit, for it is determined that after the second outside input for receiving of view control View, making the View to described
ViewModel sends the request of view display data, makes the View receive the view display data that the ViewModel sends,
And show the view display data in view page.
7. device as claimed in claim 6, it is characterised in that the acquiring unit is additionally operable to:
The DataController is set to obtain at least one initial data from the Model using data acquisition function, to institute
State at least one initial data and carry out process and obtain at least one original data model, at least one original data model
Carry out process and obtain the viewdata array.
8. device as claimed in claim 6, it is characterised in that the processing unit is additionally operable to:
View page attribute information is set in the viewdata array, the view display data is obtained.
9. device as claimed in claim 6, it is characterised in that also include:Detector unit, the detector unit is described for making
ViewController detects whether the DataController successfully gets the initial data according to call back function.
10. device as claimed in claim 6, it is characterised in that also include:Initialization unit, the initialization unit is also used
In before the ViewController receives the first outside input, the ViewController is being carried out initially
Change, make the ViewController perform loading view approach, after the loading view approach is performed, create described
The DataController and View.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611248881.4A CN106560787A (en) | 2016-12-29 | 2016-12-29 | MVVM-framework-based view page displaying method and apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611248881.4A CN106560787A (en) | 2016-12-29 | 2016-12-29 | MVVM-framework-based view page displaying method and apparatus |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106560787A true CN106560787A (en) | 2017-04-12 |
Family
ID=58485843
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611248881.4A Pending CN106560787A (en) | 2016-12-29 | 2016-12-29 | MVVM-framework-based view page displaying method and apparatus |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106560787A (en) |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107145350A (en) * | 2017-04-28 | 2017-09-08 | 武汉斗鱼网络科技有限公司 | A kind of software development methodology and system |
CN107479891A (en) * | 2017-08-17 | 2017-12-15 | 北京理工大学 | One kind is based on MVC model datas processing system and method |
CN108427555A (en) * | 2018-01-25 | 2018-08-21 | 山东汇贸电子口岸有限公司 | A kind of model for distributed storage variable data distribution method and system |
CN108882039A (en) * | 2018-07-09 | 2018-11-23 | 北京酷我科技有限公司 | A kind of method for handover control of the video playing owner |
CN108900913A (en) * | 2018-07-09 | 2018-11-27 | 北京酷我科技有限公司 | A kind of hierarchical view control method based on the video playing owner |
CN109101225A (en) * | 2017-06-20 | 2018-12-28 | 腾讯科技(深圳)有限公司 | Component building method and device, Component Gallery framework and computer readable storage medium |
CN109460226A (en) * | 2018-11-26 | 2019-03-12 | 深圳乐信软件技术有限公司 | Test certificate image generation method, device, equipment and storage medium |
CN109634599A (en) * | 2018-12-14 | 2019-04-16 | 北京字节跳动网络技术有限公司 | Display methods, device, equipment and the storage medium of page view |
CN109783085A (en) * | 2019-02-02 | 2019-05-21 | 北京顺丰同城科技有限公司 | A kind of application program generation method, device and electronic equipment |
CN110609728A (en) * | 2019-09-25 | 2019-12-24 | 北京字节跳动网络技术有限公司 | Page generation method and device and electronic equipment |
CN110995565A (en) * | 2019-10-25 | 2020-04-10 | 陈奕博 | Page display method based on MVVM (multifunction vehicle virtual machine) architecture |
CN111796577A (en) * | 2020-06-29 | 2020-10-20 | 中国第一汽车股份有限公司 | Data instruction processing method and device, vehicle and storage medium |
CN112711400A (en) * | 2020-12-31 | 2021-04-27 | 北京字跳网络技术有限公司 | View processing method, device, storage medium and computer program product |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105446740A (en) * | 2015-11-27 | 2016-03-30 | 国网信息通信产业集团有限公司 | MVVM (Model-View-View Model) architecture based Web front-end presentation system |
-
2016
- 2016-12-29 CN CN201611248881.4A patent/CN106560787A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105446740A (en) * | 2015-11-27 | 2016-03-30 | 国网信息通信产业集团有限公司 | MVVM (Model-View-View Model) architecture based Web front-end presentation system |
Non-Patent Citations (1)
Title |
---|
LANSEKUANGTU: "《实践干货!猿题库iOS客户端架构设计》", 《HTTP://WWW.COCOACHINA.COM/IOS/20160108/14911.HTML》 * |
Cited By (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107145350A (en) * | 2017-04-28 | 2017-09-08 | 武汉斗鱼网络科技有限公司 | A kind of software development methodology and system |
CN109101225A (en) * | 2017-06-20 | 2018-12-28 | 腾讯科技(深圳)有限公司 | Component building method and device, Component Gallery framework and computer readable storage medium |
CN107479891B (en) * | 2017-08-17 | 2020-05-12 | 北京理工大学 | MVC model-based data processing system and method |
CN107479891A (en) * | 2017-08-17 | 2017-12-15 | 北京理工大学 | One kind is based on MVC model datas processing system and method |
CN108427555A (en) * | 2018-01-25 | 2018-08-21 | 山东汇贸电子口岸有限公司 | A kind of model for distributed storage variable data distribution method and system |
CN108882039A (en) * | 2018-07-09 | 2018-11-23 | 北京酷我科技有限公司 | A kind of method for handover control of the video playing owner |
CN108900913A (en) * | 2018-07-09 | 2018-11-27 | 北京酷我科技有限公司 | A kind of hierarchical view control method based on the video playing owner |
CN108882039B (en) * | 2018-07-09 | 2020-11-03 | 北京酷我科技有限公司 | Switching control method for video playing owner |
CN109460226A (en) * | 2018-11-26 | 2019-03-12 | 深圳乐信软件技术有限公司 | Test certificate image generation method, device, equipment and storage medium |
CN109460226B (en) * | 2018-11-26 | 2022-04-22 | 深圳乐信软件技术有限公司 | Test certificate image generation method, device, equipment and storage medium |
CN109634599A (en) * | 2018-12-14 | 2019-04-16 | 北京字节跳动网络技术有限公司 | Display methods, device, equipment and the storage medium of page view |
CN109783085A (en) * | 2019-02-02 | 2019-05-21 | 北京顺丰同城科技有限公司 | A kind of application program generation method, device and electronic equipment |
CN110609728A (en) * | 2019-09-25 | 2019-12-24 | 北京字节跳动网络技术有限公司 | Page generation method and device and electronic equipment |
CN110995565A (en) * | 2019-10-25 | 2020-04-10 | 陈奕博 | Page display method based on MVVM (multifunction vehicle virtual machine) architecture |
CN111796577A (en) * | 2020-06-29 | 2020-10-20 | 中国第一汽车股份有限公司 | Data instruction processing method and device, vehicle and storage medium |
CN112711400A (en) * | 2020-12-31 | 2021-04-27 | 北京字跳网络技术有限公司 | View processing method, device, storage medium and computer program product |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106560787A (en) | MVVM-framework-based view page displaying method and apparatus | |
CN110019279B (en) | Online document collaborative updating method, device, equipment and storage medium | |
CN103412644B (en) | accessory device architecture | |
CN104199552B (en) | Multi-display method, equipment and system | |
CN104025003B (en) | Translate animation | |
CN110109670B (en) | Method and device for processing view list data, electronic equipment and storage medium | |
EP3012770B1 (en) | Method for unlocking device based on touch size, shape, number of touches pattern | |
US11144173B2 (en) | Electronic device and method for providing object recommendation | |
US10168892B2 (en) | Device for handling touch input and method thereof | |
CN108038112A (en) | Document handling method, mobile terminal and computer-readable recording medium | |
CN105264507A (en) | Apparatus and method of recognizing external device in a communication system | |
CN107844728A (en) | Identify method and device, computer installation and the computer-readable recording medium of Quick Response Code | |
CN109308175A (en) | The electronic device and method of Display on the same screen are carried out using mobile device and display equipment | |
CN105849683A (en) | Method and apparatus for processing object provided through display | |
CN208985138U (en) | Electronic device, computer equipment and the data processing system of Display on the same screen | |
CN106877103B (en) | A kind of method that realizing circuit switching and adapter | |
CN112200318A (en) | Target detection method, device, machine readable medium and equipment | |
CN106716063A (en) | Automatic sensor selection based on requested sensor characteristics | |
US10990207B2 (en) | Electronic device and screen provision method of electronic device | |
CN108563668A (en) | The method, apparatus and terminal device of the Hybrid page jump H5 pages | |
US20220121357A1 (en) | Electronic device and method for operating keypad thereof | |
CN107423395A (en) | Navigation data processing system | |
CN109739738A (en) | Event log management method, system and relevant apparatus based on HTML5 | |
US10643252B2 (en) | Banner display method of electronic device and electronic device thereof | |
CN108038219A (en) | Picture method to set up, device, computer installation and computer-readable recording 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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170412 |
|
RJ01 | Rejection of invention patent application after publication |