初始化仓库
This commit is contained in:
57
components/cate-one/cate-one.vue
Normal file
57
components/cate-one/cate-one.vue
Normal file
@ -0,0 +1,57 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user