Authored by 李靖

优化选择框

... ... @@ -62,6 +62,7 @@ let nav;
let popularity = false;
let $dropList = $('.drop-list');
let $firstText = $('.first-li-more').find('.nav-txt');
let $thisLi = '';
// 物料商品列表标记
if ($('#material-flag').val() === 'material') {
... ... @@ -213,8 +214,8 @@ $listNav.bind('contextmenu', function() {
return false;
});
const popularityFilter = function($thisLi, type) {
if ($thisLi.hasClass('active')) {
const popularityFilter = function(thisLi, type) {
if (thisLi.hasClass('active')) {
$dropList.hide();
return false;
}
... ... @@ -239,14 +240,14 @@ $listNav.on('touchend touchcancel', function(e) {
$this.addClass('active');
$dropList.toggle();
$dropList.find('.default').on('touchend touchcancel', function() {
let $thisLi = $(this);
$thisLi = $(this);
$firstText.html('默认');
popularityFilter($thisLi, 'default');
return false;
});
$dropList.find('.popularity').on('touchend touchcancel', function() {
let $thisLi = $(this);
$thisLi = $(this);
$firstText.html('人气');
popularityFilter($thisLi, 'popularity');
... ... @@ -269,6 +270,7 @@ $listNav.on('touchend touchcancel', function(e) {
filter.showFilter();
}
$dropList.hide().find('li').removeClass('active');
} else { // 排序改变
if ($this.hasClass('new')) {
... ... @@ -318,6 +320,7 @@ $listNav.on('touchend touchcancel', function(e) {
/* 排序条件更新 */
defaultOpt.type = navType;
Object.assign(defaultOpt, nav);
$dropList.hide().find('li').removeClass('active');
getGoodsList();
}
... ...