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.

108 lines
2.1 KiB

3 years ago
<template>
<swiper class="swiper-block" vertical="true" circular="true" previous-margin="90rpx" next-margin="90rpx" current="0" @change="swiperChange">
<block v-for="(item, index) in imgs" :key="index">
<swiper-item class="swiper-item" :class="(swiperIndex == index ? 'active' : '')" @tap="previewImg">
<view class="item-box" :class="(swiperIndex == index ? 'active' : '')" @click="toDetial(item.id)">
<image mode="aspectFill" :src="item.imageInput" class="slide-image"></image>
<view class="content-box">
<view class="title-box">标题标题标题标题标题</view>
<view class="content acea-row">
<view>云快讯</view>
<view>3小时钱</view>
<view>300阅读</view>
</view>
</view>
</view>
</swiper-item>
</block>
</swiper>
</template>
<script>
export default{
props: {
imgs: {
type: Array,
default: []
}
},
data(){
return {
swiperIndex: 0
}
},
methods: {
swiperChange(e) {
const that = this;
that.setData({
swiperIndex: e.detail.current
});
},
toDetial(id){
uni.navigateTo({
url: '/pages/life/articleDetail/index?id='+id
})
},
previewImg() {
uni.previewImage({
urls: this.imgs
});
}
}
}
</script>
<style lang="less">
.swiper-block {
width: 670rpx;
height: 300rpx;
margin: 0 auto;
}
.swiper-item {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
overflow: unset;
}
.item-box{
width: 622rpx;
height: 200rpx;
position: relative;
border-radius: 20rpx;
}
.slide-image {
width: 100%;
height: 100%;
z-index: 1;
border-radius: 20rpx;
}
.content-box{
position: absolute;
bottom: 20rpx;
left: 20rpx;
color: #0081FF;
z-index: 5;
}
.title-box{
font-size: 32rpx;
font-weight: 500;
color: #fff;
margin-bottom: 10rpx;
}
.content{
color: #fff;
font-size: 26rpx;
}
.content view{
margin-right: 50rpx;
}
.active {
transform: scale(1.02);
transition: all 0.2s ease-in 0s;
border-radius: 20rpx;
z-index: 20;
}
</style>