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.
114 lines
2.3 KiB
114 lines
2.3 KiB
<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 articleList" :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">{{item.title}}</view> |
|
<view class="content acea-row"> |
|
<view>{{item.author}}</view> |
|
<view>{{item.createTime}}</view> |
|
<view class="acea-row row-middle"> |
|
<text>{{item.visit}}</text> |
|
<image src="../static/images/eye.png" class="eye"></image> |
|
</view> |
|
</view> |
|
</view> |
|
</view> |
|
</swiper-item> |
|
</block> |
|
</swiper> |
|
</template> |
|
|
|
<script> |
|
export default{ |
|
props: { |
|
articleList: { |
|
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; |
|
} |
|
.eye{ |
|
width: 24rpx; |
|
height: 24rpx; |
|
} |
|
</style>
|
|
|