Authored by 郭成尧

listview-name-change

<div class="guang-detail-page guang-page yoho-page {{#if guangDetail}}guang-detail{{/if}} {{#if guangEzine}}guang-ezine{{/if}}">
<div class="guang-detail-page guang-page yoho-page {{#if guangDetail}}guang-detail{{/if}} {{#if guangEzine}}guang-ezine{{/if}}" id="guangDetail">
{{# guang}}
<div id="wrapper" >
<div id="scroller" class="{{channel}}">
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-04-26 17:19:19
* @Last Modified by: Targaryen
* @Last Modified time: 2017-05-02 13:51:31
* @Last Modified time: 2017-05-02 14:40:52
*/
'use strict';
... ... @@ -10,7 +10,7 @@ const lazyLoad = require('yoho-jquery-lazyload');
import {Controller} from 'yoho-mvc';
import {
NavView
ListView
} from './view';
import {
Guang
... ... @@ -22,14 +22,14 @@ class IndexController extends Controller {
lazyLoad($('img.lazy'));
this.navView = new NavView();
this.listView = new ListView();
this.guangModel = new Guang();
this.page = 1;
this.onLoading = false;
this.navView.on('tabchange', this.tabChange.bind(this));
this.navView.on('loadmore', this.loadMore.bind(this));
this.listView.on('tabchange', this.tabChange.bind(this));
this.listView.on('loadmore', this.loadMore.bind(this));
}
/**
... ... @@ -47,7 +47,7 @@ class IndexController extends Controller {
let $result = $(result);
lazyLoad($result.find('img.lazy'));
this.navView.listChange($result);
this.listView.listChange($result);
});
}
... ... @@ -64,14 +64,14 @@ class IndexController extends Controller {
let noResult = !result || result.length < 1 || (result.list && result.list.length < 1);
if (noResult) {
this.navView.listAppend('<div class="search-divide">没有更多内容了...</div>');
this.listView.listAppend('<div class="search-divide">没有更多内容了...</div>');
return false;
}
let $result = $(result);
lazyLoad($result.find('img.lazy'));
this.navView.listAppend($result);
this.listView.listAppend($result);
this.onLoading = false;
});
... ...
... ... @@ -2,17 +2,18 @@
* @Author: Targaryen
* @Date: 2017-04-26 17:15:50
* @Last Modified by: Targaryen
* @Last Modified time: 2017-05-02 13:44:16
* @Last Modified time: 2017-05-02 14:43:23
*/
'use strict';
import {View} from 'yoho-mvc';
class NavView extends View {
class ListView extends View {
constructor() {
super('#guang-nav');
super('#guangList');
this.list = $('#info-list');
this.navItem = $('.guang-nav-item');
this.nav = this.$base.find('#guang-nav');
this.navItem = this.nav.find('.guang-nav-item');
this.beforeScroll = document.body.scrollTop; // 滚动前位置记录
... ... @@ -59,7 +60,7 @@ class NavView extends View {
* 获取默认 Type
*/
getType() {
return this.$base.find('li.focus').data('type');
return this.navItem.find('li.focus').data('type');
}
/**
... ... @@ -91,5 +92,5 @@ class NavView extends View {
}
module.exports = {
NavView
ListView
};
... ...