-
Notifications
You must be signed in to change notification settings - Fork 3
/
model.js
1267 lines (1001 loc) · 35.9 KB
/
model.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* 页面模型
* created by dorsywang
* 页面逻辑层的封装
* @2014-7-29 增加注释文档
*/
(function(){
/**
* new一个obj
*/
var DB = {
cgiHttp: function(opt){
$.ajax({
url: opt.url,
data: opt.param,
success: function(data){
opt.succ(data);
},
error: function(data){
opt.error(data);
}
});
}
};
var Tmpl = function(tmpl, data, tool){
return {
appendTo: function(container){
$(container).append(tmpl);
}
};
};
var newObject = function(func){
var obj = {};
func(obj);
obj.__proto__ = func.prototype;
return obj;
};
/**
* 根据cgi和参数生成对应的localStorge
* 要去除类似随机数的参数
*/
var getKey = function(cgiName, param){
var o = {};
for(var i in param){
if(i === "from" || i === "sid" || i === "bkn"){
continue;
}
o[i] = param[i];
}
var key = cgiName + "_" + JSON.stringify(o);
return key;
};
var emptyFunc = function(){};
// 逐步代替scrollHandle
// scrollHelper复制一份 便于model控制
var preScrollTop = 0;
var scrollHandlerMap = {
};
var scrollHelper = {
init:function(opt){
this.container = $(opt.container);
this.scollEndCallback = opt.scollEndCallback;
this.scrollToBottomCallback = opt.scrollToBottomCallback;
this.scrollToHalfCallback = opt.scrollToHalfCallback;
this.bindHandler();
},
bindHandler:function(){
this.container.on("scroll", $.proxy(this.onScroll,this));
},
setScrollEl: function(el){
this.container.off("scroll", $.proxy(this.onScroll,this));
this.container = el;
this.bindHandler();
},
removeModel: function(model){
var scrollEl = model._scrollEl;
var el = scrollEl;
if(typeof scrollEl == "string"){
el = $(scrollEl);
}
if(el.attr("id")){
var id = el.attr("id");
delete scrollHandlerMap[id];
}
},
addModel: function(model){
var scrollEl = model._scrollEl;
var el = scrollEl;
if(typeof scrollEl == "string"){
el = $(scrollEl);
}
var id;
if(el == window){
id = '__window__';
}else{
id = el.attr("id");
if(id){
}else{
id = "d_" + ~~ (100000 * Math.random());
el.attr("id", id);
}
}
if(scrollHandlerMap[id]){
scrollHandlerMap[id].push(model);
}else{
scrollHandlerMap[id] = [model];
this.init({
container: el,
scrollToHalfCallback: function(){
scrollHandlerMap[id].map(function(item){
if(! item.canScrollInMTB){
return;
}
if(item.type == "scrollModel"){
if(! item.freezed && item.scrollEnable){
item.rock();
}
}else{
if(! item.freezed && item.currModel.type == "scrollModel" && !item.currModel.freezed && item.currModel.scrollEnable){
item.currModel.rock();
}
}
});
}
});
}
},
//滚动事件
onScroll:function(e){
var self = this;
var container = e.target;
var scrollTop,
scrollHeight,
windowHeight;
//android 和 ios 5以下版本
if(container == document){
scrollTop = window.scrollY;
windowHeight = window.innerHeight;
scrollHeight = document.body.scrollHeight;
}
//ios 5+版本
else{
var style = window.getComputedStyle(container);
scrollTop = container.scrollTop;
windowHeight = parseInt(style.height) + parseInt(style.paddingTop) + parseInt(style.paddingBottom) + parseInt(style.marginTop) + parseInt(style.marginBottom);
scrollHeight = container.scrollHeight;
}
//滚动到2/3处
if (scrollTop + windowHeight >= scrollHeight * 2 / 3 && scrollTop > preScrollTop) {
this.scrollToHalfCallback && this.scrollToHalfCallback(e);
}
//滚动到底部
else if(scrollTop + windowHeight >= scrollHeight){
this.scrollToBottomCallback && this.scrollToBottomCallback(e);
}
preScrollTop = scrollTop;
}
};
//记录是不是第一次进来
var isFirstRender = 1;
var _containerCountInfo = {};
/**
* 普通的页面渲染模型
*/
var renderModel = function(opt){
// 使用空func便于后续支持更便捷的对象继承方式
// 比如 var a = new RenderModel({});
// var b = new a(); // b继承自a
var func = function(o){
};
func.renderTmpl = opt.tmpl; //渲染的模板
func.cgiName = opt.url; //请求的cgi
func.wrapper = opt.wrapper; //要渲染到的dom元素,支持selector和元素
func.param = opt.param; //请求的参数,可以是对象 或者 function
func.beforeRequest = opt.beforeRequest || function(){};
func.processData = opt.processData; //对数据进行的加工处理 这时不允许对view层做修改
func.data = opt.data; //如果存在data就会直接用data的数据而不用去请求cgi
func.renderTool = opt.tool; //渲染模板的时候可以传入一个工具函数对象,在view层使用
func.onreset = opt.onreset; //模型被重置时候做的处理
func.events = opt.events; //模型注册的事件
func.complete = opt.complete; //模型完成渲染后进行的操作,这时候可以进行view层的修改
func.myData = opt.myData; //自定义数据
func.error = opt.error; //cgi出错时候的处理
func.noRefresh = opt.noRefresh || 0; //是不是自己提供refresh方法
func.scrollEl = opt.scrollEl || null;
func.paramCache = []; //参数的请求缓存
func.cgiCount = 0; //cgi的请求次数
func.dataCache = []; //cgi回来的data缓存
func.feedPool = []; //需要喂养数据的模型池
func.isFirstRender = 1; //标记是不是第一次渲染模型
func.eventsBinded = 0; //标记事件是不是被注册绑定过了
func.isFirstDataRequestRender = 0; //标记是不是第一次发cgi请求进行渲染
//是否使用预加载模式
func.usePreLoad = opt.usePreLoad;
func.__proto__ = renderModel.prototype; //不解释
func.prototype = func; //不解释
if(opt.wrapper){
/*
if(typeof opt.wrapper !== "string"){
}
*/
if(_containerCountInfo[opt.wrapper]){
_containerCountInfo[opt.wrapper] ++;
}else{
_containerCountInfo[opt.wrapper] = 1;
}
}
return func;
};
/**
* 普通渲染模型的原型链
*/
renderModel.prototype = {
// 类型
type: "renderModel",
// 外放tab
exportTab: function(selector){
var key = "recieveModel" + selector;
if(window[key] && typeof window[key] === "function"){
window[key](selector, this);
}
},
// cgi取数据
getData: function(callback){
var _this = this;
// 如果之前有发过请求,则使用缓存的参数池中对应的参数,否则使用param方法构造参数
var param = _this.paramCache[_this.cgiCount] || (typeof this.param == "object" && this.param) || (typeof this.param === "function" && this.param.call(this)) || {};
var opt = {
url: this.cgiName,
param: param,
succ: function(res, isLocalRender){
// isLocalRender标记是从localStroage中取到的数据 直接执行回调
if(isLocalRender){
callback(res);
return;
}
// 更新此次的缓存cgi数据和请求参数数据
_this.dataCache[_this.cgiCount] = res;
_this.paramCache[_this.cgiCount] = param;
// cgi请求参数自增
_this.cgiCount ++;
// 如果是第一次从cgi请求的数据 则缓存数据到localStrage里面
if(_this.cgiCount == 1){
var key = getKey(_this.cgiName, param);
try{
window.localStorage.setItem(key, JSON.stringify(res));
}catch(e){
window.localStorage.clear();
window.localStorage.setItem(key, JSON.stringify(res));
}
}
//执行回调
callback(res);
},
err: function(res){
_this.paramCache[_this.cgiCount] = param;
_this.cgiCount ++;
_this.error && _this.error(res, _this.cgiCount);
}
};
//使用预加载数据相关逻辑
if(this.usePreLoad && this.preLoadData){
//取消预加载模式,方面model后面可以继续使用常规的加载模式
this.usePreLoad = false;
//非正常预加载数据,走原有逻辑发cgi重试
if(this.preLoadData.type != 'error' && this.preLoadData.retcode == 0){
//预加载数据模式的数据保存与渲染
opt.succ(this.preLoadData);
return;
}
// else{
// 出错的话重新先走缓存,再走cgi拉的原有逻辑
// this.cgiCount = 0;
// this.isFirstRender = 1;
// }
}
//如果是第一次渲染,且cgi也还没有发送请求 那么 使用缓存中数据
if(_this.cgiCount == 0 && _this.isFirstRender){
var localData;
var key = getKey(this.cgiName, param);
localData = JSON.parse(window.localStorage.getItem(key) || "{}");;
if(localData.result){
try{
opt.succ(localData, 1);
}catch(e){
}
}
_this.isFirstRender = 0;
}
// 如果缓存中有数据 使用缓存数据 否则发送请求
if(this.dataCache[_this.cgiCount]){
opt.succ(this.dataCache[_this.cgiCount]);
}
//使用预加载数据模式的话,没有缓存也不发请求了,静待预加载数据返回即可
else if(!this.usePreLoad){
DB.cgiHttp(opt);
}
else{
_this.paramCache[_this.cgiCount] = param;
}
},
clearLocalData:function(cgiCount){
var param = this.paramCache[cgiCount || 0];
var key = getKey(this.cgiName, param);
window.localStorage.removeItem(key);
},
//设置预加载数据
setPreLoadData:function(res){
this.preLoadData = res;
},
/**
* 模型重置
* 清空container, 并且用缓存数据重新渲染(如果有缓存数据,没有则继续发布请求)
*/
reset: function(){
/*
var container = this.wrapper;
if(typeof container == "string"){
container = $(container);
}
container.html("");
*/
this.cgiCount = 0;
this.melt();
this.onreset && this.onreset();
},
render: function(container, isReplace){
var _this = this;
this.scrollEnable = 0;
if(typeof container === "string"){
container = $(container);
}
this.beforeRequest && this.beforeRequest();
if(this.cgiName){
this.getData(function(data){
if(_this.cgiCount == 1) {
_this.onreset && _this.onreset();
container.html("");
}
_this.processData && _this.processData.call(_this, data, _this.cgiCount);
Tmpl(_this.renderTmpl, data.result || data, _this.renderTool || {}).appendTo(container);
_this.scrollEnable = 1;
if(_this.eventsBinded){
}else{
_this.events && _this.events();
if(_this.hasOwnProperty("eventsBinded")){
_this.eventsBinded = 1;
}else{
_this.__proto__.eventsBinded = 1;
}
}
_this.feedPool.map(function(item){
if (!item.noFeed) {
item.setFeedData(data, _this.cgiCount);
item.rock();
}
});
_this.complete && _this.complete(data, _this.cgiCount);
_this.isFirstDataRequestRender ++;
});
}else{
if(this.data){
if(typeof this.data == "function"){
this.data = this.data();
}
}else{
this.data = {};
}
if(this.data){
_this.processData && _this.processData.call(this, this.data, _this.cgiCount);
container.html("");
Tmpl(_this.renderTmpl, this.data.result || this.data, _this.renderTool).update(container);
if(_this.eventsBinded){
}else{
_this.events && _this.events();
if(_this.hasOwnProperty("eventsBinded")){
_this.eventsBinded = 1;
}else{
_this.__proto__.eventsBinded = 1;
}
}
_this.scrollEnable = 1;
_this.feedPool.map(function(item){
if (!item.noFeed) {
item.setFeedData(this.data, _this.cgiCount);
item.rock();
}
});
_this.complete && _this.complete(this.data, _this.cgiCount);
_this.isFirstDataRequestRender ++;
}
}
},
/**
* rock
*/
rock: function(){
this.render(this.wrapper, 1);
},
processData: function(data){
},
//用自己辛苦拿到的数据哺乳另一个模型
feed: function(model){
this.feedPool.push(model);
model.feeded = 1;
},
setFeedData: function(data, cgiCount){
this.data = data;
this.cgiCount = cgiCount;
},
/**
* 用新的数据对更新模型
*/
update: function(data){
this.data = data;
this.reset();
this.rock();
},
//只刷新数据不更新视图
resetData: function(){
this.dataCache = [];
this.cgiCount = 0;
this.onreset && this.onreset();
},
/**
* 重新请求cgi刷新模型
*/
refresh: function(){
if(this.noRefresh){
}else{
this.dataCache = [];
this.reset();
this.rock();
}
},
/**
* 隐藏模型
*/
hide: function(){
var container = this.wrapper;
if(typeof container === "string"){
container = $(container);
}
container.hide();
},
/**
* 显示模型
*/
show: function(){
var container = this.wrapper;
if(typeof container === "string"){
container = $(container);
}
container.show();
},
/**
* 继承模型
*/
extend: function(opt){
var func = function(){
};
var events = opt.events;
func.prototype = this;//object;
var clone = new func();
clone.feedPool = [];
clone.cgiCount = 0;
clone.dataCache = [];
clone.isFirstDataRequestRender = 0;
clone.isFirstRender = 1;
clone._addedToModel = 0;
//如果重新定义了param 不使用缓存
if(opt.param){
clone.paramCache = [];
}
for(var i in opt){
clone[i] = opt[i];
}
//如果定义了事件 就不使用原来的事件
if(events){
clone.events = function(){
events && events.call(this);
};
clone.eventsBinded = 0;
}
if(clone.wrapper){
if(_containerCountInfo[clone.wrapper]){
_containerCountInfo[clone.wrapper] ++;
}else{
_containerCountInfo[clone.wrapper] = 1;
}
}
return clone;
},
freeze: function(){
this.freezed = 1;
},
melt: function(){
this.freezed = 0;
}
};
var scrollHanderPool = [];
var scrollDom = window;
if($.os.ios){
scrollDom = "#js_bar_main";
if($(scrollDom)[0] == document.body){
scrollDom = window;
}
}
var scrollArea = scrollDom;
var scrollModel = function(opt){
var Render = new renderModel(opt);
Render.scrollEnable = 1;
Render.__proto__.eventsBinded = 0;
Render.type = "scrollModel";
Render._scrollEl = opt.scrollEl || opt.wrapper || ($.os.ios ? "#js_bar_main" : window);
Render._ctlByMutitab = 0;
var events = Render.events;
Render.events = function(){
events && events.call(this);
};
Render.renderContent = function(){
this.render(this.wrapper, 1);
};
Render._addedToModel = 0;
Render.rock = function(){
this.render(this.wrapper, 1);
if(! this._addedToModel){
ScrollHelper.addModel(this);
this._addedToModel = 1;
}
};
return Render;
};
// 虚模型 待实现模型
// @todo 进一步封装
var abstractModel = function () {
};
abstractModel.prototype = {
type: "abstractModel",
rock: function(){
},
reset: function () {
},
refresh: function () {
},
freeze: function () {
},
resetData: function(){
}
};
var cgiModel = function(opt){
this.cgiName = opt.cgiName;
this.param = opt.param;
this.processData = opt.processData;
this.complete = opt.complete;
this.error = opt.error;
this.paramCache = [];
this.cgiCount = 0;
this.dataCache = [];
this.feedPool = [];
this.isFirstRender = 1;
this.eventsBinded = 0;
this.isFirstDataRequestRender = 0;
};
cgiModel.prototype = {
getData: renderModel.prototype.getData,
rock: function(){
var _this = this;
this.getData(function(data){
_this.processData && _this.processData(data, _this.cgiCount);
_this.complete && _this.complete(data, _this.cgiCount);
});
},
reset: function(){
this.dataCache = [];
},
refresh: function(){
this.dataCache = [];
this.rock();
},
extend: renderModel.prototype.extend
};
var handlers = {
onScrollEnd: function(){},
onScrollToBottom: function(){},
onScrollToHalf: function(){
scrollHanderPool.map(function(item, index){
if(! item.canScrollInMTB){
return;
}
if(item.type == "scrollModel"){
if(! item.freezed && item.scrollEnable){
item.rock();
return;
}
}else{
if(! item.freezed && item.currModel.type == "scrollModel" && !item.currModel.freezed && item.currModel.scrollEnable){
item.currModel.rock();
}
}
});
}
};
scrollHelper.init({
container: scrollArea,
scollEndCallback: handlers.onScrollEnd,
scrollToBottomCallback: handlers.onScrollToBottom,
scrollToHalfCallback: handlers.onScrollToHalf
});
/**
* 多tab切换管理模型
*/
var mutitabModel = function(){
this.pool = [];
this.currModel = null;
this.eventBinded = 0;
};
mutitabModel.prototype = {
_bindSwitchEvent: function(){
var _this = this;
if(! this.eventBinded){
$("body").on("tap", function(e){
var target = $(e.target);
var containerCountInfo = _containerCountInfo;
var currentModel = [];
var indexArr = []
for(var i = 0; i < _this.pool.length; i ++){
var selector = _this.pool[i][0];
var hittedEl = target.closest(selector);
if(hittedEl && hittedEl.length){
currentModel.push(_this.pool[i]);
indexArr.push(i);
}
}
if(currentModel.length){
var item = currentModel[0];
var selector = item[0];
var smodel = item[1];
if(typeof smodel === "string"){
var key = "recieveModel" + selector;
window[key] = function(selector, model){
if(selector && model){
_this.pool[indexArr[0]] = [selector, model];
window[key] = null;
delete window[key];
_this.rock(selector);
}
};
loadjs.loadModule(smodel);
return;
}
_this.currModel = smodel;
smodel.canScrollInMTB = 1;
_this.beforeTabHandler && _this.beforeTabHandler.call(_this, selector, 'switch')
// render container为空的情况
if(! smodel.wrapper){
if(smodel.type === "pageModel"){
_this.currModel._switchedToPage();
}
}else{
if(containerCountInfo[smodel.wrapper] > 1){
_this.currModel.reset();
_this.currModel.rock();
}else{
if(smodel.isFirstDataRequestRender > 0){
}else{
smodel.rock();
}
}
}
if(_this.currModel.type == "linkModel") {
_this.tabHander && _this.tabHander.call(_this, selector, 'switch');
return;
}
_this.pool.map(function(item){
var s = item[0];
if(item[1] !== smodel){
if(typeof item[1] !== "string"){
item[1].hide();
item[1].canScrollInMTB = 0;
$(s).removeClass('active')
.removeClass('selected');
}
}
});
$(selector).addClass('active')
.addClass('selected');
smodel.show();
_this.tabHander && _this.tabHander.call(_this, selector, 'switch');
}
});
this.eventBinded = 1;
}else{
}
},
rock: function(_selector){
var _this = this;
var initedSmodelInfo;
var containerCountInfo = _containerCountInfo;
for(var index = 0; index < this.pool.length; index ++){
var item = this.pool[index];
var selector = item[0];
var smodel = item[1];
if(this.initTab){
if(selector === this.initTab){
initedSmodelInfo = [selector, smodel, index];
}
}else{
if(_selector){
if(_selector === selector) {
initedSmodelInfo = [selector, smodel, index];
}
}else{
if(index === 0){
initedSmodelInfo = [selector, smodel, index];
}
}
}
}
if(! initedSmodelInfo){
console.info("Model cannot init mutitab, check if selector exists!");
return;
}
this._bindSwitchEvent();
var selector = initedSmodelInfo[0];
var smodel = initedSmodelInfo[1];
var index = initedSmodelInfo[2];
if(typeof smodel === "string"){
var key = "recieveModel" + selector;
window[key] = function(selector, model){
if(selector && model){
_this.pool[index] = [selector, model];
window[key] = null;
delete window[key];
model.scrollEnable = 0;
_this.rock(selector);
}
};
loadjs.loadModule(smodel);
return;
}
this.beforeTabHandler && this.beforeTabHandler.call(this, selector, 'switch')
smodel.canScrollInMTB = 1;
this.currModel = smodel;
this.currModel.reset();
this.currModel.rock();
this.pool.map(function(item){
var m = item[1];
if(m !== smodel){
if(typeof m === "string"){
}else{
$(item[0]).removeClass('active')
.removeClass('selected');
m.hide();
m.canScrollInMTB = 0;
}
}
});
$(selector).addClass('active')
.addClass('selected');
this.currModel.show();
this.scrollEnable = this.currModel.scrollEnable;
this.tabHander && this.tabHander.call(this, selector, 'init');
},
add: function(selector, smodel){
smodel._modelSelector = selector;
this.pool.push([selector, smodel]);
smodel.controller = this;
if(typeof smodel === "string"){
if(window.loadJsConfig && window.loadJsConfig.modules){
if(! window.loadJsConfig.modules[smodel]){
console.info("mutitab connot load lazymodel while " + smodel + " not exists in loadJsConfig modules!");
}
}
}else{
smodel.scrollEnable = 0;
}
},