deming/components/shop/group/index.vue

80 lines
1.9 KiB
Vue
Raw Normal View History

2020-06-11 16:12:04 +08:00
<template>
<view class="group">
<view class="top">
<text>全部拼团</text>
<text>查看更多></text>
</view>
<view class="label">
2020-07-20 17:17:41 +08:00
<u-tabs-swiper ref="group" :list="classifyList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="current" font-size="24" :show-bar="false" @change="tabsChange" height="88" ></u-tabs-swiper>
2020-06-11 16:12:04 +08:00
</view>
2020-07-20 17:17:41 +08:00
<swiper :current="swiperCurrent" @animationfinish="animationfinish" style="height: 130px">
<swiper-item class="swiper-item" v-for="(_, i) in classifyList" :key="i">
<!-- 最多显示3个 -->
<sitem :info="info" v-for="(info, index) in groupList.slice(0, 3)" :key="index"></sitem>
<u-empty text="暂无拼团商品" mode="list" color="#000" v-if="!groupList.length"></u-empty>
</swiper-item>
</swiper>
2020-06-11 16:12:04 +08:00
</view>
</template>
<script>
import sitem from "./item"
export default {
name:"group",
components:{
sitem
2020-07-20 17:17:41 +08:00
},
props: {
groupList: Array,
classifyList: Array,
},
2020-06-11 16:12:04 +08:00
data(){
return {
2020-07-20 17:17:41 +08:00
current: 0,
swiperCurrent: 0,
2020-06-11 16:12:04 +08:00
}
2020-07-20 17:17:41 +08:00
},
methods: {
tabsChange(index) {
this.swiperCurrent = index;
},
animationfinish(e) {
let current = e.detail.current;
this.swiperCurrent = current;
this.current = current;
},
}
2020-06-11 16:12:04 +08:00
}
</script>
<style lang="scss" scoped>
.group{
.top{
height: 90rpx;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
>text:first-child{
font-size: 30rpx;
color: #333;
}
>text:last-child{
font-size: 18rpx;
color: #999;
}
}
.label{
display: flex;
font-size: 24rpx;
color: #999;
>text{
margin-right: 34rpx;
}
}
.list{
display: flex;
justify-content: space-between;
margin-top: 21rpx;
}
}
</style>