Commit d050f146 吴良建

适配微信小程序

1 个父辈 5c97f905
<template> <template>
<view> <view>
<v-tabs class="tab_c" v-model="current" :tabs="tabs" @change="changeTab" <v-tabs class="tab_c" v-model="current" :tabs="tabs" @change="changeTab" fixed="true"
line-height="8rpx" line-color="#04764E" line-height="8rpx" line-color="#04764E"
color="#AAAAAA" activeColor="#04764E" height="88rpx"></v-tabs> color="#AAAAAA" activeColor="#04764E" height="88rpx"></v-tabs>
<view style="height: 100rpx; width: 100%;">
<text>站位组件</text>
</view>
<z-swiper ref="zSwiper" v-model="tabs" @slideChange="onSwiperChange" <z-swiper ref="zSwiper" v-model="tabs" @slideChange="onSwiperChange"
:options="options"> :options="options">
...@@ -18,8 +14,10 @@ ...@@ -18,8 +14,10 @@
<MatchList :data_info="match_map.get(item)" ref="MatchListRef" :key="index" @updateItem ="updateItem"></MatchList> <MatchList :data_info="match_map.get(item)" ref="MatchListRef" :key="index" @updateItem ="updateItem"></MatchList>
</view> </view>
<view style="width: 100vw; height: 80vh; align-items: center; display: flex; justify-content: center;" <view style="width: 100vw; height: 80vh; align-items: center; display: flex; justify-content: center;"
v-else> v-else>
<text>暂无比赛</text>
<image style="height: 460rpx; width: 460rpx;" src="../../static/pic_zanwushuju@2x.png"></image>
</view> </view>
</z-swiper-item> </z-swiper-item>
...@@ -120,8 +118,7 @@ ...@@ -120,8 +118,7 @@
this.match_map.set("重要", zhongyao) this.match_map.set("重要", zhongyao)
this.match_map.set("完赛", wancheng) this.match_map.set("完赛", wancheng)
for (let m of matchs) { for (let m of matchs) {
if (m.GameName) { if (m.GameName) {
var list = this.match_map.get(m.GameName) var list = this.match_map.get(m.GameName)
...@@ -191,7 +188,7 @@ ...@@ -191,7 +188,7 @@
} }
}, },
onSwiperChange(swiper) { onSwiperChange(swiper) {
this.current = swiper.activeIndex this.current = this.$refs.zSwiper.swiper.activeIndex
console.log("---》" + this.tabs[this.current] +"--"+ this.match_map.get(this.tabs[this.current])) console.log("---》" + this.tabs[this.current] +"--"+ this.match_map.get(this.tabs[this.current]))
console.log('onSwiperChange:' + swiper.activeIndex) console.log('onSwiperChange:' + swiper.activeIndex)
var ref = this.$refs.MatchListRef[this.current] var ref = this.$refs.MatchListRef[this.current]
...@@ -241,7 +238,7 @@ ...@@ -241,7 +238,7 @@
} }
.tab_c { .tab_c {
position: fixed; /* position: fixed; */
z-index: 4; z-index: 4;
} }
</style> </style>
...@@ -50,7 +50,9 @@ ...@@ -50,7 +50,9 @@
</view> </view>
<view v-else <view v-else
style="width: 100%; height: 400px; display: flex; justify-content: center; align-items: center;"> style="width: 100%; height: 400px; display: flex;
justify-content: center; align-items: center;">
<text style="color: #999999; font-size: 16px;">暂无情报</text> <text style="color: #999999; font-size: 16px;">暂无情报</text>
</view> </view>
...@@ -86,11 +88,11 @@ ...@@ -86,11 +88,11 @@
}, },
methods: { methods: {
onSwiperChange(swiper) { onSwiperChange(swiper) {
this.select_index = swiper.activeIndex this.select_index = this.$refs.zSwiper.swiper.activeIndex
this.$refs.zSwiperInfo.swiper.slideTo(this.select_index); //切换到第一个slide,速度为1秒 this.$refs.zSwiperInfo.swiper.slideTo(this.select_index); //切换到第一个slide,速度为1秒
}, },
onSwiperInfoChange(swiper) { onSwiperInfoChange(swiper) {
this.select_index = swiper.activeIndex this.select_index = this.$refs.zSwiperInfo.swiper.activeIndex
this.$refs.zSwiper.swiper.slideTo(this.select_index); //切换到第一个slide,速度为1秒 this.$refs.zSwiper.swiper.slideTo(this.select_index); //切换到第一个slide,速度为1秒
}, },
deal_match_time(match) { deal_match_time(match) {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<text style="font-size: 36rpx; color: #333333; font-weight: 600;"> <text style="font-size: 36rpx; color: #333333; font-weight: 600;">
{{ this.hasLogin ? this.userName : '登陆/注册' }}</text> {{ this.hasLogin ? this.userName : '登陆/注册' }}</text>
<view style="margin-top: 15rpx;"> <view style="margin-top: 15rpx;">
<text style="font-size: 26rpx; color: #999999;">欢迎来到千嗨体育</text> <text style="font-size: 26rpx; color: #999999;">欢迎来到金球体育</text>
</view> </view>
</view> </view>
......
...@@ -68,13 +68,14 @@ ...@@ -68,13 +68,14 @@
} }
}, },
methods: { methods: {
onSwiperChange(swiper) { onSwiperChange(swiper) {
this.select_index = swiper.activeIndex console.log(swiper)
this.select_index = this.$refs.zSwiper.swiper.activeIndex
this.$refs.child[this.select_index].childmethods(this.match_list[this.select_index]) //子组件$on中的名字 this.$refs.child[this.select_index].childmethods(this.match_list[this.select_index]) //子组件$on中的名字
this.$refs.zSwiperInfo.swiper.slideTo(this.select_index); //切换到第一个slide,速度为1秒 this.$refs.zSwiperInfo.swiper.slideTo(this.select_index); //切换到第一个slide,速度为1秒
}, },
onSwiperInfoChange(swiper) { onSwiperInfoChange(swiper) {
this.select_index = swiper.activeIndex this.select_index = this.$refs.zSwiperInfo.swiper.activeIndex
this.$refs.child[this.select_index].childmethods(this.match_list[this.select_index]) //子组件$on中的名字 this.$refs.child[this.select_index].childmethods(this.match_list[this.select_index]) //子组件$on中的名字
this.$refs.zSwiper.swiper.slideTo(this.select_index); //切换到第一个slide,速度为1秒 this.$refs.zSwiper.swiper.slideTo(this.select_index); //切换到第一个slide,速度为1秒
}, },
...@@ -137,7 +138,8 @@ ...@@ -137,7 +138,8 @@
if (this.match_list.length > 0) { if (this.match_list.length > 0) {
this.select_index = 0 this.select_index = 0
} }
console.log("==========>>>", JSON.stringify(this.match_list)) console.log("==========>>>", JSON.stringify(this.match_list))
this.$refs.zSwiper.swiper
} }
} }
</script> </script>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!