初始化参股
This commit is contained in:
125
前端/components/before-after/before-after.uvue
Normal file
125
前端/components/before-after/before-after.uvue
Normal file
@@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<view class="before-after">
|
||||
<view class="ba-title" v-if="showTitle">
|
||||
<text class="ba-title-text">翻新前后对比</text>
|
||||
</view>
|
||||
|
||||
<view class="ba-container">
|
||||
<!-- 翻新前 -->
|
||||
<view class="ba-item" @click="previewImage(beforeImage, 'before')">
|
||||
<view class="ba-label before-label">
|
||||
<text class="ba-label-text">翻新前</text>
|
||||
</view>
|
||||
<image
|
||||
class="ba-image"
|
||||
:src="beforeImage"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</view>
|
||||
|
||||
<!-- 箭头 -->
|
||||
<view class="ba-arrow">
|
||||
<text class="ba-arrow-text">→</text>
|
||||
</view>
|
||||
|
||||
<!-- 翻新后 -->
|
||||
<view class="ba-item" @click="previewImage(afterImage, 'after')">
|
||||
<view class="ba-label after-label">
|
||||
<text class="ba-label-text">翻新后</text>
|
||||
</view>
|
||||
<image
|
||||
class="ba-image"
|
||||
:src="afterImage"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
const props = defineProps<{
|
||||
beforeImage : string
|
||||
afterImage : string
|
||||
showTitle ?: boolean
|
||||
}>()
|
||||
|
||||
// 预览图片
|
||||
const previewImage = (url : string, type : string) => {
|
||||
const urls = type == 'before' ? [props.beforeImage] : [props.afterImage]
|
||||
uni.previewImage({
|
||||
current: url,
|
||||
urls: urls
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.before-after {
|
||||
background-color: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
padding: 24rpx;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.ba-title {
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.ba-title-text {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.ba-container {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.ba-item {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ba-image {
|
||||
width: 100%;
|
||||
height: 280rpx;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.ba-label {
|
||||
position: absolute;
|
||||
bottom: 16rpx;
|
||||
left: 16rpx;
|
||||
padding: 8rpx 16rpx;
|
||||
border-radius: 8rpx;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.before-label {
|
||||
background-color: rgba(144, 147, 153, 0.9);
|
||||
}
|
||||
|
||||
.after-label {
|
||||
background-color: rgba(212, 165, 116, 0.9);
|
||||
}
|
||||
|
||||
.ba-label-text {
|
||||
font-size: 22rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.ba-arrow {
|
||||
padding: 0 16rpx;
|
||||
}
|
||||
|
||||
.ba-arrow-text {
|
||||
font-size: 40rpx;
|
||||
color: #D4A574;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user