【RuoYi移动端】HbuilderX实现底部弹窗示例
  3LrZxqoUjBcx 2023年11月13日 29 0


一、单选样式弹窗选择

【RuoYi移动端】HbuilderX实现底部弹窗示例_服务器

1、View页面代码

<uni-popup ref="textBox" type="bottom">
			<view class="select_box">
				<view class="select_row" v-for="(item,index) in status" @click="selectClick(item.id)">
					{{item.name}}
				</view>
			</view>
		</uni-popup>


<view @click="open('2')"> 打开弹窗 </view>

2、css页面代码

.select_box {
		height: auto;
		width: 100%;
		background-color: white;
		// margin-bottom: 50px;
	}

	.select_row {

		height: 50px;
		line-height: 50px;
		text-align: center;
		border-bottom: 1px solid rgb(235, 235, 235);
		// padding-left: 100px;

	}

3、js代码

data()

data() {

			return {
				
				verBj: "", // 选择弹出框中的变量标记
				status: [{
						id: "0",
						name: "是"
					},
					{
						id: "1",
						name: "否"
					},
				],

			}
		},
open(bj) {
				// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
				this.verBj = bj; // 一个弹出框,确定执行哪个程序
				this.$refs.selectBox.open('bottom')
			},

			selectClick(id) {

				// 通道1
				if (this.verBj === "1") {
					this.checkDesc.isEmergency = id;
				}

				// 通道2
				if (this.verBj === "2") {
					this.checkDesc.isJoint = id;
				}

				this.$refs.popup.close() // 关闭弹窗
			}

二、弹出输入内容框

1、template页面代码

<uni-popup ref="textBox" type="bottom">

			<view class="popupTitle">
				请输入内容
			</view>
			<view class="select_box">
				<view class="textBox_1">
					<textarea class="textareaBox" v-model="checkDesc.remark" />
				</view>
				<view class="selectButton" @click="submitClick">
					保存提交
				</view>
			</view>
		</uni-popup>

2、css页面代码

.select_box {
		height: auto;
		width: 100%;
		background-color: white;
		// margin-bottom: 50px;
	}

	.select_row {

		height: 50px;
		line-height: 50px;
		text-align: center;
		border-bottom: 1px solid rgb(235, 235, 235);
		// padding-left: 100px;

	}

	.selectButton {
		height: 45px;
		line-height: 45px;
		font-size: 18px;
		width: 100%;
		margin: 0 auto;
		background-color: rgb(42, 121, 255);
		// border-radius: 5px;
		color: white;
		text-align: center;
		// margin-bottom: 5px;
		margin-top: 20px;
	}

	.popupTitle {
		height: 50px;
		line-height: 50px;
		width: 100%;
		background-color: #eaf0f6;
		text-align: center;
		font-size: 18px;
		color: rgb(130, 130, 130);
	}

	.textBox_1 {
		height: 150px;
		width: 100%;
	}

	.textareaBox {
		background-color: #f9f9f9;
		width: 100%;
		height: 100%;
		font-size: 20px;
		padding: 10px 10px 10px 10px;
	}

3、js页面代码

return {
				verBj: "", // 选择弹出框中的变量标记
				textBox: "", // 选择文本框内容
				status: [{
						id: "1",
						name: "是"
					},
					{
						id: "0",
						name: "否"
					},
				],
// ============  【文本框弹窗】
			openText(bj) {
				// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
				this.verBj = bj; // 一个弹出框,确定执行哪个程序
				this.$refs.textBox.open('bottom')
			},
			submitClick() {
				this.$refs.textBox.close() // 关闭弹窗
			}
【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月13日 0

暂无评论

推荐阅读
  2Vtxr3XfwhHq   2024年05月17日   53   0   0 Java
  Tnh5bgG19sRf   2024年05月20日   109   0   0 Java
  8s1LUHPryisj   2024年05月17日   46   0   0 Java
  aRSRdgycpgWt   2024年05月17日   47   0   0 Java
3LrZxqoUjBcx