Files
2026-10-08 18:36:23 +08:00

66 lines
1.2 KiB
Vue

<template>
<view class="component" v-if="list.length">
<view :style="{padding: padding, height : height}">
<swiper class="swiper-box" :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000">
<swiper-item v-for="(item, index) in list" :key="index">
<view class="swiper-item">
<image class="full" :src="item.swiper" mode="" @click="onClick(item)"></image>
</view>
</swiper-item>
</swiper>
</view>
</view>
</template>
<script>
export default {
props: {
ad: {
type: Number,
default: () => {
return 0
}
},
padding: {
type: String,
default: '10rpx 30rpx'
},
height: {
type: String,
default: '115rpx'
},
},
data() {
return {
list: []
}
},
methods: {
async getAd() {
const res = await vk.callFunction({
url: 'client/ad/pub/getList',
data: {
adKey: this.ad
}
})
if (res.data) this.list = res.data
},
onClick(item){
vk.navigateTo(`/pages/yellow/detail?id=${item.companyId}`)
}
},
mounted() {
this.getAd()
},
}
</script>
<style lang="scss">
.swiper-box, .swiper-item {
width: 100%;
height: 100%;
}
</style>