You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

62 lines
1.2 KiB

<template>
<view>
<view class="index-background">
<my-search @click="searchInfo"></my-search>
</view>
<!-- 轮播图 -->
<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" :circular="true">
<swiper-item v-for="(item, i) in swiperList" :key="i">
<!-- <view class="swiper-item">
<image :src="item.image_src"></image>
</view> -->
<navigator class="swiper-item" :url="'/subpackage/detail/detail?goods_id='+item.goods_id">
<image :src="item.image_src"></image>
</navigator>
</swiper-item>
</swiper>
</view>
</template>
<script>
export default {
data() {
return {
//轮播图数据列表
swiperList: [],
};
},
onLoad() {
this.getSwiperList()
},
methods: {
async getSwiperList() {
const {
data: res
} = await uni.$http.get('/api/public/v1/home/swiperdata')
if (res.meta.status !== 200) return uni.$showMsg()
this.swiperList = res.message
uni.$showMsg('数据请求成功!')
},
}
}
</script>
<style lang="scss">
.search-box{
position: sticky;
top: 0;
z-index: 9999;
}
swiper {
height: 330rpx;
.swiper-item,
image {
width: 100%;
height: 100%;
}
}
</style>