项目初始化
This commit is contained in:
225
pages/im/components/cardSwiper.vue
Normal file
225
pages/im/components/cardSwiper.vue
Normal file
@@ -0,0 +1,225 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-swiper-dot class="uni-swiper-dot-box" @clickItem=clickItem :info="info" :current="current" :mode="mode" :dots-styles="dotsStyles" field="content">
|
||||
<swiper class="swiper-box" @change="change" :current="swiperDotIndex">
|
||||
<swiper-item v-for="(item, index) in 3" :key="index">
|
||||
<view class="swiper-item">
|
||||
<view class="card">
|
||||
<image class="logo" src="http://rbtnet.oss-cn-hangzhou.aliyuncs.com/test/20240726/98a24075202b429d9c9722df541621c6.jpg"></image>
|
||||
<view class="content-box">
|
||||
<view class="left-box">
|
||||
<view class="title">15开黑卡/局</view>
|
||||
<view class="text-gray">LOL手游</view>
|
||||
<view class="text-gray">下单前聊一聊</view>
|
||||
</view>
|
||||
<view class="btn">找TA开黑</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</uni-swiper-dot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
info: [{
|
||||
colorClass: 'uni-bg-red',
|
||||
url: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao.jpg',
|
||||
content: '内容 A'
|
||||
},
|
||||
{
|
||||
colorClass: 'uni-bg-green',
|
||||
url: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao.jpg',
|
||||
content: '内容 B'
|
||||
},
|
||||
{
|
||||
colorClass: 'uni-bg-blue',
|
||||
url: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao.jpg',
|
||||
content: '内容 C'
|
||||
}
|
||||
],
|
||||
dotStyle: [{
|
||||
backgroundColor: '#00c8b0',
|
||||
border: '1px rgba(0, 0, 0, .3) solid',
|
||||
color: '#fff',
|
||||
selectedBackgroundColor: 'rgba(0, 0, 0, .9)',
|
||||
selectedBorder: '1px rgba(0, 0, 0, .9) solid'
|
||||
},
|
||||
{
|
||||
backgroundColor: 'rgba(255, 90, 95,0.3)',
|
||||
border: '1px rgba(255, 90, 95,0.3) solid',
|
||||
color: '#fff',
|
||||
selectedBackgroundColor: 'rgba(255, 90, 95,0.9)',
|
||||
selectedBorder: '1px rgba(255, 90, 95,0.9) solid'
|
||||
},
|
||||
{
|
||||
backgroundColor: 'rgba(83, 200, 249,0.3)',
|
||||
border: '1px rgba(83, 200, 249,0.3) solid',
|
||||
color: '#fff',
|
||||
selectedBackgroundColor: 'rgba(83, 200, 249,0.9)',
|
||||
selectedBorder: '1px rgba(83, 200, 249,0.9) solid'
|
||||
}
|
||||
],
|
||||
modeIndex: -1,
|
||||
styleIndex: -1,
|
||||
current: 0,
|
||||
mode: 'default',
|
||||
dotsStyles: {
|
||||
selectedBackgroundColor: '#00c8b0',
|
||||
},
|
||||
swiperDotIndex: 0,
|
||||
current: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
change(e) {
|
||||
this.current = e.detail.current
|
||||
},
|
||||
selectStyle(index) {
|
||||
this.dotsStyles = this.dotStyle[index]
|
||||
this.styleIndex = index
|
||||
},
|
||||
selectMode(mode, index) {
|
||||
this.mode = mode
|
||||
this.modeIndex = index
|
||||
this.styleIndex = -1
|
||||
this.dotsStyles = this.dotStyle[0]
|
||||
},
|
||||
clickItem(e) {
|
||||
this.swiperDotIndex = e
|
||||
},
|
||||
onBanner(index) {
|
||||
console.log(22222, index);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.swiper-box {
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
.swiper-item {
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 750rpx;
|
||||
}
|
||||
|
||||
/* #ifndef APP-NVUE */
|
||||
::v-deep .image img {
|
||||
-webkit-user-drag: none;
|
||||
-khtml-user-drag: none;
|
||||
-moz-user-drag: none;
|
||||
-o-user-drag: none;
|
||||
user-drag: none;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
.uni-bg-red {
|
||||
background-color: #ff5a5f;
|
||||
}
|
||||
|
||||
.uni-bg-green {
|
||||
background-color: #09bb07;
|
||||
}
|
||||
|
||||
.uni-bg-blue {
|
||||
background-color: #007aff;
|
||||
}
|
||||
|
||||
.example-body {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.example-body-item {
|
||||
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 15rpx;
|
||||
padding: 15rpx;
|
||||
height: 60rpx;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
padding: 0 15rpx;
|
||||
/* #endif */
|
||||
flex: 1;
|
||||
border-color: #e5e5e5;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.example-body-item-text {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.example-body-dots {
|
||||
width: 16rpx;
|
||||
height: 16rpx;
|
||||
border-radius: 50px;
|
||||
background-color: #333333;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.active {
|
||||
border-style: solid;
|
||||
border-color: #007aff;
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
|
||||
.card {
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 80px;
|
||||
padding: 10px;
|
||||
|
||||
.logo {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 100%;;
|
||||
}
|
||||
|
||||
.content-box {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-left: 10px;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.text-gray {
|
||||
font-size: 24rpx;
|
||||
color: #aaaaaa;
|
||||
margin: 3px 0;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background-color: #00c8b0;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
border-radius: 45px;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user