main
liudan 2 years ago
parent 3799faeb65
commit ef3334f2e7
  1. 22
      pages/index/category/item.vue
  2. 20
      pages/index/category/one-catgory.vue

@ -15,9 +15,9 @@
<view
class="tab-list u-flex-col u-col-center u-row-center"
:style="{ width: 100 / 4 + '%' }"
v-for="(item, index) in itemList"
:key="index"
@tap="$tools.routerTo(item.path)"
v-for="(item, i) in itemList"
:key="i"
@tap="getjump(item)"
>
<image class="tab-img" :src="item.image"></image>
<text class="">{{ item.name }}</text>
@ -61,6 +61,10 @@ export default {
scroll:{
type: Boolean,
default: true
},
isIndex:{
type:Boolean,
default:true,
}
},
computed: {
@ -74,6 +78,7 @@ export default {
}
// let data = this.$tools.splitData(this.list, this.oneRowNum * 1);
// let data = this.list
console.log(data,"999999")
return data;
}
}
@ -88,6 +93,15 @@ export default {
path: path,
query: query
});
},
getjump(item,index){
console.log(item,index)
// if(this.isIndex){
// this.$tools.routerTo(val)
// }else{
this.$emit("catagory",item)
// }
}
}
};
@ -107,7 +121,7 @@ export default {
}
.menu-tab-box {
.tab-list {
font-size: 26rpx;
font-size: 22rpx;
font-weight: 500;
color: rgba(51, 51, 51, 1);
margin: 20rpx 0;

@ -2,15 +2,16 @@
<view class="content_box">
<view style="display: flex;align-items: center;">
<view style="flex: 1;">
<block v-for="(item, index) in homeTemplate" :key="item.id">
<!-- 滑动宫格 -->
<!-- <block v-for="(item, index) in categoryData" :key="item.id"> -->
<!-- 滑动宫格v-if="item.type === 'menu'" -->
<sh-grid-swiper
v-if="item.type === 'menu'"
:list="item.content.list"
:list="categoryData"
:oneRowNum="4"
:isIndex="false"
@catagory="catagoryClick"
:scroll="scroll"
></sh-grid-swiper>
</block>
<!-- </block> -->
</view>
<view @click="zhankai" :class="scroll?'zhankai':'zhankai active'">
<text>{{scroll?'展':"收"}}</text>
@ -74,7 +75,7 @@ export default {
return {
scroll:true,
listId: 0,
categoryData: {},
categoryData: [],
categoryID: 0, //id
isEmpty: false,
currentPage: 1,
@ -99,6 +100,12 @@ export default {
},
methods: {
catagoryClick(i){
let index = this.categoryData.findIndex(item=>{
return item.name==i.name
})
this.onType(index)
},
zhankai(){
this.scroll=!this.scroll
},
@ -140,6 +147,7 @@ export default {
},
onType(index) {
console.log(index,typeof(index))
this.listId = index;
this.categoryID = this.categoryData[index].id;
this.goodsList = [];

Loading…
Cancel
Save