Authored by 郭成尧

fetch-data

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