如何实现在confirm弹框中加几个单选框?(基于mui框架实现)

如何实现在confirm弹框中加几个单选框?(基于mui框架实现)

css:

.modal {
	display: none;
	/* 默认隐藏 */
	position: fixed;
	/* 固定定位 */
	z-index: 1;
	/* 设置在顶层 */
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	overflow: auto;
	background-color: rgb(0, 0, 0);
	background-color: rgba(0, 0, 0, 0.4);
}

/* 弹窗内容 */
.modal-content {
	background-color: #fefefe;
	margin: 50% auto;
	padding: 20px 0 0 0;
	border: 1px solid #888;
	border-radius: 16px;
	width: 80%;
}

/* 关闭按钮 */
.close {
	width: 50%;
	height: 39px;
	color: #C1080D;
	font-size: 17px;
	border: none;
	border-left: 1px solid #f5f5f5;
	display: flex;
	flex-direction: row;
	justify-content: center;
	align-items: center;
	align-content: center;
}

.close:hover,
.close:focus {
	color: black;
	text-decoration: none;
	cursor: pointer;
}

.sure_select {
	width: 100%;
	display: flex;
	flex-direction: row;
	justify-content: space-around;
	border-top: 1px solid #F5F5F5;
}

.cancel {
	width: 50%;
	height: 39px;
	color: #c3c3c3;
	font-size: 17px;
	border: none;
	border-bottom-right-radius: 16px;
	display: flex;
	flex-direction: row;
	justify-content: center;
	align-items: center;
	align-content: center;
}

html:

<div id="myModal" class="modal">
		<!-- 弹窗内容 -->
	<div class="modal-content">
		<div class="mui-input-row mui-radio mui-left">
	       <label>1.挂号小秘书(全国网络医院,服务不限次)</label>
		   <input name="radio1" type="radio" style="top: 8px;">
		</div>
		<div class="mui-input-row mui-radio mui-left">
			<label>2.苏州儿童医院普通门诊预约</label>
			<input name="radio1" type="radio" style="top: 8px;">
		</div>
		<div class="mui-input-row mui-radio mui-left">
			<label>3.苏州儿童医院专家门诊预约</label>
		    <input name="radio1" type="radio" style="top: 8px;">
		</div>
		<div class="sure_select">
			<div style="" class="cancel">取消</div>
			<div style="width: 1px;height: 36px;color: #F5F5F5;"></div>
			<div style="" class="close">确定</div>
		</div>
	</div>
</div>

js:

            // 获取弹窗
			var modal = document.getElementById('myModal');
			// 打开弹窗的按钮对象 
			var btn = document.getElementById("myBtn");
			// 获取 <span> 元素,用于关闭弹窗 
			var span = document.querySelector('.close');
			//获取 確定 按鈕 
			var sure = document.querySelector('.sure');
			//获取 取消 按鈕
			var cancel = document.querySelector('.cancel');
			// 点击按钮打开弹窗 
			btn.onclick = function() {
				modal.style.display = "block";
			}
			// 点击 <span> (x), 关闭弹窗 
			span.onclick = function() {
				modal.style.display = "none";
			}
			// 在用户点击其他地方时,关闭弹窗 
			window.onclick = function(event) {
				if (event.target == modal) {
					modal.style.display = "none";
				}
			}
			// 在用户点击取消按鈕 
			cancel.onclick = function(event) {
				modal.style.display = "none";
			}

实现效果:
在这里插入图片描述

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值