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最近遇到的问题以及处理的更多相关文章

  1. layui常用方法

    很好用的一个ui组件,弹出,分页等 http://layer.layui.com/ 1 带叉叉的弹窗 layer.open({ type: , title: false, //不显示标题 conten ...

  2. 开源网站.NETMVC+ Layui+SqlSugar+RestSharp

    SugarSite一个前端支持移动端的企业网站,目前只支持了简单功能,后续还会加上论坛等. 源码GIT地址: https://github.com/sunkaixuan/SugarSite 技术介绍 ...

  3. 分页组件 - layui.laypage

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  4. 日期时间组件 - layui.laydate

    全部参数 一.核心方法:laydate(options); options是一个对象,它包含了以下key: '默认值' { elem: '#id', //需显示日期的元素选择器 event: 'cli ...

  5. 关于layui

    之前用layer用了很长时间,感觉很好用,最近看到了layui的发布很想尝试尝试. 加入了挺多的功能,比如编辑器,上传,form表单等等.

  6. 日期控件,layui

    <link rel="stylesheet" href="<%=path%>/layui/css/layui.css" type=" ...

  7. 使用的组件:Layui

    Layui 经典模块化前端框架 由职业前端倾情打造,面向所有层次的前后端程序猿,中国最容易使用的前端UI解决方案 Layui 出蛋于2016年金秋,是一款带着浓烈情怀的国产前端UI框架,她追求极简,又 ...

  8. 【开源项目SugarSite】ASP.NET MVC+ Layui+ SqlSugar+RestSharp项目讲解

    SugarSite一个前端支持移动端的企业网站,目前只支持了简单功能,后续还会加上论坛等. 源码GIT地址: https://github.com/sunkaixuan/SugarSite 技术介绍 ...

  9. 前端框架layui

    可以了解下jQuery组件layer layui开始使用Layui兼容除IE6/7以外的全部浏览器,并且绝大多数结构支持响应式 弹出层如果你使用的是Layui,那么你直接在官网下载layui框架即可, ...

  10. Layui - 示例

    示例地址 http://www.layui.com/demo/ 下载地址 http://www.layui.com/ 示例代码 <!doctype html> <html> & ...

随机推荐

  1. 2019牛客暑期多校训练营(第六场)C E H G

    C Palindrome Mouse E Androgynos 参考https://blog.csdn.net/birdmanqin/article/details/98479219这位大佬的.构造题 ...

  2. JS中的call()和apply()方法(转)

    转自:http://uule.iteye.com/blog/1158829 JS中的call()和apply()方法 博客分类: JS   1.方法定义 call方法: 语法:call([thisOb ...

  3. 【C/C++】知识点系统复习 (第一周)

    2018/12/18 周二 1. C++内存布局分为几个区域,每个区域有什么特点? 主要可以分为 5 个区域, (1) 栈区:由编译器自动分配释放,存放函数的参数值,局部变量的值等.其操作方式类似于数 ...

  4. Bootstrap 警告框

    <div class="panel panel-primary"> <div class="panel-heading"> <h3 ...

  5. 静态部署TOMCAT

    常见部署方式:静态部署和容器化部署 一.下载tomcat安装包 下载地址:https://tomcat.apache.org/download-90.cgi 图上是显示最新版本,而我下载的是9.0.8 ...

  6. python3.x 扯扯【切片】这玩意儿

    在此之前先了解一下list这个玩意儿: list对应cpp这的数组,一维数组,二维数组,或者是嵌套都行: L=[] #空列表 L=[1,2,3,4,5,6] #六项 L=['a',['b','c']] ...

  7. docker 运行jenkins及vue项目与springboot项目(五.jenkins打包springboot服务且在docker中运行)

    docker 运行jenkins及vue项目与springboot项目: 一.安装docker 二.docker运行jenkins为自动打包运行做准备 三.jenkins的使用及自动打包vue项目 四 ...

  8. java基础学习笔记六(继承)

    继承的概念 继承是java面向对象编程技术的一块基石,因为它允许创建分等级层次的类. 继承就是子类继承父类的特征和行为,使得子类对象(实例)具有父类的实例域和方法,或子类从父类继承方法,使得子类具有父 ...

  9. 每天一个linux命令:cat(10)

    cat cat命令的用途是连接文件或标准输入并打印.这个命令常用来显示文件内容,或者将几个文件连接起来显示,或者从标准输入读取内容并显示,它常与重定向符号配合使用 注意:当文件较大时,文本在屏幕上迅速 ...

  10. UIDatePicker odd behavior when setting minuteInterval

    http://stackoverflow.com/questions/6948297/uidatepicker-odd-behavior-when-setting-minuteinterval Her ...