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. 前端学习(二十九)nodejs(笔记)

    后台语言    java     php     .Net     python    Node.js------------------------------------------------- ...

  2. day01 html介绍 文档声明头 head标签 body标签

    day01 html   初识html <!--文档的声明--> <!doctype html>   <html lang="en">    # ...

  3. mysql安装与修改密码

    数据库基本概念:数据的仓库 数据库服务器-->数据库-->表-->记录-->属性(列,字段) unix下数据库服务安装: apt-get install -y mysql-se ...

  4. ps查看和调整优先级

    主题ps查看和调整优先级 一查看优先级 nice值越大优先级越低 [root@centos72 ~]# ps axo pid,cmd,ni | head PID CMD NI 1 /usr/lib/s ...

  5. ceph学习笔记之十二 Ubuntu安装部署Ceph J版本

    https://cloud.tencent.com/info/2b70340c72d893c30f5e124e89c346cd.html 安装Ubuntu系统安装步骤略过 拓扑连接: 一.安装前准备工 ...

  6. ELK Stack 7.1.1之集群搭建

    一. 环境准备:3台Linux服务器,系统为CentOS 7.5 角色划分:3台机器全部安装jdk1.8,全部安装elasticsearch (后续都简称为es集群) 主节点上需要安装kibana与l ...

  7. Oracle中使用REGEXP_SUBSTR,regexp_replace,wm_concat函数

    REGEXP_SUBSTR函数格式如下: function REGEXP_SUBSTR(String, pattern, position, occurrence, modifier)__srcstr ...

  8. Spring MVC请求参数绑定 自定义类型转化 和获取原声带额servlet request response信息

    首先还在我们的框架的基础上建立文件 在domian下建立Account实体类 import org.springframework.stereotype.Controller; import org. ...

  9. ivew Table 固定列设置后,底部拖拽的横轴被覆盖拉不动

    原因:设置了max-height=500px:表格最大高度,单位 px,设置后,如果表格内容大于此值,会固定表头.去掉即可.

  10. 【转】JMX之ObjectName

    原文链接:https://blog.csdn.net/yunlong34574/article/details/46563187 ObjectName 就是存储了一个domain(域)下的一些属性,属 ...