uniapp自定义下拉选项组件

效果图

 

 字体默认颜色为黑色,未选中右边图片不显示,选中,当前选中这一行字体变蓝色,当前选中这一行右边图片显示

代码 默认styleShow=false

	<view @tap="study" class="filterText" :class="studyShow ? 'active' : ''">
						{{ learnStyle || '学习方式' }}
						<u-icon name="arrow-down-fill" color="#3E3E3E" size="13"></u-icon>
					</view>




列表
<view class="styleBox"  :class="styleShow?'content-open':'content-close'">
						<view class="box" v-for="(item, index) in studyList" :key="index" @tap="studyWay(item,index)">
							<view class="titleArea">
								<view class="leftText" :class="studyID==index?'active':''">{{ item.name }}</view>
								<view class="rightText1" :class="studyID==index?'show':'rightText1'"><u-icon name="checkbox-mark" color="#006df7" ></u-icon></view>
							</view>
						</view>
					</view>
---------------我是无情的分隔线---------------
//JS部分
//将列表隐藏并调数据
studyWay(data,index) {
			//this.learnStyle = data.name;
			this.styleShow = false;
			//this.studyShow = true;
			//this.screenFrom.method = data.id;
			this.studyID=index;
			//console.log(index,"jiooo,mS")
			//this.pageStart = 1;
			//this.list = [];
			//uni.showLoading({
			//	title:"loading"
			//});
			//this.getList();
		},
-------------------------------------------------
//样式部分
.styleBox {
				position: absolute;
				width: 100%;
				top: 65rpx;
				overflow: hidden;
				overflow-y: scroll;
				height: 400rpx;
				background-color: #ffffff;
				z-index: 999;
					box-shadow: 0rpx 0rpx 15rpx 0rpx #dde4ed ;
				.box {
					padding: 0 30rpx;
					.titleArea {
						display: flex;
						align-items: center;
						justify-content: space-between;
						border-bottom: 1rpx solid #bbbbbb;
						padding: 32rpx 0 24rpx 0;
					.leftText{
						font-size: 32rpx;
						font-weight: 400;
						color: #191919;
					}
					.active{
						color:#006df7;
					}
					.rightText{
						font-size: 20rpx;
						font-weight: 400;
						color: #bbbbbb;
					}
					.rightText1{
						font-size:25rpx;
						font-weight: 400;
						color: #bbbbbb;
						display: none;
					}
					.show{
						display: block;
					}
					}
				}
			}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值