Files
2026-04-14 16:54:04 +08:00

58 lines
1.0 KiB
Vue

<template>
<view class="cate-one">
<tabs @change="changeActive" v-if="cateList.length" :current="selectIndex">
<tab :name="item.name" v-for="(item, index) in cateList" :key="index">
<cate-list v-if="showCate[index]" :top="174" ref="mescrollItem" :i="index" :index="selectIndex" :cate="item">
</cate-list>
</tab>
</tabs>
</view>
</template>
<script>
export default {
name:"cate-one",
props: {
cateList: {
type: Array,
default: () => ([])
},
selecttab:{
type:Number,
default:()=>(0)
}
},
data() {
return {
selectIndex: 0,
showCate: []
};
},
methods:{
changeActive(index) {
this.selectIndex = index
this.showCate[index] = true
},
},
watch: {
selecttab(val){
if(val!=0){
setTimeout(()=>{
this.changeActive(val)
},20)
}
},
cateList(val) {
this.showCate = val.map((item, index) => index == this.selectIndex ? true : false)
console.log(this.showCate)
},
}
}
</script>
<style>
</style>