<view class="swiper-item">
<cc-image group="home-ad" :src="item.image" mode="widthFix"></cc-image>
</view>
</swiper-item>
</swiper>
</uni-swiper-dot>
</template>
<script>
import ajax from "@/utils/ajax.js";
import jut from "@/utils/jut.js";
export default {
name: "home-main-carousel",
data() {
return {
interval: 3000,
duration: 500,
list: [],
current: 0
};
},
mounted() {
this.load();
},
methods: {
load() {
ajax('/ad/carousel/of-home').cache().get(list => this.list = list);
},
change(e) {
this.current = e.detail.current;
},
open(item) {
let data = {};
if (item.data) {
data = JSON.parse(item.data)
} else {
return;
}
let url;
let param;
if (data.open.indexOf("?") == -1) {
url = data.open;
param = {};
} else {
param = jut.search(data.open);
url = data.open.substr(0, data.open.indexOf("?"));
}
this.$Router.push({
path: url,
query: param,
});
}
}
}
</script>
<style lang="scss">
.page-11,
.box-swiper,
.swiper-item{
width: 100vw;
height: 318.75rpx;
}
</style>
5 个回复
YJG - YJG
可以看一下微信小程序swiper的文档
swiper的change的参数可以打印一下,
let source = e.detail.source
卡顿的时候 source是空的,刷新当前index的时候判断一下触发的类型可以
let source = e.detail.source
if (source == 'autoplay' || source == 'touch') {
this.currentIndex = e.detail.current
}
梦尋Junjie (作者) - 原来她有男朋友
视频地址 https://v.youku.com/v_show/id_XNTE3MDk3MTM3Ng==.html?spm=a2hbt.13141534.0.13141534
密码:bug
梦尋Junjie (作者) - 原来她有男朋友
会飞的deram
解决了吗?
会飞的deram
我也遇到这个问题