当前位置: 首页 > article >正文

uniapp使用uni-popup做底部弹出选项(vue3)

效果图
在这里插入图片描述

页面代码

<!-- 发票筛选弹出框 -->
		<uni-popup ref="popupRef" type="bottom" border-radius="10px 10px 0 0" background-color="#fff">
			<h4 style="text-align: center;margin-bottom: 20px;">发票筛选</h4>
			<h4>发票状态</h4>
			<view class="choose-item">
				<p @click="activeBtn('status',1)" :class="[invoiceForm.status==1?'active':'']">正常</p>
				<p @click="activeBtn('status',2)" :class="[invoiceForm.status==2?'active':'']">已作废</p>
				<p @click="activeBtn('status',3)" :class="[invoiceForm.status==3?'active':'']">已冲红-全额</p>
				<p @click="activeBtn('status',4)" :class="[invoiceForm.status==4?'active':'']">已冲红-部分</p>
			</view>
			<h4>发票使用状态</h4>
			<view class="choose-item">
				<p @click="activeBtn('use',1)" :class="[invoiceForm.use==1?'active':'']">未使用</p>
				<p @click="activeBtn('use',2)" :class="[invoiceForm.use==2?'active':'']">已使用</p>
			</view>
			<h4>发票认证状态</h4>
			<view class="choose-item">
				<p @click="activeBtn('authentication',1)" :class="[invoiceForm.authentication==1?'active':'']">未认证</p>
				<p @click="activeBtn('authentication',2)" :class="[invoiceForm.authentication==2?'active':'']">已认证</p>
			</view>
			<h4>开票起止时间</h4>
			<view class="choose-item time-class">

				<uni-datetime-picker type="date" style="width: 50%" v-model="invoiceForm.starTime">
					<p style="width: 77%;text-align: center;">{{invoiceForm.starTime || "开票开始时间"}}</p>
				</uni-datetime-picker>

				<uni-datetime-picker type="date" style="width: 50%" v-model="invoiceForm.endTime">
					<p style="width: 77%;text-align: center;">{{invoiceForm.endTime || "开票结束时间"}}</p>
				</uni-datetime-picker>
			</view>
			<view class="tow-btn-class">
				<view @click="onreset"
					style="width: 45%;height: 100%;color: #fff;background: #FF8604;border-radius: 10px;line-height: 36px;text-align: center;">
					重置
				</view>
				<view @click="submitBtn"
					style="width: 45%;height: 100%;color: #fff;background: #0087FD;border-radius: 10px;line-height: 36px;text-align: center;">
					确认
				</view>
			</view>
		</uni-popup>

逻辑代码

	const popupRef = ref()
	// 打开弹框的方法-绑在触发的元素上
	const showPopupBtn = () => {
		popupRef.value.open('bottom')
	}
	// 发票筛选
	let invoiceForm = ref({
		status: "",
		use: "",
		authentication: "",
		starTime: "",
		endTime: ""
	})
	// 切换激活状态
	const activeBtn = (type, val) => {
		invoiceForm.value[type] = val
	}
	// 提交
	const submitBtn = () => {
		popupRef.value.close()
	}
	// 重置选项
	const onreset = () => {
		invoiceForm.value.status = ""
		invoiceForm.value.use = ""
		invoiceForm.value.authentication = ""
		invoiceForm.value.starTime = ""
		invoiceForm.value.endTime = ""
	}

css

::v-deep .uni-popup__wrapper {
			padding: 10px 10px 0;
			display: flex;
			flex-direction: column;

			.choose-item {
				display: flex;
				width: 100%;
				margin: 10px 0 30px;

				p {
					width: fit-content;
					padding: 6px 10px;
					border-radius: 10px;
					background: #F1F0F1;
					font-size: 14px;
					margin-right: 7px;
				}

				.active {
					background: #37C2BC;
					color: #fff;
				}
			}

			::v-deep .uni-date-editor {
				display: flex;
				justify-content: center;
			}

			.tow-btn-class {
				width: 100%;
				height: 36px;
				display: flex;
				justify-content: space-around;
				margin-bottom: 30px;
			}
		}


http://www.kler.cn/news/294347.html

相关文章:

  • R语言中rds 文件是什么,都保存了什么数据,详解
  • 宠物浮毛对身体危害竟这么大?再不预防就来不及了
  • Selenium4.0详细介绍
  • 龙芯+FreeRTOS+LVGL实战笔记(新)——05部署主按钮
  • 从零开始,认识游戏设计师(4)体验源于设计师②
  • 数据结构----链表
  • C# 特性与属性的区别
  • iOS 中,用户点击一个按钮到响应的全部流程
  • 【网络安全】服务基础第二阶段——第二节:Linux系统管理基础----Linux统计,高阶命令
  • 利用Spring Boot打造图书个性化推荐平台
  • C语言练习题之 数组中出现次数超过一半的数
  • C# 通过拖控件移动窗体
  • MySQL · 性能优化 · 提高查询效率的实用指南(上)
  • 第十四节:学习Springboot 的restful接口风格(自学Spring boot 3.x的第三天)
  • ROADM(可)-介绍
  • 【Linux网络编程】协议|OSI模型|TCP/IP模型|局域网通信|跨网络通信|地址管理|流程图
  • Kafka和ES加密
  • 深度学习dataset等概念
  • 【杂谈】-国产单片机学习成本高的原因分析
  • Deep Ocr
  • Flask如何处理静态文件
  • Spring拦截器与Servlet过滤器区别
  • Unity3D DOTS Component详解
  • 人机交互中的当斯定律
  • Redis数据持久化方法
  • 要在nginx中配置后端三个服务器的轮询和加权
  • Linux下安装和使用SVN及常用操作命令详解
  • 玩转Python Turtle库,实现满屏飘字的魔法!
  • vite项目配置本地开发使用https访问
  • 后背筋膜炎怎么治疗才能除根