在checkbox设置ms-duplex后,点击另外一个,原来加载的会取消点击
1需求是从json加载用户之前选择的人名,加了ms-duplex,会出现点击另外一个,原来加载的会取消点击的bug,不加ms-duplex就没有这个bug。
2.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link href="1.css" rel="stylesheet" type="text/css">
<script src="jq.js"></script><!--版本是1.9.1-->
<script src="avalon.js"></script><!--版本是1.5.8-->
<style>
.px_namebox{display:none}
.showChoose{border:1px solid #ccc}
</style>
<script>
var vm=avalon.define({
$id:'vm',
teachersGrounp:[],
toAjax:[],
test:function(){
$.ajax({
url:'json.json',
type:'get',
dataType:'json',
success:function(e){
vm.teachersGrounp=e.bizData.data;
console.log(e);
}
});
}
});
vm.test();
$(function(){
setTimeout(function(){
px_zu_update();
},1000);
});
function px_zu_update(){
//组点击
$('#updatepx .px_groupname').each(function(){
$(this).click(function(){
$(this).parent().find(".px_namebox").slideToggle(200);
})
});
//单列表点击
var aBB=[];
$("#updatepx .px_namebox").each(function(i){
var checkbox=$(this).find('.qkychbox');
var teacherName=$(this).find('.bbb').text();
var status=$(this).find('.ccc').text();
var text=$('#updatepx .selectON');
checkbox.each(function(){
if(status==1){
checkbox.attr("checked", true);
aBB.unshift(teacherName);
text.text(aBB);
}
});
});
}
</script>
</head>
<body ms-controller="vm" id="updatepx">
<h1>选择了:<span class="selectON"></span></h1>
<div ms-repeat="teachersGrounp">
<button ms-text="el.customName" class="px_groupname"></button>
<div class="px_namebox" ms-repeat-ee="el.teachers">
<input type="checkbox" class="qkychbox fang trn" ms-duplex="toAjax" ms-attr-value='{"uid":"{{ee.uid}}","name":"{{ee.name}}","headImage":"{{ee.headImage}}"}'>
<span class="bbb" ms-text="ee.name"></span>
<span class="ccc option0" ms-text="ee.status"></span>
</div>
</div>
</body>
</html>
json:
{
"bizData": {
"resultMsg": "查询成功",
"result": 1,
"data": [
{
"catMode": "0013",
"childDepts": [],
"createDate": 0,
"customName": "维修部",
"deptCode": "gxgj-wxb",
"deptSchoolMemberId": 0,
"id": 14,
"isolated": 0,
"lastModDate": 1476695594724,
"lastModDateAsDate": "2016-10-17 17:13:14",
"parentId": 0,
"schoolCode": "6101024000",
"status": 0,
"teachers": [
{
"name": "张娇20",
"status": "1",
"uid": "5d65a6f0f461444983681bfc54e4f843"
},
{
"name": "max030",
"status": "1",
"uid": "c5389711135111e6bb57fa163e33daaa"
},
{
"headImage": "http://qkyb.ks3-cn-center-1.ksyun.com/20160506155213.xC5B8ny8Lo.jpg",
"name": "陈启泰",
"status": "1",
"uid": "09e8d6d8e67011e5bed7fa163e33daaa"
},
{
"name": "mac",
"status": "0",
"uid": "3fa116a3f19111e5bed7fa163e33daaa"
},
{
"name": "math",
"status": "0",
"uid": "3fada83bf19111e5bed7fa163e33daaa"
},
{
"headImage": "http://qkyb.ks3-cn-center-1.ksyun.com/20160817095023.aRaoJgILW0.jpg",
"name": "陈新元",
"status": "0",
"uid": "14f904d0714d11e5be87fa163e33daaa"
}
],
"weixinId": 0
},
{
"catMode": "001400020001",
"childDepts": [],
"createDate": 0,
"customName": "美术组1",
"deptCode": "GXGJ-美术301",
"deptSchoolMemberId": 0,
"id": 73,
"isolated": 0,
"lastModDate": 1476695594724,
"lastModDateAsDate": "2016-10-17 17:13:14",
"parentId": 0,
"schoolCode": "6101024000",
"status": 0,
"teachers": [
{
"name": "max042",
"status": "0",
"uid": "c741dc6b135111e6bb57fa163e33daaa"
},
{
"name": "max032",
"status": "0",
"uid": "c5739163135111e6bb57fa163e33daaa"
}
],
"weixinId": 0
}
]
},
"rtnCode": "0000000",
"ts": 1476695594347
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论