Authored by 郭成尧

fetch-data

... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-04-26 17:19:19
* @Last Modified by: Targaryen
* @Last Modified time: 2017-04-26 17:46:13
* @Last Modified time: 2017-04-27 11:29:34
*/
'use strict';
... ... @@ -18,7 +18,18 @@ class IndexController extends Controller {
constructor() {
super();
this.navView = new NavView();
this.guang = new Guang();
this.guangModel = new Guang();
this.navView.on('navchange', this.fetchList.bind(this));
}
fetchList(e) {
let type = $(e).data('type');
this.guangModel.loadMore({
type: type
}).then(result => {
this.navView.listChange(result);
});
}
}
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-04-26 17:31:12
* @Last Modified by: Targaryen
* @Last Modified time: 2017-04-26 17:47:43
* @Last Modified time: 2017-04-27 11:32:32
*/
'use strict';
... ... @@ -11,10 +11,6 @@ import {
} from 'yoho-mvc';
class Guang {
constructor() {
console.log('guang-model', '------->');
}
/**
* 加载更多
*/
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-04-26 17:15:50
* @Last Modified by: Targaryen
* @Last Modified time: 2017-04-26 17:47:20
* @Last Modified time: 2017-04-27 11:32:13
*/
'use strict';
import {View} from 'yoho-mvc';
... ... @@ -10,7 +10,20 @@ import {View} from 'yoho-mvc';
class NavView extends View {
constructor() {
super('#guang-nav');
console.log('NavView', '------->');
this.list = $('#info-list');
this.on('touchend touchcancel', 'li', this.tabClick.bind(this));
}
tabClick(e) {
let $this = $(e.currentTarget);
// tab status change
console.log($this, '------>');
this.emit('navchange');
}
listChange(html) {
this.list.html(html);
}
}
... ...