LayUI最近遇到的问题以及处理
layui是我最近才接触的..也是新项目中用到的后台前端框架..与easyui有些类似..在这段时间的使用中,经常会碰到大大小小的问题..
1.选显卡切换又是加载数据表格。分页条不显示
2.layui.open弹出框中的无法触发用js.或者jquery写得触发事件..
等问题..但是这两个问题是我遇到过最坑的..
至于解决办法
1.针对分页栏无法显示..只能通过切换表格的时候重新加载数据表格
2.弹出框中的事件..只能使用layui的事件方式触发..例如我做了个复选款权限树..
但是却无法触发复选款改变事件..或者点击事件..通过不断的尝试..最后用了layui标准的复选款监听..才能触发..这浪费了我不少时间..
$('#add-btn').click(function(){
var index=layer.open({
type: 1
,area: ['550px','400px']
,title: ['添加门店', 'font-size:16px;height:40px;line-height:40px;background:#fff;border-top:3px solid #3a90b8;border-bottom:1px solid #e0e0e0']
,content: str
,btn: ['确认', '取消']
,shade: 0.1 //不显示遮罩
,yes: function(index, layero){
var str="";
$("#tip-organ").html();
$("#hidInfo").html();
var organs=$("input[name='fen1']");
var inpstr="";
for(var i=0;i<organs.length;i++){
var organ="";
if(organs[i].checked == true){
var title=organs[i].title;
organ=organs[i].value;
var id='id'+organ;
console.log(id);
str+=title;
str+=':';
inpstr+='<input type="hidden" name="organId" id="shopId" value="'+organ+'">';
var online=$("#"+id+" input[name='type1']").is(':checked');
console.log(online);
var offLine=$("#"+id+" input[name='type2']").is(':checked');
console.log(offLine);
if(online==true && offLine==true){
inpstr+='<input type="hidden" name="kind" id="applykind" value="3">'
str+=$("#"+id+" .shop-two-unit input:checkbox[name='type1']:checked").attr("title");
str+=",";
str+=$("#"+id+" input:checkbox[name='type2']:checked").attr("title");
}else if(offLine==true && online==false){
var title=$("#"+id+" input:checkbox[name='type2']:checked").attr("title");;
str+=title;
str+=",";
inpstr+='<input type="hidden" name="kind" id="applykind" value="2">'
}else if(online==true && offLine==false){
var title=$("#"+id+" input:checkbox[name='type1']:checked").attr("title");;
str+=title;
str+=",";
inpstr+='<input type="hidden" name="kind" id="applykind" value="1">'
}else{
layer.msg('请选择门店活动适用范围!');
return false;
}
}
}
$("#tip-organ").html(str);
$("#hidInfo").html(inpstr);
layer.closeAll();
}
,cancel: function(index, layero){
}, success: function(layero, index){
shopstr=loadShopDom();
$(".shop-r").html(shopstr);
var form = layui.form;
form.render('checkbox');
$("document").on('click','#father',function(){
alert("2");
if ($(this).prop("checked") == true) {
$(this).parents("li").eq(0).find("input:checkbox").prop("checked", true);
} else {
$(this).parents("li").eq(0).find("input:checkbox").prop("checked",false);
}
var form = layui.form;
form.render('checkbox');
});
$('#father').click(function(){
alert("2");
if ($(this).prop("checked") == true) {
$(this).parents("li").eq(0).find("input:checkbox").prop("checked", true);
} else {
$(this).parents("li").eq(0).find("input:checkbox").prop("checked",false);
}
form.render('checkbox');
});
form.on('checkbox(owner_one)', function(data){
if ($(this).prop("checked") ==true) {
$(this).parents("li").parents("li").eq(0).find("input:checkbox.father").prop("checked", true);
} else {
if ($(this).parents("li").parents("li").eq(0).find("input:checkbox:not(.father):checked").length == 0) {
$(this).parents("li").parents("li").eq(0).find("input:checkbox.father").prop("checked",false);
}
}
form.render('checkbox');
});
form.on('checkbox(owner_all)', function(data){
var a = data.elem.checked;
if(a == true){
$(this).parents("li").eq(0).find("input:checkbox").prop("checked", true);
form.render('checkbox');
}else{
$(this).parents("li").eq(0).find("input:checkbox").prop("checked",false);
form.render('checkbox');
}
});
}
});
});
});
LayUI最近遇到的问题以及处理的更多相关文章
- layui常用方法
很好用的一个ui组件,弹出,分页等 http://layer.layui.com/ 1 带叉叉的弹窗 layer.open({ type: , title: false, //不显示标题 conten ...
- 开源网站.NETMVC+ Layui+SqlSugar+RestSharp
SugarSite一个前端支持移动端的企业网站,目前只支持了简单功能,后续还会加上论坛等. 源码GIT地址: https://github.com/sunkaixuan/SugarSite 技术介绍 ...
- 分页组件 - layui.laypage
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- 日期时间组件 - layui.laydate
全部参数 一.核心方法:laydate(options); options是一个对象,它包含了以下key: '默认值' { elem: '#id', //需显示日期的元素选择器 event: 'cli ...
- 关于layui
之前用layer用了很长时间,感觉很好用,最近看到了layui的发布很想尝试尝试. 加入了挺多的功能,比如编辑器,上传,form表单等等.
- 日期控件,layui
<link rel="stylesheet" href="<%=path%>/layui/css/layui.css" type=" ...
- 使用的组件:Layui
Layui 经典模块化前端框架 由职业前端倾情打造,面向所有层次的前后端程序猿,中国最容易使用的前端UI解决方案 Layui 出蛋于2016年金秋,是一款带着浓烈情怀的国产前端UI框架,她追求极简,又 ...
- 【开源项目SugarSite】ASP.NET MVC+ Layui+ SqlSugar+RestSharp项目讲解
SugarSite一个前端支持移动端的企业网站,目前只支持了简单功能,后续还会加上论坛等. 源码GIT地址: https://github.com/sunkaixuan/SugarSite 技术介绍 ...
- 前端框架layui
可以了解下jQuery组件layer layui开始使用Layui兼容除IE6/7以外的全部浏览器,并且绝大多数结构支持响应式 弹出层如果你使用的是Layui,那么你直接在官网下载layui框架即可, ...
- Layui - 示例
示例地址 http://www.layui.com/demo/ 下载地址 http://www.layui.com/ 示例代码 <!doctype html> <html> & ...
随机推荐
- linux---postgresql的安装和配置
postgresql的安装:源码安装(推荐):http://my.oschina.net/hippora/blog/375292 1.tar -xjvf postgresql-9.3.4.tar.bz ...
- oracle 中||
oracle里双竖线是字符串连接运算符!
- shell 判断字符串是否包含另一个字符串
1.使用grep s1="abcdefg" s2="bcd" result=$(echo $s1 | grep "${s2}") if [[ ...
- 复位和时钟控制(RCC)
一.系统复位 复位除了部分RCC寄存器和备份区域以外的其他所有的寄存器: 来源: NRST引脚上的低电平(外部复位) WWDG计数结束 IWDG计数结束 软件复位(通过NVIC) 低电压管理的复位 电 ...
- APICloud框架——总结一下最近开发APP遇到的一些问题 (二)
高度自适应 flex布局 允许子元素伸缩 手机号正则 function checkPhone(data){ if(!(/^1[34578]\d{9}$/.test(data))){ alert(&qu ...
- OC学习篇之---谓词(NSPredicate)
在前一篇文章中我们介绍了OC中一个重要技术通知:http://blog.csdn.net/jiangwei0910410003/article/details/41923401,今天我们在来看一下OC ...
- Vue.config.optionMergeStrategies 用法分析
举个例子,假设有个对象,他叫objA, 技能是说hello,他喜欢的女生叫小花,但是他是一个花心的人! objA = { name: 'objA ', sayHello_ () { console.l ...
- Dart 和 Flutter 使用json_annotation和json_serializable来处理json数据教程
在学习fultter的时候突然想到如何去处理从服务器获取的json或者将app中的对象数据转换成json上传给服务器 于是研究一下dart对json数据的处理 首先需要依赖下面的第三方库(这里要强调下 ...
- Source Insight下载及注册码
下载地址:http://www.sourceinsight.com/down35.html 注册码: SI3US-205035-36448 SI3US-466908-65897 SI3US-36893 ...
- jsp中jstl、el使用
tomcat7.0+JSTL1.1.2(不冲突) EL表达式获取变量 ${表达式} 如:${user.name} 不可以动态取值 ${user[name]}可以动态取值,变量名中含有特殊字符时只能用此 ...