-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathView.js
40 lines (35 loc) · 968 Bytes
/
View.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
/**
* Base
* by kingpjchen 20160813
*/
define(function factory(require, exports, module) {
var RichBase = require('./RichBase')
var Store = require('./Store')
return RichBase.extend({
__config: {
store: null,
parse: null
},
init:function(config){
//存储配置项
this.setUpConfig(config);
//解析代理事件
this._delegateEvent()
},
load: function(){
var self = this
var promise = Store.fetch(this.get('store'));
promise.then(function(data){
self.setUp(data)
})
.catch(function(err){
self.setUp(null)
})
},
//提供给子类覆盖实现
setUp:function(data){
var parse = this.get('parse');
this.render(parse? parse.apply(this, data): data)
}
})
})