style : 优化商城首页左侧菜单栏的选中样式

This commit is contained in:
赵毅 2025-07-18 10:41:08 +08:00
parent dfbfb0440e
commit f8c37680a4
2 changed files with 15 additions and 3 deletions

View File

@ -132,6 +132,10 @@ page {
padding: 35rpx 0; padding: 35rpx 0;
} }
.CateItem_active {
background-color: #ffffff;
}
.CateItem .hot { .CateItem .hot {
width: 25.82rpx; width: 25.82rpx;
height: 30rpx; height: 30rpx;

View File

@ -90,7 +90,7 @@
<div class="Con"> <div class="Con">
<div class="Con_left"> <div class="Con_left">
<div <div
class="CateItem" class="CateItem" :class="item.id === currentLeftCateId ? 'CateItem_active' : ''"
v-for="item in leftCateList" v-for="item in leftCateList"
:key="item.id" :key="item.id"
@click="changeLeftCate(item.id)" @click="changeLeftCate(item.id)"
@ -356,6 +356,7 @@ export default {
], ],
rightTopActive: 0, rightTopActive: 0,
currentLeftCateId: null,
topShow: false, topShow: false,
GGshow: false, GGshow: false,
@ -416,8 +417,14 @@ export default {
console.log(res); console.log(res);
this.CateList = res.commodity_category_list; this.CateList = res.commodity_category_list;
this.firstId = res.commodity_category_list[0].id; this.firstId = res.commodity_category_list[0].id;
this.leftCateList = res.commodity_category_list[0].level_two_category; this.leftCateList = res.commodity_category_list[0].level_two_category || [];
this.secondId = res.commodity_category_list[0].level_two_category[0].id; if (this.leftCateList.length > 0) {
this.currentLeftCateId = this.leftCateList[0].id;
this.secondId = this.leftCateList[0].id;
} else {
this.currentLeftCateId = null;
this.secondId = null;
}
this.getGoodsList(); this.getGoodsList();
}); });
}, },
@ -448,6 +455,7 @@ export default {
}, },
changeLeftCate(e) { changeLeftCate(e) {
this.currentLeftCateId = e;
this.secondId = e; this.secondId = e;
this.getGoodsList(); this.getGoodsList();
}, },