2015年12月27日 星期日

Extjs MVVM design pattern

Extjs MVVM design pattern



Extjs 5 introduce viewController,make code more cleaner.
The logic depend with view,sounds good,but that's also mean logic can not be reuse.
So I design the abstract view and view controller,declare base logic in project.
The other view can user those base logic by mixins.
If any view need to talk with other view,I suggest use event,we can bubble event to talk with container and fire event to talk with componment.
I persist controller can not operate any componment that can't see,make sure every view is independent.
       
Naturally,We can change any componment in container,just like subway right?
I call this design is 'sandwich',I wish every one like it.
Enjoy it....
go to jsfiddle
go to sencha fiddle