Authored by 郭成尧

nav-change

@@ -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-27 11:29:34 5 + * @Last Modified time: 2017-04-27 14:48:55
6 */ 6 */
7 'use strict'; 7 'use strict';
8 8
@@ -22,9 +22,7 @@ class IndexController extends Controller { @@ -22,9 +22,7 @@ class IndexController extends Controller {
22 this.navView.on('navchange', this.fetchList.bind(this)); 22 this.navView.on('navchange', this.fetchList.bind(this));
23 } 23 }
24 24
25 - fetchList(e) {  
26 - let type = $(e).data('type');  
27 - 25 + fetchList(e, type) {
28 this.guangModel.loadMore({ 26 this.guangModel.loadMore({
29 type: type 27 type: type
30 }).then(result => { 28 }).then(result => {
@@ -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-27 11:32:13 5 + * @Last Modified time: 2017-04-27 14:49:21
6 */ 6 */
7 'use strict'; 7 'use strict';
8 import {View} from 'yoho-mvc'; 8 import {View} from 'yoho-mvc';
@@ -11,15 +11,17 @@ class NavView extends View { @@ -11,15 +11,17 @@ class NavView extends View {
11 constructor() { 11 constructor() {
12 super('#guang-nav'); 12 super('#guang-nav');
13 this.list = $('#info-list'); 13 this.list = $('#info-list');
  14 + this.navItem = $('.guang-nav-item');
14 this.on('touchend touchcancel', 'li', this.tabClick.bind(this)); 15 this.on('touchend touchcancel', 'li', this.tabClick.bind(this));
15 } 16 }
16 17
17 tabClick(e) { 18 tabClick(e) {
18 let $this = $(e.currentTarget); 19 let $this = $(e.currentTarget);
19 20
20 - // tab status change  
21 - console.log($this, '------>');  
22 - this.emit('navchange'); 21 + this.navItem.removeClass('focus');
  22 + $this.addClass('focus');
  23 +
  24 + this.emit('navchange', $this.data('type'));
23 } 25 }
24 26
25 listChange(html) { 27 listChange(html) {