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> & ...
随机推荐
- cpanle/Apache 强制http跳转到https
因为租的虚拟主机是使用Cpanel,按照网上找的文章,处理的步骤如下: 打开Cpanel面板-文件管理器-设置(在页面的右上角)-勾选显示隐藏文件(dotfiles)-save . 找到网站所在的目录 ...
- 用List和Map排序输出
参考:java的treemap反序输出 int->string string->int java对象数组的概述 List import java.io.*; import java.uti ...
- cocos2D-X 显示中文
{ 将所在的cpp文件改为utf-8 无签名格式再编译 //但,治标不治本 }
- Hibernate Session 4种对象状态
站在持久化的角度.Hibernate把对象分为4中状态. 临时状态. 持久化状态.游离状态.删除状态. 1:Save()方法: //这个是验证:1:save方法使临时对象------>变成持久化 ...
- SysTick功能总结
一.初始化SysTick 按1ms来设置systick,也可以除以1000000.按1us来设置 SysTick_Config(SystemCoreClock / 1000); //SysTick开启 ...
- jquery实现给循环的每一项加上不同的样式
项目中需要实现这样的效果,模块中需要展示若干的商品,这些商品的分类名称需要显示不同的背景色,一共提供了三种背景色做选择, 这样的话就需要用这三种颜色做循环,一开始我的思路是做随机分配颜色,但是这样的话 ...
- GIT上传下载报错:[You do not have permission to pull from the repository]的解决方案!
第一步:打开我的电脑 第二步:选择此电脑,右击弹出框点击属性进入控制面板 第三步:进入控制面板 第四步:搜索管理凭据 第五步:编点击右侧按钮,进行编辑用户名和密码的操作添加凭据 git:https:/ ...
- HTML—学习笔记
1 .表格 <br/>换行 <p> align top<img src="./julizi.png" align="top" &g ...
- Another Blog
I also hold a blog with thoughts of English learning. Get there ===>. It's a private blog. Actual ...
- cooike和session到底是个啥
1.为什么需要cookie ? cookie不属于http协议范围,由于http协议无法保持状态,即无状态属性.但实际情况,我们却又需要“保持状态”,因此cookie就是在这样一个场景下诞生. co ...