详细问题描述
[内容]
mui-modal 层有复选框或者单选按钮的时候,点击复选框或者单选按钮的时候会把modal层的mui-active属性remove掉如果点击空白地方,然后再点击单选按钮,则不会remove掉modal层
重现步骤
[步骤] 在modal层上加入checkBox ,radio,进行点击
[结果] modal会被remove掉
[期望]modal不被remove掉
运行环境
[系统版本]win7
[浏览器版本]chrome
[IDE版本]HBuilder 7.5.1.201610112114
[mui版本]3.4.1
附件
[代码片段]<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello MUI</title>
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="../css/mui.min.css">
<script src="../js/mui.min.js"></script>
<style>
html,
body {
background-color: #efeff4;
}
</style>
<script>
mui.init({
swipeBack: true //启用右滑关闭功能
});
</script>
</head>
<body>
<div class="mui-content">
<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title">modal(弹出窗口)</h1>
</header>
<div class="mui-content">
<a href="#modal" class="mui-btn mui-btn-primary mui-btn-block">Click</a>
</div>
<div id="modal" class="mui-modal">
<header class="mui-bar mui-bar-nav">
<a class="mui-icon mui-icon-close mui-pull-right" href="#modal"></a>
<h1 class="mui-title">Modal</h1>
</header>
<div>
<form class="mui-input-group">
<div class="mui-input-row mui-checkbox mui-left">
<label>checked:false</label>
<input name="checkbox" value="Item 1" type="checkbox" >
</div>
<div class="mui-input-row mui-checkbox mui-left">
<label>checked:true</label>
<input name="checkbox" value="Item 2" type="checkbox" checked>
</div>
<div class="mui-input-row mui-checkbox mui-left mui-disabled">
<label>disabled checkbox</label>
<input name="checkbox" type="checkbox">
</div>
</form>
</div>
</body>
</html>
[安装包]
联系方式
[QQ]605823850
[电话]
2 个回复
2***@qq.com
给modal 一个另外的id ,去掉官方的 id = modal;触发modal 显示 添加js 事件 ,给该modal 添加class : mui-active
Think_Wang
确定此为mui的bug,规避方式为,用js控制modal显隐,不用a标签hash既可避免此bug。
//关闭
mui('#xxx')[0].classList.remove('mui-active');
//显示
mui('#xxx')[0].classList.add('mui-active');