当前位置:   article > 正文

uniapp——列表选择样式_uniapp 应用列表样式

uniapp 应用列表样式

案例

在这里插入图片描述

代码

<view class="list">
	<block v-for="(item,index) in 8" :key="index">
		<view class="item" @click="choosePackage(item)" :class="{'active':item == current}">
			<view class="i_money">
				<text class="i_num">2</text></view>
			<view class="i_txt">套餐</view>
		</view>
	</block>
</view>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
export default {
	components: {},
	data() {
		return {
			current: 0,
		};
	},
	watch: {

	},
	onLoad() {

	},
	onShow() {

	},
	methods: {
		choosePackage(item) {
			console.log(item);
			this.current = item
		}
	}
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
.list {
	margin-top: 44rpx;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-gap: 16px 14px; //行间距 列间距
	
	.item {
		background: #FFFFFF;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		border: 1rpx solid #BCBCBC;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		padding: 20rpx 0;
	
		.i_money {
			font-weight: bold;
			font-size: 22rpx;
			color: #292929;
	
			.i_num {
				font-size: 30rpx;
			}
		}
	
		.i_txt {
			font-size: 22rpx;
			color: #292929;
			margin-top: 5rpx;
		}
	}
	
	.active {
		background: #FFFDFA;
		border: 1rpx solid #FE8300;
		position: relative;
	}
	
	.active::before {
		content: '';
		position: absolute;
		right: 5rpx;
		top: 6rpx;
		width: 12rpx;
		height: 9rpx;
		border-right: 2rpx solid #FFFFFF;
		border-top: 2rpx solid #FFFFFF;
		transform: rotate(135deg);
		z-index: 2;
	}
	
	.active::after {
		content: '';
		position: absolute;
		right: 0;
		top: 0;
		border-radius: 0 6rpx 0 10rpx;
		width: 26rpx;
		height: 26rpx;
		background-color: #FE8300;
	}
	}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/一键难忘520/article/detail/1015663
推荐阅读
相关标签
  

闽ICP备14008679号