商品分类选中优化

master
gongfuxiang 2023-10-20 14:16:03 +08:00
parent 0a53c17e00
commit 6981cb2048
1 changed files with 16 additions and 10 deletions

View File

@ -406,7 +406,8 @@
data_list_loding_status: 1,
data_list_loding_msg: '',
data_is_loading: 0,
user: null,
user: null,
params: null,
tabbar_params: null,
common_site_type: 0,
category_list: [],
@ -460,7 +461,13 @@
componentUserBase,
componentNavMore,
},
props: {},
props: {},
onLoad(params) {
this.setData({
params: params
});
},
onShow() {
//
@ -532,17 +539,16 @@
uni.stopPullDownRefresh();
if (res.data.code == 0) {
var data = res.data.data;
var index = this.nav_active_index;
var active_index = this.nav_active_index;
var temp_category = data.category || [];
//
var category_one_subset_count = 0;
//
var tabbar_params = this.tabbar_params;
if (temp_category.length > 0) {
for (var i in temp_category) {
//
if ((tabbar_params || null) != null && (tabbar_params.id || null) != null && temp_category[i]['id'] == tabbar_params.id) {
index = i;
// tab访
if (((this.tabbar_params || null) != null && (this.tabbar_params.id || null) != null && temp_category[i]['id'] == this.tabbar_params.id) || ((this.params || null) != null && (this.params.id || null) != null && temp_category[i]['id'] == this.params.id)) {
active_index = i;
break;
}
//
@ -554,13 +560,13 @@
//
var upd_data = {
category_list: temp_category,
data_content: temp_category[index] || null,
nav_active_index: index,
data_content: temp_category[active_index] || null,
nav_active_index: active_index,
category_one_subset_count: category_one_subset_count,
plugins_label_data: (data.plugins_label_data || null) == null || (data.plugins_label_data.base || null) == null || (data.plugins_label_data.data || null) == null || data.plugins_label_data.data.length <= 0 ? null : data.plugins_label_data,
};
//
if (tabbar_params != null && this.nav_active_index != index) {
if (this.nav_active_index != active_index) {
upd_data['is_first'] = 1;
upd_data['data_page'] = 1;
upd_data['data_list'] = [];