pull/868/head v2.6.5
贤心 4 years ago
parent 0a433bf2e4
commit 726cdd9ba5

@ -1,7 +1,7 @@
{ {
"name": "layui", "name": "layui",
"main": "dist/layui.js", "main": "dist/layui.js",
"version": "2.6.4", "version": "2.6.5",
"homepage": "https://github.com/sentsin/layui", "homepage": "https://github.com/sentsin/layui",
"authors": [ "authors": [
"sentsin <xu@sentsin.com>" "sentsin <xu@sentsin.com>"

File diff suppressed because one or more lines are too long

6
dist/layui.js vendored

File diff suppressed because one or more lines are too long

@ -28,8 +28,14 @@ resize: none;">
<div id="demo1"></div> <div id="demo1"></div>
<button class="layui-btn demo" test-active="test-form">测试弹出式 Form</button>
<button class="layui-btn demo" test-active="test-use">测试是否重复加载内置组件</button> <div class="layui-btn-container">
<button class="layui-btn demo" test-active="test-form">测试弹出式 Form</button>
<button class="layui-btn demo" test-active="test-use">测试是否重复加载内置组件</button>
</div>
<div class="layui-inline">
<input class="layui-input" id="date1" placeholder="日期">
</div>
<div class="layui-tab" lay-filter="tabDemo"> <div class="layui-tab" lay-filter="tabDemo">
<ul class="layui-tab-title"> <ul class="layui-tab-title">
@ -72,9 +78,37 @@ layui.use(function(){
,laypage = layui.laypage ,laypage = layui.laypage
,element = layui.element ,element = layui.element
,transfer = layui.transfer ,transfer = layui.transfer
,util = layui.util; ,util = layui.util
,laydate = layui.laydate;
layer.msg('hello'); layer.msg('hello');
layer.closeAll();
//自动测试
(function(run){
if(!run) return;
var timer = setInterval(function(){
location.reload();
}, 1000);
$.ajax({
url: './all.html'
,beforeSend: function(){
layer.load();
}
,success: function(){
layer.closeAll('loading', function(){
setTimeout(function(){
if($('.layui-layer-loading').length){
console.error('layer close 异常');
clearInterval(timer);
}
}, 200);
});
}
});
})(0);
laypage.render({ laypage.render({
elem: 'demo1' elem: 'demo1'
@ -83,6 +117,10 @@ layui.use(function(){
console.log(lay('#footer').html()); console.log(lay('#footer').html());
laydate.render({
elem: '#date1'
})
//测试加载非内置模块 //测试加载非内置模块
/* /*
layui.config({ layui.config({

@ -12,12 +12,32 @@
<link rel="stylesheet" href="../src/css/layui.css"> <link rel="stylesheet" href="../src/css/layui.css">
<style> <style>
body{padding: 10px;} body{padding: 10px;}
</style> </style>
</head> </head>
<body> <body>
<form class="layui-form" method="get">
<div class="layui-form-item">
<div class="layui-input-inline">
<input type="text" name="arr[]" required placeholder="请输入" autocomplete="off" class="layui-input">
</div>
<div class="layui-input-inline">
<input type="text" name="arr[]" required placeholder="请输入" autocomplete="off" class="layui-input">
</div>
<div class="layui-input-inline">
<input type="text" name="arr[title]" required placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<button class="layui-btn" lay-submit lay-filter="top">立即提交</button>
</div>
</form>
<hr>
<form class="layui-form layui-form-pane1" action="" lay-filter="first"> <form class="layui-form layui-form-pane1" action="" lay-filter="first">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">输入框</label> <label class="layui-form-label">输入框</label>
@ -64,7 +84,7 @@ body{padding: 10px;}
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">行内表单</label> <label class="layui-form-label">行内表单</label>
<div class="layui-input-block"> <div class="layui-input-block">
<select name="quiz" lay-verify="required" lay-verType="tips"> <select name="quiz" lay-verify="required" lay-verType="tips" lay-filter="quiz111">
<option value="">请选择问题</option> <option value="">请选择问题</option>
<option value="0">你工作的第一个城市</option> <option value="0">你工作的第一个城市</option>
<option value="1" disabled>你的工号</option> <option value="1" disabled>你的工号</option>
@ -214,6 +234,14 @@ layui.use(['form', 'layedit', 'laydate'], function(){
] ]
}); });
form.on('submit(top)', function(data){
console.log(data);
return false;
});
//日期 //日期
laydate.render({ laydate.render({
elem: '#date' elem: '#date'
@ -225,7 +253,7 @@ layui.use(['form', 'layedit', 'laydate'], function(){
,'phone': 11111111111 ,'phone': 11111111111
,'email': 'xu@sentsin.com' ,'email': 'xu@sentsin.com'
,'password': 123123 ,'password': 123123
//,'quiz': 2 ,'quiz': 2
,'interest': 3 ,'interest': 3
,'like[write]': true ,'like[write]': true
//,'open': false //,'open': false
@ -233,11 +261,10 @@ layui.use(['form', 'layedit', 'laydate'], function(){
,'desc': 'form 是我们非常看重的一块' ,'desc': 'form 是我们非常看重的一块'
,xxxxxxxxx: 123 ,xxxxxxxxx: 123
}); });
console.log(thisValue);
//事件监听 //事件监听
form.on('select', function(data){ form.on('select(quiz111)', function(data){
console.log('select: ', this, data); console.log('select: ', this, data);
}); });

@ -4,7 +4,6 @@
,"count": 3000000 ,"count": 3000000
,"totalRow": { ,"totalRow": {
"experience": "666" "experience": "666"
,"logins": "999"
} }
,"data": [{ ,"data": [{
"id": "10001" "id": "10001"

@ -11,6 +11,9 @@
<style> <style>
body{padding: 100px;} body{padding: 100px;}
#photos li{float: left; margin: 0 1px 1px;}
#photos img{max-height: 38px;}
</style> </style>
</head> </head>
<body> <body>
@ -31,20 +34,75 @@ body{padding: 100px;}
123 123
</div> </div>
<hr><br>
<div class="layui-list">
<ul class="layui-row" id="photos">
<li><img src="https://cdn.layui.com/upload/2017_3/168_1488985841996_23077.png"></li>
<li><img src="https://res.layui.com/static/images/fly/fly.jpg"></li>
</ul>
</div>
<script src="../src/layui.js"></script> <script src="../src/layui.js"></script>
<!-- layer 独立版调试 -->
<script src1="//cdn.staticfile.org/jquery/1.12.3/jquery.min.js"></script>
<script src1="../release/layer/src/layer.js"></script>
<script> <script>
layui.use('layer', function(){ var runTest = function(run, $, layer){
var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句 if(!run) return;
var timer = setInterval(function(){
location.reload();
}, 1000);
$.ajax({
url: './all.html'
,beforeSend: function(){
layer.load();
}
,success: function(){
layer.closeAll('loading', function(){
setTimeout(function(){
if($('.layui-layer-loading').length){
console.error('layer close 异常');
clearInterval(timer);
}
}, 200);
});
}
});
};
window.jQuery && runTest(1, window.jQuery, window.layer);
layui.use('layer', function(){
var $ = layui.jquery, layer = layui.layer;
//return
var index = layer.msg('hello'); var index = layer.msg('hello');
//layer.close(index); //layer.close(index);
//runTest(1, $, layer);
//触发事件 //触发事件
var active = { var active = {
test: function(){ test: function(){
layer.alert('你好么,体验者'); layer.alert('你好么,体验者。<br>在标题栏显示自动关闭倒计秒数', {
time: 5*1000
,success: function(layero, index){
var timeNum = this.time/1000, setText = function(start){
layer.title((start ? timeNum : --timeNum) + ' 秒后关闭', index);
};
setText(!0);
this.timer = setInterval(setText, 1000);
if(timeNum <= 0) clearInterval(this.timer);
}
,end: function(){
clearInterval(this.timer);
}
});
} }
,test2: function(){ ,test2: function(){
layer.confirm('您是如何看待前端开发?', { layer.confirm('您是如何看待前端开发?', {
@ -108,6 +166,17 @@ layui.use('layer', function(){
}; };
//相册层
layer.photos({
photos: '#photos'
});
//动态追加
$('#photos').append('<li><img src="https://res.layui.com/static/images/sentsin/night.gif"></li>');
//{"status":1,"msg":"","title":"JSON请求的相册","id":8,"start":0,"data":[{"alt":"layer","pid":109,"src":"//cdn.layui.com/upload/2017_3/168_1488985841996_23077.png","thumb":""},{"alt":"说好的,一起 Fly","pid":110,"src":"//res.layui.com/static/images/fly/fly.jpg","thumb":""},{"alt":"星空如此深邃","pid":113,"src":"//res.layui.com/static/images/sentsin/night.gif","thumb":""}]}
$('.demo').on('click', function(){ $('.demo').on('click', function(){
var type = $(this).data('type'); var type = $(this).data('type');
active[type] ? active[type].call(this) : ''; active[type] ? active[type].call(this) : '';

@ -68,11 +68,11 @@ layui.use(['rate'], function(){
rate.render({ rate.render({
elem: '#test1' elem: '#test1'
,length: 3 ,length: 5
,value: 3.2 ,value: 5
,text: true ,text: true
,half: true ,half: true
,setText: function(value){ ,setText1: function(value){
var arrs = { var arrs = {
'0.5': '极差' '0.5': '极差'

@ -0,0 +1,256 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>表格操作 - layui</title>
<link rel="stylesheet" href="../src/css/layui.css">
<style>
body{padding: 20px; /*overflow-y: scroll;*/}
</style>
</head>
<body>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>
<button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>
<button class="layui-btn layui-btn-sm" lay-event="getData">获取当前页所有数据</button>
<button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button>
<button class="layui-btn layui-btn-sm" lay-event="reload">重载(保留初始参数)</button>
<button class="layui-btn layui-btn-sm" lay-event="reload2">重载(不保留初始参数)</button>
<button class="layui-btn layui-btn-sm" id="dropdown">
更多菜单
<i class="layui-icon layui-icon-down layui-font-12"></i>
</button>
</div>
</script>
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script type="text/html" id="usernameTpl">
<a href="" class="layui-table-link">{{d.username || ''}}</a>
</script>
<script type="text/html" id="switchTpl">
<input type="checkbox" name="yyy" lay-skin="switch" lay-text="女|男">
</script>
<script type="text/html" id="cityTpl">
<select lay-ignore>
<option value="浙江杭州">浙江杭州</option>
<option value="江西南昌">江西南昌</option>
<option value="湖北武汉">湖北武汉</option>
</select>
</script>
<script type="text/html" id="checkboxTpl">
<input type="checkbox" name="" title="锁定" checked>
</script>
<script type="text/html" id="LAY_table_tpl_email">
<span {{# if(!d.activate){ }}style="color:#999"{{# } }}>{{ d.email }}</span>
</script>
<table id="test" lay-filter="test"></table>
<script src="../src/layui.js" src1="//www.layuicdn.com/layui-v2.5.3/layui.js" charset="utf-8"></script>
<script>
layui.use(['table'], function(){
var table = layui.table
,$ = layui.$
,laytpl = layui.laytpl;
//全局设定某参数
table.set({
where: {
token: '默认 token 参数'
}
//,defaultToolbar: ['filter']
,limit: 30
//,url: 'list'
//,height: 300
});
$('#appendtest').append($('#TPL_appendtest').html())
table.init('appendtest');
//渲染
window.ins1 = table.render({
elem: '#test'
,height: 400
//,width: 600
,title: '用户数据表'
,url: 'json/table/demo1.json'
//,size: 'lg'
,page: {
}
//,autoSort: false //是否自动排序。如果否,则由服务端排序
//,loading: false
,totalRow: true
,limit: 30
,toolbar: '#toolbarDemo'
,defaultToolbar: ['filter', 'exports', 'print', {
title: '帮助'
,layEvent: 'LAYTABLE_TIPS'
,icon: 'layui-icon-tips'
}]
,cols: [[
{type: 'checkbox', fixed: 'left'}
,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true, totalRowText: '合计:'}
,{field:'username', title:'用户名', width:120, edit: 'text', templet: '#usernameTpl'}
,{field:'email', title:'邮箱', hide: 0, width:150, edit: 'text', templet: function(d){
console.log(d);
return '<em>'+ d.email +'</em>'
}}
,{field:'sex', title:'性别', width:80, edit: 'text', sort: true}
,{field:'city', title:'城市', width:120, templet: '#cityTpl'}
,{field:'sign', title:'签名'}
,{field:'experience', title:'积分', width:80, sort: true, totalRow: '{{ d.TOTAL_NUMS }}🍉', templet: '<div>{{ d.experience }} 分</div>'}
,{field:'ip', title:'IP', width:120}
,{field:'logins', title:'登入次数', width:100, sort: true, totalRow: '{{ parseInt(d.TOTAL_NUMS) }} 次'}
,{field:'joinTime', title:'加入时间', width:120}
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
]]
,initSort1: {
field: 'experience' //排序字段,对应 cols 设定的各字段名
,type: 'desc' //排序方式 asc: 升序、desc: 降序、null: 默认排序
}
,headers: {headers_token: 'sasasas'}
,where: {
test: '初始 test 参数'
,token: '初始 token'
,key: 'experience'
,order: 'asc'
}
,done: function(){
}
,error: function(res, msg){
console.log(res, msg)
}
/*
,response: {
statusName: 'status'
,statusCode: 200
}
,parseData: function(res){
return {
"status": res.status
,"msg": res.message
,"count": res.total
,"data": res.data.list
};
}
*/
});
//排序事件
table.on('sort(test)', function(obj){
console.log(obj);
return;
layer.msg('服务端排序。order by '+ obj.field + ' ' + obj.type);
//服务端排序
table.reload('test', {
initSort: obj
//,page: {curr: 1} //重新从第一页开始
,where: { //重新请求服务端
key: obj.field //排序字段
,order: obj.type //排序方式
}
}, true);
});
//工具栏事件
table.on('toolbar(test)', function(obj){
var checkStatus = table.checkStatus(obj.config.id);
switch(obj.event){
case 'add':
layer.msg('添加');
break;
case 'update':
layer.msg('编辑');
break;
case 'delete':
layer.msg('删除');
break;
case 'getCheckData':
var data = checkStatus.data;
layer.alert(JSON.stringify(data));
break;
case 'getCheckLength':
var data = checkStatus.data;
layer.msg('选中了:'+ data.length + ' 个');
break;
case 'getData':
var getData = table.getData(obj.config.id);
console.log(getData);
layer.alert(JSON.stringify(getData));
break;
case 'isAll':
layer.msg(checkStatus.isAll ? '全选': '未全选')
break;
case 'LAYTABLE_TIPS':
layer.alert('Table for layui-v'+ layui.v);
break;
case 'reload':
//深度重载
var instReload = table.reload('test', {
where: {
abc: 123
,test: '新的 test1'
}
,page: {curr: 5, limit: 20}
,cols: ins1.config.cols
//,height: 300
//,url: 'x'
}, true);
break;
case 'reload2':
//浅重载
table.reload('test', {
where: {
efg: 'sasasas'
//,test: '新的 test2'
//,token: '新的 token2'
}
,cols: [[
{type: 'checkbox', fixed: 'left'}
,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true, totalRowText: '合计:'}
,{field:'sex', title:'性别', width:80, edit: 'text', sort: true}
,{field:'experience', title:'积分', width:80, sort: true, totalRow: true, templet: '<div>{{ d.experience }} 分</div>'}
,{field:'logins', title:'登入次数', width:100, sort: true, totalRow: true}
,{field:'joinTime', title:'加入时间', width:120}
]]
//,height: 500
});
break;
};
});
table.on('row(test)', function(obj){
console.log(obj);
//layer.closeAll('tips');
});
});
</script>
</body>
</html>

@ -3,15 +3,15 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>表格操作 - layui</title> <title>表格操作 - layui</title>
<link rel="stylesheet" href="../src/css/layui.css"> <link rel="stylesheet" href="../src/css/layui.css">
<style> <style>
body{padding: 20px; /*overflow-y: scroll;*/} body{padding: 20px; /*overflow-y: scroll;*/}
</style> </style>
</head> </head>
<body> <body>
@ -23,11 +23,28 @@ body{padding: 20px; /*overflow-y: scroll;*/}
<button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button> <button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button>
<button class="layui-btn layui-btn-sm" lay-event="reload">重载(保留初始参数)</button> <button class="layui-btn layui-btn-sm" lay-event="reload">重载(保留初始参数)</button>
<button class="layui-btn layui-btn-sm" lay-event="reload2">重载(不保留初始参数)</button> <button class="layui-btn layui-btn-sm" lay-event="reload2">重载(不保留初始参数)</button>
<button class="layui-btn layui-btn-sm" id="dropdown">
更多菜单
<i class="layui-icon layui-icon-down layui-font-12"></i>
</button>
</div> </div>
</script> </script>
<table id="test" lay-filter="test"></table> <table id="test" lay-filter="test"></table>
<div id="appendtest"></div>
<script type="text/html" id="TPL_appendtest">
<table class="layui-table" lay-data="{url:'json/table/demo2.json', page: true, limit: 6}" lay-filter="appendtest">
<thead>
<tr>
<th lay-data="{checkbox:true, fixed:'left'}" rowspan="2"></th>
<th lay-data="{field:'username', width:80}" rowspan="2">联系人</th>
<th lay-data="{field:'amount', width:120}" rowspan="2">金额</th>
</tr>
</thead>
</table>
</script>
<script type="text/html" id="barDemo"> <script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a> <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
@ -60,7 +77,7 @@ body{padding: 20px; /*overflow-y: scroll;*/}
<table id="test2" lay-filter="test2"></table> <table id="test2" lay-filter="test2"></table>
<div style="display: none1;"> <div style="display: none1;">
<table class="layui-table1" lay-data="{width:800, height: 300, url:'json/table/demo2.json', page: true, limit: 6}"> <table class="layui-table" lay-data="{width:800, height: 300, url:'json/table/demo2.json', page: true, limit: 6}">
<thead> <thead>
<tr> <tr>
<th lay-data="{checkbox:true, fixed:'left'}" rowspan="2"></th> <th lay-data="{checkbox:true, fixed:'left'}" rowspan="2"></th>
@ -77,7 +94,7 @@ body{padding: 20px; /*overflow-y: scroll;*/}
</thead> </thead>
</table> </table>
<table class="layui-table" lay-data="{url:'json/table/demo2.json', toolbar: '#toolbarDemo', page: true, limit: 6}"> <table class="layui-table" lay-data="{url:'json/table/demo2.json', page: true, limit: 6}">
<thead> <thead>
<tr> <tr>
<th lay-data="{field:'username'}" rowspan="3">联系人</th> <th lay-data="{field:'username'}" rowspan="3">联系人</th>
@ -181,8 +198,11 @@ body{padding: 20px; /*overflow-y: scroll;*/}
<script src="../src/layui.js" src1="//www.layuicdn.com/layui-v2.0.1/layui.js" charset="utf-8"></script> <script src="../src/layui.js" src1="//www.layuicdn.com/layui-v2.0.1/layui.js" charset="utf-8"></script>
<script> <script>
layui.use('table', function(){ layui.use(['table', 'dropdown'], function(){
var table = layui.table; var table = layui.table
,$ = layui.$
,laytpl = layui.laytpl
,dropdown = layui.dropdown;
//全局设定某参数 //全局设定某参数
table.set({ table.set({
@ -195,6 +215,9 @@ layui.use('table', function(){
//,height: 300 //,height: 300
}); });
$('#appendtest').append($('#TPL_appendtest').html())
table.init('appendtest');
//渲染 //渲染
window.ins1 = table.render({ window.ins1 = table.render({
elem: '#test' elem: '#test'
@ -222,6 +245,7 @@ layui.use('table', function(){
,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true, totalRowText: '合计:'} ,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true, totalRowText: '合计:'}
,{field:'username', title:'用户名', width:120, edit: 'text', templet: '#usernameTpl'} ,{field:'username', title:'用户名', width:120, edit: 'text', templet: '#usernameTpl'}
,{field:'email', title:'邮箱', hide: 0, width:150, edit: 'text', templet: function(d){ ,{field:'email', title:'邮箱', hide: 0, width:150, edit: 'text', templet: function(d){
console.log(d);
return '<em>'+ d.email +'</em>' return '<em>'+ d.email +'</em>'
}} }}
,{field:'sex', title:'性别', width:80, edit: 'text', sort: true} ,{field:'sex', title:'性别', width:80, edit: 'text', sort: true}
@ -247,6 +271,21 @@ layui.use('table', function(){
,order: 'asc' ,order: 'asc'
} }
,done: function(){
//下拉菜单
dropdown.render({
elem: '#dropdown' //可绑定在任意元素中,此处以上述按钮为例
,data: [{
id: 0,
title: '刷新'
}]
//菜单被点击的事件
,click: function(obj){
table.reload('test');
}
});
}
,error: function(res, msg){ ,error: function(res, msg){
console.log(res, msg) console.log(res, msg)
} }

@ -1,7 +1,7 @@
{ {
"name": "layui", "name": "layui",
"realname": "layui", "realname": "layui",
"version": "2.6.4", "version": "2.6.5",
"description": "Classic modular front-end component library", "description": "Classic modular front-end component library",
"main": "dist/layui.js", "main": "dist/layui.js",
"license": "MIT", "license": "MIT",

@ -144,16 +144,15 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;}
.layui-layer-tabmain .layui-layer-tabli.layui-this{display: block;} .layui-layer-tabmain .layui-layer-tabli.layui-this{display: block;}
/* photo模式 */ /* photo模式 */
.layui-layer-photos{-webkit-animation-duration: .8s; animation-duration: .8s;} .layui-layer-photos{background: none; box-shadow: none;}
.layui-layer-photos .layui-layer-content{overflow:hidden; text-align: center;} .layui-layer-photos .layui-layer-content{overflow:hidden; text-align: center;}
.layui-layer-photos .layui-layer-phimg img{position: relative; width:100%; display: inline-block; *display:inline; *zoom:1; vertical-align:top;} .layui-layer-photos .layui-layer-phimg img{position: relative; width:100%; display: inline-block; *display:inline; *zoom:1; vertical-align:top;}
.layui-layer-imguide,.layui-layer-imgbar{display:none;} .layui-layer-imgprev, .layui-layer-imgnext{position: fixed; top: 50%; width: 27px; _width: 44px; height: 44px; margin-top:-22px; outline:none;blr:expression(this.onFocus=this.blur());}
.layui-layer-imgprev, .layui-layer-imgnext{position:absolute; top:50%; width:27px; _width:44px; height:44px; margin-top:-22px; outline:none;blr:expression(this.onFocus=this.blur());} .layui-layer-imgprev{left: 30px; background-position:-5px -5px; _background-position:-70px -5px;}
.layui-layer-imgprev{left:10px; background-position:-5px -5px; _background-position:-70px -5px;}
.layui-layer-imgprev:hover{background-position:-33px -5px; _background-position:-120px -5px;} .layui-layer-imgprev:hover{background-position:-33px -5px; _background-position:-120px -5px;}
.layui-layer-imgnext{right:10px; _right:8px; background-position:-5px -50px; _background-position:-70px -50px;} .layui-layer-imgnext{right: 30px; _right:8px; background-position:-5px -50px; _background-position:-70px -50px;}
.layui-layer-imgnext:hover{background-position:-33px -50px; _background-position:-120px -50px;} .layui-layer-imgnext:hover{background-position: -33px -50px; _background-position: -120px -50px;}
.layui-layer-imgbar{position:absolute; left:0; bottom:0; width:100%; height:32px; line-height:32px; background-color:rgba(0,0,0,.8); background-color:#000\9; filter:Alpha(opacity=80); color:#fff; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size:0;} .layui-layer-imgbar{position: fixed; left:0; right: 0; bottom:0; width:100%; height: 40px; line-height: 40px; background-color:#000\9; filter:Alpha(opacity=60); background-color: rgba(2,0,0,.35); color: #fff; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size:0;}
.layui-layer-imgtit{/*position:absolute; left:20px;*/} .layui-layer-imgtit{/*position:absolute; left:20px;*/}
.layui-layer-imgtit *{display:inline-block; *display:inline; *zoom:1; vertical-align:top; font-size:12px;} .layui-layer-imgtit *{display:inline-block; *display:inline; *zoom:1; vertical-align:top; font-size:12px;}
.layui-layer-imgtit a{max-width:65%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; color:#fff;} .layui-layer-imgtit a{max-width:65%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; color:#fff;}

@ -17,7 +17,7 @@
} }
,Layui = function(){ ,Layui = function(){
this.v = '2.6.4'; //版本号 this.v = '2.6.5'; //版本号
} }
//获取layui所在目录 //获取layui所在目录
@ -34,7 +34,8 @@
} }
return src || js[last].src; return src || js[last].src;
}(); }();
return jsPath.substring(0, jsPath.lastIndexOf('/') + 1);
return config.dir = jsPath.substring(0, jsPath.lastIndexOf('/') + 1);
}() }()
//异常提示 //异常提示
@ -239,13 +240,14 @@
//css外部加载器 //css外部加载器
Layui.prototype.link = function(href, fn, cssname){ Layui.prototype.link = function(href, fn, cssname){
var that = this var that = this
,link = doc.createElement('link') ,head = doc.getElementsByTagName('head')[0]
,head = doc.getElementsByTagName('head')[0]; ,link = doc.createElement('link');
if(typeof fn === 'string') cssname = fn; if(typeof fn === 'string') cssname = fn;
var app = (cssname || href).replace(/\.|\//g, '') var app = (cssname || href).replace(/\.|\//g, '')
,id = link.id = 'layuicss-'+ app ,id = link.id = 'layuicss-'+ app
,STAUTS_NAME = 'creating'
,timeout = 0; ,timeout = 0;
link.rel = 'stylesheet'; link.rel = 'stylesheet';
@ -255,10 +257,35 @@
if(!doc.getElementById(id)){ if(!doc.getElementById(id)){
head.appendChild(link); head.appendChild(link);
} }
if(typeof fn !== 'function') return that; if(typeof fn !== 'function') return that;
//轮询 css 是否加载完毕
(function poll(status) {
var delay = 100
,getLinkElem = doc.getElementById(id); //获取动态插入的 link 元素
//如果轮询超过指定秒数,则视为请求文件失败或 css 文件不符合规范
if(++timeout > config.timeout * 1000 / delay){
return error(href + ' timeout');
};
//css 加载就绪
if(parseInt(that.getStyle(getLinkElem, 'width')) === 1989){
//如果参数来自于初始轮询(即未加载就绪时的),则移除 link 标签状态
if(status === STAUTS_NAME) getLinkElem.removeAttribute('lay-status');
//如果 link 标签的状态仍为「创建中」,则继续进入轮询,直到状态改变,则执行回调
getLinkElem.getAttribute('lay-status') === STAUTS_NAME ? setTimeout(poll, delay) : fn();
} else {
getLinkElem.setAttribute('lay-status', STAUTS_NAME);
setTimeout(function(){
poll(STAUTS_NAME);
}, delay);
}
}());
//轮询css是否加载完毕 //轮询css是否加载完毕
/*
(function poll() { (function poll() {
if(++timeout > config.timeout * 1000 / 100){ if(++timeout > config.timeout * 1000 / 100){
return error(href + ' timeout'); return error(href + ' timeout');
@ -267,10 +294,16 @@
fn(); fn();
}() : setTimeout(poll, 100); }() : setTimeout(poll, 100);
}()); }());
*/
return that; return that;
}; };
//css 内部加载器
Layui.prototype.addcss = function(firename, fn, cssname){
return layui.link(config.dir + 'css/' + firename, fn, cssname);
};
//存储模块的回调 //存储模块的回调
config.callback = {}; config.callback = {};
@ -283,11 +316,6 @@
} }
}; };
//css内部加载器
Layui.prototype.addcss = function(firename, fn, cssname){
return layui.link(config.dir + 'css/' + firename, fn, cssname);
};
//图片预加载 //图片预加载
Layui.prototype.img = function(url, callback, error) { Layui.prototype.img = function(url, callback, error) {
var img = new Image(); var img = new Image();

@ -56,5 +56,5 @@ layui.define('jquery', function(exports){
}); });
}); });
}).addcss('modules/code.css?v=1', 'skincodecss'); }).addcss('modules/code.css?v=2', 'skincodecss');

@ -116,20 +116,22 @@ layui.define('layer', function(exports){
,field = {} ,field = {}
,fieldElem = itemForm.find('input,select,textarea') //获取所有表单域 ,fieldElem = itemForm.find('input,select,textarea') //获取所有表单域
layui.each(fieldElem, function(_, item){ layui.each(fieldElem, function(_, item){
item.name = (item.name || '').replace(/^\s*|\s*&/, ''); var othis = $(this)
,init_name; //初始 name
item.name = (item.name || '').replace(/^\s*|\s*&/, '');
if(!item.name) return; if(!item.name) return;
//用于支持数组 name //用于支持数组 name
if(/^.*\[\]$/.test(item.name)){ if(/^.*\[\]$/.test(item.name)){
var key = item.name.match(/^(.*)\[\]$/g)[0]; var key = item.name.match(/^(.*)\[\]$/g)[0];
nameIndex[key] = nameIndex[key] | 0; nameIndex[key] = nameIndex[key] | 0;
item.name = item.name.replace(/^(.*)\[\]$/, '$1['+ (nameIndex[key]++) +']'); init_name = item.name.replace(/^(.*)\[\]$/, '$1['+ (nameIndex[key]++) +']');
} }
if(/^checkbox|radio$/.test(item.type) && !item.checked) return; if(/^checkbox|radio$/.test(item.type) && !item.checked) return; //复选框和单选框未选中,不记录字段
field[item.name] = item.value; field[init_name || item.name] = item.value;
}); });
return field; return field;

@ -136,10 +136,17 @@
//载入 CSS 依赖 //载入 CSS 依赖
lay.link = function(href, fn, cssname){ lay.link = function(href, fn, cssname){
var head = document.getElementsByTagName("head")[0], link = document.createElement('link'); var head = document.getElementsByTagName("head")[0]
,link = document.createElement('link');
if(typeof fn === 'string') cssname = fn; if(typeof fn === 'string') cssname = fn;
var app = (cssname || href).replace(/\.|\//g, ''); var app = (cssname || href).replace(/\.|\//g, '');
var id = 'layuicss-'+ app, timeout = 0; var id = 'layuicss-'+ app
,STAUTS_NAME = 'creating'
,timeout = 0;
link.rel = 'stylesheet'; link.rel = 'stylesheet';
link.href = href; link.href = href;
@ -148,15 +155,31 @@
if(!document.getElementById(id)){ if(!document.getElementById(id)){
head.appendChild(link); head.appendChild(link);
} }
if(typeof fn !== 'function') return; if(typeof fn !== 'function') return;
//轮询css是否加载完毕 //轮询 css 是否加载完毕
(function poll() { (function poll(status) {
if(++timeout > 8 * 1000 / 100){ var delay = 100
return window.console && console.error(app + '.css: Invalid'); ,getLinkElem = document.getElementById(id); //获取动态插入的 link 元素
//如果轮询超过指定秒数,则视为请求文件失败或 css 文件不符合规范
if(++timeout > 10 * 1000 / delay){
return window.console && console.error(app +'.css: Invalid');
}; };
parseInt(lay.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 100);
//css 加载就绪
if(parseInt(lay.getStyle(getLinkElem, 'width')) === 1989){
//如果参数来自于初始轮询(即未加载就绪时的),则移除 link 标签状态
if(status === STAUTS_NAME) getLinkElem.removeAttribute('lay-status');
//如果 link 标签的状态仍为「创建中」,则继续进入轮询,直到状态改变,则执行回调
getLinkElem.getAttribute('lay-status') === STAUTS_NAME ? setTimeout(poll, delay) : fn();
} else {
getLinkElem.setAttribute('lay-status', STAUTS_NAME);
setTimeout(function(){
poll(STAUTS_NAME);
}, delay);
}
}()); }());
}; };

@ -39,14 +39,18 @@ var isLayui = window.layui && layui.define, $, win, ready = {
//载入 CSS 依赖 //载入 CSS 依赖
link: function(href, fn, cssname){ link: function(href, fn, cssname){
//未设置路径则不主动加载css //未设置路径则不主动加载css
if(!layer.path) return; if(!layer.path) return;
var head = document.getElementsByTagName("head")[0], link = document.createElement('link'); var head = document.getElementsByTagName("head")[0]
,link = document.createElement('link');
if(typeof fn === 'string') cssname = fn; if(typeof fn === 'string') cssname = fn;
var app = (cssname || href).replace(/\.|\//g, ''); var app = (cssname || href).replace(/\.|\//g, '');
var id = 'layuicss-'+ app, timeout = 0; var id = 'layuicss-'+ app
,STAUTS_NAME = 'creating'
,timeout = 0;
link.rel = 'stylesheet'; link.rel = 'stylesheet';
link.href = layer.path + href; link.href = layer.path + href;
@ -55,22 +59,41 @@ var isLayui = window.layui && layui.define, $, win, ready = {
if(!document.getElementById(id)){ if(!document.getElementById(id)){
head.appendChild(link); head.appendChild(link);
} }
if(typeof fn !== 'function') return; if(typeof fn !== 'function') return;
//轮询css是否加载完毕 //轮询 css 是否加载完毕
(function poll() { (function poll(status) {
if(++timeout > 8 * 1000 / 100){ var delay = 100
return window.console && console.error('layer.css: Invalid'); ,getLinkElem = document.getElementById(id); //获取动态插入的 link 元素
//如果轮询超过指定秒数,则视为请求文件失败或 css 文件不符合规范
if(++timeout > 10 * 1000 / delay){
return window.console && console.error(app +'.css: Invalid');
}; };
parseInt(ready.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 100);
//css 加载就绪
if(parseInt(ready.getStyle(getLinkElem, 'width')) === 1989){
//如果参数来自于初始轮询(即未加载就绪时的),则移除 link 标签状态
if(status === STAUTS_NAME) getLinkElem.removeAttribute('lay-status');
//如果 link 标签的状态仍为「创建中」,则继续进入轮询,直到状态改变,则执行回调
getLinkElem.getAttribute('lay-status') === STAUTS_NAME ? setTimeout(poll, delay) : fn();
} else {
getLinkElem.setAttribute('lay-status', STAUTS_NAME);
setTimeout(function(){
poll(STAUTS_NAME);
}, delay);
}
//parseInt(ready.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 1000);
}()); }());
} }
}; };
//默认内置方法。 //默认内置方法。
var layer = { var layer = {
v: '3.3.0', v: '3.4.0',
ie: function(){ //ie版本 ie: function(){ //ie版本
var agent = navigator.userAgent.toLowerCase(); var agent = navigator.userAgent.toLowerCase();
return (!!window.ActiveXObject || "ActiveXObject" in window) ? ( return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
@ -346,7 +369,7 @@ Class.pt.creat = function(){
} }
config.time <= 0 || setTimeout(function(){ config.time <= 0 || setTimeout(function(){
layer.close(that.index) layer.close(that.index);
}, config.time); }, config.time);
that.move().callback(); that.move().callback();
@ -904,7 +927,7 @@ layer.title = function(name, index){
}; };
//关闭layer总方法 //关闭layer总方法
layer.close = function(index){ layer.close = function(index, callback){
layer.ready(function(){ layer.ready(function(){
var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close'; var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close';
if(!layero[0]) return; if(!layero[0]) return;
@ -931,6 +954,7 @@ layer.close = function(index){
} }
typeof ready.end[index] === 'function' && ready.end[index](); typeof ready.end[index] === 'function' && ready.end[index]();
delete ready.end[index]; delete ready.end[index];
typeof callback === 'function' && callback();
}; };
if(layero.data('isOutAnim')){ if(layero.data('isOutAnim')){
@ -956,20 +980,26 @@ layer.close = function(index){
}; };
//关闭所有层 //关闭所有层
layer.closeAll = function(type){ layer.closeAll = function(type, callback){
if(typeof type === 'function'){
callback = type;
type = null;
};
layer.ready(function(){ layer.ready(function(){
$.each($('.'+doms[0]), function(){ var domsElem = $('.'+doms[0]);
$.each(domsElem, function(_index){
var othis = $(this); var othis = $(this);
var is = type ? (othis.attr('type') === type) : 1; var is = type ? (othis.attr('type') === type) : 1;
is && layer.close(othis.attr('times')); is && layer.close(othis.attr('times'), _index === domsElem.length - 1 ? callback : null);
is = null; is = null;
}); });
if(domsElem.length === 0) typeof callback === 'function' && callback();
}); });
}; };
/** /**
拓展模块layui开始合并在一起 拓展模块layui 开始合并在一起
*/ */
@ -1097,7 +1127,7 @@ layer.photos = function(options, loop, key){
src: othis.attr('layer-src') || othis.attr('src'), src: othis.attr('layer-src') || othis.attr('src'),
thumb: othis.attr('src') thumb: othis.attr('src')
}); });
}) });
}; };
pushData(); pushData();
@ -1105,6 +1135,7 @@ layer.photos = function(options, loop, key){
if (data.length === 0) return; if (data.length === 0) return;
loop || parent.on('click', options.img, function(){ loop || parent.on('click', options.img, function(){
pushData();
var othis = $(this), index = othis.attr('layer-index'); var othis = $(this), index = othis.attr('layer-index');
layer.photos($.extend(options, { layer.photos($.extend(options, {
photos: { photos: {
@ -1114,8 +1145,7 @@ layer.photos = function(options, loop, key){
}, },
full: options.full full: options.full
}), true); }), true);
pushData(); });
})
//不直接弹出 //不直接弹出
if(!loop) return; if(!loop) return;
@ -1171,20 +1201,22 @@ layer.photos = function(options, loop, key){
//一些动作 //一些动作
dict.event = function(){ dict.event = function(){
/*
dict.bigimg.hover(function(){ dict.bigimg.hover(function(){
dict.imgsee.show(); dict.imgsee.show();
}, function(){ }, function(){
dict.imgsee.hide(); dict.imgsee.hide();
}); });
*/
dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){ dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){
event.preventDefault(); event.preventDefault();
dict.imgprev(); dict.imgprev(true);
}); });
dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){ dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){
event.preventDefault(); event.preventDefault();
dict.imgnext(); dict.imgnext(true);
}); });
$(document).on('keyup', dict.keyup); $(document).on('keyup', dict.keyup);
@ -1214,6 +1246,11 @@ layer.photos = function(options, loop, key){
loadImage(data[start].src, function(img){ loadImage(data[start].src, function(img){
layer.close(dict.loadi); layer.close(dict.loadi);
//切换图片时不出现动画
if(key) options.anim = -1;
//弹出图片层
dict.index = layer.open($.extend({ dict.index = layer.open($.extend({
type: 1, type: 1,
id: 'layui-layer-photos', id: 'layui-layer-photos',
@ -1243,19 +1280,24 @@ layer.photos = function(options, loop, key){
moveType: 1, moveType: 1,
scrollbar: false, scrollbar: false,
moveOut: true, moveOut: true,
//anim: Math.random()*5|0, anim: 5,
isOutAnim: false, isOutAnim: false,
skin: 'layui-layer-photos' + skin('photos'), skin: 'layui-layer-photos' + skin('photos'),
content: '<div class="layui-layer-phimg">' content: '<div class="layui-layer-phimg">'
+'<img src="'+ data[start].src +'" alt="'+ (data[start].alt||'') +'" layer-pid="'+ data[start].pid +'">' +'<img src="'+ data[start].src +'" alt="'+ (data[start].alt||'') +'" layer-pid="'+ data[start].pid +'">'
+'<div class="layui-layer-imgsee">' +function(){
+(data.length > 1 ? '<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>' : '') if(data.length > 1){
+'<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="javascript:;">'+ (data[start].alt||'') +'</a><em>'+ dict.imgIndex +'/'+ data.length +'</em></span></div>' return '<div class="layui-layer-imgsee">'
+'</div>' +'<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>'
+'<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="javascript:;">'+ (data[start].alt || '') +'</a><em>'+ dict.imgIndex +' / '+ data.length +'</em></span></div>'
+'</div>'
}
return '';
}()
+'</div>', +'</div>',
success: function(layero, index){ success: function(layero, index){
dict.bigimg = layero.find('.layui-layer-phimg'); dict.bigimg = layero.find('.layui-layer-phimg');
dict.imgsee = layero.find('.layui-layer-imguide,.layui-layer-imgbar'); dict.imgsee = layero.find('.layui-layer-imgbar');
dict.event(layero); dict.event(layero);
options.tab && options.tab(data[start], layero); options.tab && options.tab(data[start], layero);
typeof success === 'function' && success(layero); typeof success === 'function' && success(layero);
@ -1290,7 +1332,7 @@ ready.run = function(_$){
//加载方式 //加载方式
window.layui && layui.define ? ( window.layui && layui.define ? (
layer.ready() layer.ready()
,layui.define('jquery', function(exports){ //layui加载 ,layui.define('jquery', function(exports){ //layui 加载
layer.path = layui.cache.dir; layer.path = layui.cache.dir;
ready.run(layui.$); ready.run(layui.$);
@ -1299,13 +1341,16 @@ window.layui && layui.define ? (
exports('layer', layer); exports('layer', layer);
}) })
) : ( ) : (
(typeof define === 'function' && define.amd) ? define(['jquery'], function(){ //requirejs加载 (typeof define === 'function' && define.amd) ? define(['jquery'], function(){ //requirejs 加载
ready.run(window.jQuery); ready.run(window.jQuery);
return layer; return layer;
}) : function(){ //普通script标签加载 }) : function(){ //普通 script 标签加载
ready.run(window.jQuery);
layer.ready(); layer.ready();
ready.run(window.jQuery);
}() }()
); );
}(window); }(window);

@ -67,7 +67,7 @@ layui.define(function(exports){
//匹配JS规则内容 //匹配JS规则内容
.replace(/(?="|')/g, '\\').replace(tool.query(), function(str){ .replace(/(?="|')/g, '\\').replace(tool.query(), function(str){
str = str.replace(jss, '').replace(jsse, ''); str = str.replace(jss, '').replace(jsse, '');
return '";' + str.replace(/\\/g, '') + ';view+="'; return '";' + str.replace(/\\(.)/g, '$1') + ';view+="';
}) })
//匹配普通字段 //匹配普通字段
@ -81,7 +81,7 @@ layui.define(function(exports){
str = str.replace(/^=/, ''); str = str.replace(/^=/, '');
start = '"+_escape_('; start = '"+_escape_(';
} }
return start + str.replace(/\\/g, '') + ')+"'; return start + str.replace(/\\(.)/g, '$1') + ')+"';
}); });
tpl = '"use strict";var view = "' + tpl + '";return view;'; tpl = '"use strict";var view = "' + tpl + '";return view;';

@ -777,7 +777,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
var thisCheckedRowIndex; var thisCheckedRowIndex;
if(!sort && that.sortKey){ if(!sort && that.sortKey){
return that.sort(that.sortKey.field, that.sortKey.sort, true); return that.sort(that.sortKey.field, that.sortKey.sort, true);
} }
layui.each(data, function(i1, item1){ layui.each(data, function(i1, item1){
var tds = [], tds_fixed = [], tds_fixed_r = [] var tds = [], tds_fixed = [], tds_fixed_r = []
,numbers = i1 + options.limit*(curr - 1) + 1; //序号 ,numbers = i1 + options.limit*(curr - 1) + 1; //序号
@ -795,7 +795,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
if(content === undefined || content === null) content = ''; if(content === undefined || content === null) content = '';
if(item3.colGroup) return; if(item3.colGroup) return;
//td内容 //td内容
var td = ['<td data-field="'+ field +'" data-key="'+ key +'" '+ function(){ //追加各种属性 var td = ['<td data-field="'+ field +'" data-key="'+ key +'" '+ function(){ //追加各种属性
var attr = []; var attr = [];
@ -967,17 +967,16 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
var content = function(){ var content = function(){
var text = item3.totalRowText || '' var text = item3.totalRowText || ''
,thisTotalNum = parseFloat(totalNums[field]).toFixed(2) ,thisTotalNum = parseFloat(totalNums[field]).toFixed(2)
,tplData = {}; ,tplData = {}
,getContent;
tplData[field] = thisTotalNum; tplData[field] = thisTotalNum;
thisTotalNum = parseTempData(item3, thisTotalNum, tplData);
//获取自动计算的合并内容
getContent = item3.totalRow ? (parseTempData(item3, thisTotalNum, tplData) || text) : text;
//如果直接传入了合计行数据,则不输出自动计算的结果 //如果直接传入了合计行数据,则不输出自动计算的结果
if(totalRowData){ return totalRowData ? (totalRowData[item3.field] || getContent) : getContent;
return totalRowData[item3.field] || text;
} else {
return item3.totalRow ? (thisTotalNum || text) : text;
}
}() }()
,td = ['<td data-field="'+ field +'" data-key="'+ options.index + '-'+ item3.key +'" '+ function(){ ,td = ['<td data-field="'+ field +'" data-key="'+ options.index + '-'+ item3.key +'" '+ function(){
var attr = []; var attr = [];
@ -2017,7 +2016,9 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
}; };
//自动完成渲染 //自动完成渲染
table.init(); $(function(){
table.init();
});
exports(MOD_NAME, table); exports(MOD_NAME, table);
}); });

@ -234,7 +234,7 @@ layui.define('layer' , function(exports){
xhr.upload.addEventListener("progress", function (e) { xhr.upload.addEventListener("progress", function (e) {
if(e.lengthComputable) { if(e.lengthComputable) {
var percent = Math.floor((e.loaded/e.total)* 100); //百分比 var percent = Math.floor((e.loaded/e.total)* 100); //百分比
options.progress(percent, options.item[0], e); options.progress(percent, (options.item ? options.item[0] : options.elem[0]) , e);
} }
}); });
return xhr; return xhr;

Loading…
Cancel
Save