mirror of https://github.com/layui/layui
Merge branch 'main' into 2.x
commit
65179897c4
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -302,6 +302,20 @@ click: function(data, othis){
|
|||
|
||||
用法详见:[#示例](#examples)
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>close <sup>2.9.7+</sup></td>
|
||||
<td colspan="3">
|
||||
|
||||
面板关闭后的回调函数。返回的参数如下:
|
||||
|
||||
```
|
||||
close: function(elem){
|
||||
console.log(elem); // 当前组件绑定的目标元素对象
|
||||
}
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
@ -103,6 +103,18 @@ layui.each(data, function(index, item){
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>direction <sup>2.9.7+</sup></td>
|
||||
<td>
|
||||
|
||||
指定触发加载的方向,可选值:
|
||||
- `bottom` 滚动容器底部触发加载
|
||||
- `top` 滚动容器顶部触发加载
|
||||
|
||||
</td>
|
||||
<td>string</td>
|
||||
<td>'bottom'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>done</td>
|
||||
<td colspan="3">
|
||||
|
||||
|
|
|
@ -117,6 +117,7 @@ form 还可以借助*栅格*实现更灵活的响应式布局。
|
|||
| lay-affix | [#详见](input.html#affix) | 输入框动态点缀,`<input type="text">`元素 **私有属性** |
|
||||
| lay-skin | [#详见](checkbox.html#default) | 设置 UI 风格。 `<input type="checkbox">` 元素 **私有属性** |
|
||||
| lay-search | 默认不区分大小写;<br>设置`cs`区分大小写 | 给 `select` 组件开启搜索功能。`<select>` 元素 **私有属性** |
|
||||
| lay-creatable <sup>2.9.7+</sup> | 无需值 | 是否允许创建新条目,需要配合 `lay-search` 使用。`<select>` 元素 **私有属性** } |
|
||||
| lay-submit | 无需值 | 设置元素(一般为`<button>` 标签)触发 `submit` 提交事件 |
|
||||
| lay-ignore | 无需值 | 设置表单元素忽略渲染,即让元素保留系统原始 UI 风格 |
|
||||
|
||||
|
|
|
@ -161,6 +161,18 @@ toc: true
|
|||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-col-md6">
|
||||
<select lay-search="" lay-creatable="">
|
||||
<option value="">可创建新的 option</option>
|
||||
<option value="1">AAA</option>
|
||||
<option value="2">aaa</option>
|
||||
<option value="3">BBB</option>
|
||||
<option value="4">bbb</option>
|
||||
<option value="5">ABC</option>
|
||||
<option value="6">abc</option>
|
||||
<option value="7">AbC</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- import layui -->
|
||||
|
|
|
@ -398,6 +398,7 @@ layer.closeLast('page'); // 关闭最近一次打开的页面层
|
|||
layer.closeLast('iframe'); // 关闭最近一次打开的 iframe 层
|
||||
layer.closeLast('loading'); // 关闭最近一次打开的加载层
|
||||
layer.closeLast('tips'); // 关闭最近一次打开的 tips 层
|
||||
layer.closeLast(['dialog', 'page']); // 关闭最近一次打开的信息框或页面层,2.9.7+
|
||||
```
|
||||
|
||||
<h2 id="config" lay-pid="api" class="ws-anchor ws-bold">全局配置默认属性</h2>
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
开启表格头部工具栏。支持以下几种值写法:
|
||||
|
||||
- `toolbar: '#template-id'` 自定义工具栏模板选择器
|
||||
- `toolbar: '<div>xxx</div>` 直接传入模板字符
|
||||
- `toolbar: '<div>xxx</div>'` 直接传入模板字符
|
||||
- `toolbar: true` 仅开启工具栏右侧,不显示左侧模板
|
||||
- `toolbar: 'default'` 开启工具栏并显示默认模板
|
||||
|
||||
|
|
|
@ -9,9 +9,36 @@ toc: true
|
|||
|
||||
<h2 id="2.9.x" lay-toc="{title: '2.9.x'}"></h2>
|
||||
|
||||
|
||||
<h2 id="v2.9.7" class="ws-anchor">
|
||||
v2.9.7
|
||||
<!-- <span class="layui-badge-rim" style="color: #16b777;">稳定版</span> -->
|
||||
<span class="layui-badge-rim">2024-02-28</span>
|
||||
</h2>
|
||||
|
||||
- #### select
|
||||
- 新增 `lay-creatable` 属性,用于在开启搜索时允许创建新选项 #1618 @Sight-wcg
|
||||
- #### table
|
||||
- 修复 禁止拖拽列宽后仍可拖拽的问题 #1591 @Sight-wcg
|
||||
- #### layer
|
||||
- 新增 遮罩层添加过渡效果 #1616 @Sight-wcg
|
||||
- 修复 弹出高度设置为 `auto` 时,恢复大小时内容区高度错误 #1617 @Sight-wcg
|
||||
- 优化 最大/小化再恢复大小后宽高偶现细微差异的问题 #1653 @Sight-wcg
|
||||
- #### laydate
|
||||
- 新增时间选择器根据 `format` 格式进行显隐支持 #1656 @Sight-wcg
|
||||
- #### dropdown
|
||||
- 新增 close 选项,用于下拉面板被关闭后触发的回调函数 #1605 @Sight-wcg
|
||||
- #### flow
|
||||
- 新增 direction 选项,用于设置触发加载的方向 #1638 @Sight-wcg
|
||||
- #### 其他
|
||||
- 修改 源码 Unicode 编码转换为中文字符 #1600 @Sight-wcg
|
||||
|
||||
### 下载: [layui-v2.9.7.zip](https://gitee.com/layui/layui/attach_files/1685481/download)
|
||||
|
||||
---
|
||||
|
||||
<h2 id="v2.9.6" class="ws-anchor">
|
||||
v2.9.6
|
||||
<!-- <span class="layui-badge-rim" style="color: #16b777;">稳定版</span> -->
|
||||
<span class="layui-badge-rim">2024-01-24</span>
|
||||
</h2>
|
||||
|
||||
|
|
|
@ -37,225 +37,286 @@
|
|||
|
||||
<script src="../src/layui.js"></script>
|
||||
<script>
|
||||
layui.use('dropdown', function(){
|
||||
layui.use('dropdown', function () {
|
||||
var dropdown = layui.dropdown;
|
||||
|
||||
dropdown.render({
|
||||
elem: '#demo1'
|
||||
,shade: [0.1, '#ddd']
|
||||
elem: '#demo1',
|
||||
shade: [0.1, '#ddd'],
|
||||
//,align: 'right'
|
||||
,data: [{
|
||||
title: 'menu item 1'
|
||||
,templet: '<i class="layui-icon layui-icon-light"></i> {{= d.title }} <span class="layui-badge-dot"></span>'
|
||||
,id: ''
|
||||
,href: ''
|
||||
,type: '' //菜单类型,支持:normal/group/parent
|
||||
},{
|
||||
title: 'menu item <strong>2</strong>'
|
||||
,templet: '<img src="https://unpkg.com/outeres@0.1.1/demo/avatar/0.png" style="width: 16px;"> {{- d.title }}'
|
||||
,id: ''
|
||||
,href: 'https://www.layui.com/'
|
||||
,target: '_blank'
|
||||
},{type: '-'},{},{
|
||||
title: 'menu item 3 <hello>'
|
||||
,id: ''
|
||||
,type: 'group'
|
||||
,child: [{
|
||||
title: 'menu item 3-1'
|
||||
,id: ''
|
||||
},{
|
||||
title: 'menu item 3-2'
|
||||
,id: ''
|
||||
,child: [{
|
||||
title: 'menu item 3-2-1'
|
||||
,id: ''
|
||||
},{
|
||||
title: 'menu item 3-2-2'
|
||||
,id: ''
|
||||
,type: 'group'
|
||||
,child: [{
|
||||
title: 'menu item 3-2-2-1'
|
||||
,id: ''
|
||||
},{
|
||||
title: 'menu item 3-2-2-2'
|
||||
,id: ''
|
||||
}]
|
||||
},{
|
||||
title: 'menu item 3-2-3'
|
||||
,id: ''
|
||||
}]
|
||||
},{
|
||||
title: 'menu item 3-3'
|
||||
,id: ''
|
||||
,type: 'group'
|
||||
,child: [{
|
||||
title: 'menu item 3-3-1'
|
||||
,id: ''
|
||||
},{
|
||||
title: 'menu item 3-3-2'
|
||||
,id: ''
|
||||
,child: [{
|
||||
title: 'menu item 3-3-2-1'
|
||||
,id: ''
|
||||
},{
|
||||
title: 'menu item 3-3-2-2'
|
||||
,id: ''
|
||||
},{
|
||||
title: 'menu item 3-3-2-3'
|
||||
,id: ''
|
||||
}]
|
||||
},{
|
||||
title: 'menu item 3-3-3'
|
||||
,id: ''
|
||||
}]
|
||||
}]
|
||||
}
|
||||
,{type: '-'}
|
||||
,{
|
||||
title: 'menu item 4'
|
||||
,id: ''
|
||||
},{
|
||||
title: 'menu item 5'
|
||||
,id: ''
|
||||
,child: [{
|
||||
title: 'menu item 5-1'
|
||||
,id: ''
|
||||
,child: [{
|
||||
title: 'menu item 5-1-1'
|
||||
,id: ''
|
||||
},{
|
||||
title: 'menu item 5-1-2'
|
||||
,id: ''
|
||||
},{
|
||||
title: 'menu item 5-1-3'
|
||||
,id: ''
|
||||
}]
|
||||
},{
|
||||
title: 'menu item 5-2'
|
||||
,id: ''
|
||||
},{
|
||||
title: 'menu item 5-3'
|
||||
,id: ''
|
||||
}]
|
||||
},{type:'-'},{
|
||||
title: 'menu item 6'
|
||||
,id: ''
|
||||
,type: 'group'
|
||||
,isSpreadItem: false
|
||||
,child: [{
|
||||
title: 'menu item 6-1'
|
||||
,id: ''
|
||||
},{
|
||||
title: 'menu item 6-2'
|
||||
,id: ''
|
||||
},{
|
||||
title: 'menu item 6-3'
|
||||
,id: ''
|
||||
}]
|
||||
}]
|
||||
data: [
|
||||
{
|
||||
title: 'menu item 1',
|
||||
templet:
|
||||
'<i class="layui-icon layui-icon-light"></i> {{= d.title }} <span class="layui-badge-dot"></span>',
|
||||
id: '',
|
||||
href: '',
|
||||
type: '' //菜单类型,支持:normal/group/parent
|
||||
},
|
||||
{
|
||||
title: 'menu item <strong>2</strong>',
|
||||
templet:
|
||||
'<img src="https://unpkg.com/outeres@0.1.1/demo/avatar/0.png" style="width: 16px;"> {{- d.title }}',
|
||||
id: '',
|
||||
href: 'https://www.layui.com/',
|
||||
target: '_blank'
|
||||
},
|
||||
{ type: '-' },
|
||||
{},
|
||||
{
|
||||
title: 'menu item 3 <hello>',
|
||||
id: '',
|
||||
type: 'group',
|
||||
child: [
|
||||
{
|
||||
title: 'menu item 3-1',
|
||||
id: ''
|
||||
},
|
||||
{
|
||||
title: 'menu item 3-2',
|
||||
id: '',
|
||||
child: [
|
||||
{
|
||||
title: 'menu item 3-2-1',
|
||||
id: ''
|
||||
},
|
||||
{
|
||||
title: 'menu item 3-2-2',
|
||||
id: '',
|
||||
type: 'group',
|
||||
child: [
|
||||
{
|
||||
title: 'menu item 3-2-2-1',
|
||||
id: ''
|
||||
},
|
||||
{
|
||||
title: 'menu item 3-2-2-2',
|
||||
id: ''
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'menu item 3-2-3',
|
||||
id: ''
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'menu item 3-3',
|
||||
id: '',
|
||||
type: 'group',
|
||||
child: [
|
||||
{
|
||||
title: 'menu item 3-3-1',
|
||||
id: ''
|
||||
},
|
||||
{
|
||||
title: 'menu item 3-3-2',
|
||||
id: '',
|
||||
child: [
|
||||
{
|
||||
title: 'menu item 3-3-2-1',
|
||||
id: ''
|
||||
},
|
||||
{
|
||||
title: 'menu item 3-3-2-2',
|
||||
id: ''
|
||||
},
|
||||
{
|
||||
title: 'menu item 3-3-2-3',
|
||||
id: ''
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'menu item 3-3-3',
|
||||
id: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{ type: '-' },
|
||||
{
|
||||
title: 'menu item 4',
|
||||
id: ''
|
||||
},
|
||||
{
|
||||
title: 'menu item 5',
|
||||
id: '',
|
||||
child: [
|
||||
{
|
||||
title: 'menu item 5-1',
|
||||
id: '',
|
||||
child: [
|
||||
{
|
||||
title: 'menu item 5-1-1',
|
||||
id: ''
|
||||
},
|
||||
{
|
||||
title: 'menu item 5-1-2',
|
||||
id: ''
|
||||
},
|
||||
{
|
||||
title: 'menu item 5-1-3',
|
||||
id: ''
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'menu item 5-2',
|
||||
id: ''
|
||||
},
|
||||
{
|
||||
title: 'menu item 5-3',
|
||||
id: ''
|
||||
}
|
||||
]
|
||||
},
|
||||
{ type: '-' },
|
||||
{
|
||||
title: 'menu item 6',
|
||||
id: '',
|
||||
type: 'group',
|
||||
isSpreadItem: false,
|
||||
child: [
|
||||
{
|
||||
title: 'menu item 6-1',
|
||||
id: ''
|
||||
},
|
||||
{
|
||||
title: 'menu item 6-2',
|
||||
id: ''
|
||||
},
|
||||
{
|
||||
title: 'menu item 6-3',
|
||||
id: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
,id: 'demo1'
|
||||
id: 'demo1',
|
||||
|
||||
// 触发点击事件的元素范围 --- default: 仅子菜单触发点击事件(默认,可不填); all: 所有父子菜单均触发点击事件
|
||||
,clickScope: 'all'
|
||||
// 触发点击事件的元素范围 --- default: 仅子菜单触发点击事件(默认,可不填); all: 所有父子菜单均触发点击事件
|
||||
clickScope: 'all',
|
||||
|
||||
// 菜单被点击的事件
|
||||
,click: function(obj){
|
||||
click: function (obj) {
|
||||
console.log(obj);
|
||||
}
|
||||
});
|
||||
|
||||
var inst = dropdown.render({
|
||||
elem: '#demo2'
|
||||
elem: '#demo2',
|
||||
// ,show: true
|
||||
,data: [{
|
||||
title: 'menu item 1'
|
||||
,href: '#1'
|
||||
,disabled: true
|
||||
},{
|
||||
title: 'menu item 2(点击不关闭)'
|
||||
,href: '#2'
|
||||
,id: 'bbb'
|
||||
},{
|
||||
title: 'menu item 3'
|
||||
,href: '#3'
|
||||
}]
|
||||
,click: function(data, othis){
|
||||
data: [
|
||||
{
|
||||
title: 'menu item 1',
|
||||
href: '#1',
|
||||
disabled: true
|
||||
},
|
||||
{
|
||||
title: 'menu item 2(点击不关闭)',
|
||||
href: '#2',
|
||||
id: 'bbb'
|
||||
},
|
||||
{
|
||||
title: 'menu item 3',
|
||||
href: '#3'
|
||||
}
|
||||
],
|
||||
click: function (data, othis) {
|
||||
console.log(data);
|
||||
if(data.id === 'bbb'){
|
||||
if (data.id === 'bbb') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
,ready: function(){
|
||||
},
|
||||
ready: function () {
|
||||
console.log(arguments);
|
||||
},
|
||||
close: function () {
|
||||
console.log('demo2', this.elem);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
dropdown.render({
|
||||
elem: '#demo3'
|
||||
,content: '自定义内容 123 '
|
||||
,style: 'background:#666;color:#fff;padding:15px;'
|
||||
,align: 'center'
|
||||
,trigger: 'hover'
|
||||
elem: '#demo3',
|
||||
content: '自定义内容 123 ',
|
||||
style: 'background:#666;color:#fff;padding:15px;',
|
||||
align: 'center',
|
||||
trigger: 'hover',
|
||||
close: function () {
|
||||
console.log('demo3', this.elem);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//右键
|
||||
dropdown.render({
|
||||
elem: document//'#demo20' //也可绑定到 document,从而重置整个右键
|
||||
,trigger: 'contextmenu' //contextmenu
|
||||
,isAllowSpread: false
|
||||
elem: document, //'#demo20' //也可绑定到 document,从而重置整个右键
|
||||
trigger: 'contextmenu', //contextmenu
|
||||
isAllowSpread: false,
|
||||
//,style: 'width: 200px'
|
||||
,customName: {
|
||||
customName: {
|
||||
children: 'children'
|
||||
}
|
||||
,data: [{
|
||||
title: 'menu item 1'
|
||||
,id: '#1'
|
||||
},{
|
||||
title: 'menu item 2'
|
||||
,id: 'reload'
|
||||
},{type:'-'},{
|
||||
title: 'menu item 3'
|
||||
,id: '#3'
|
||||
,children: [{
|
||||
title: 'menu item 3-1'
|
||||
,id: '#1'
|
||||
},{
|
||||
title: 'menu item 3-2'
|
||||
,id: '#2'
|
||||
},{
|
||||
title: 'menu item 3-3'
|
||||
,id: '#3'
|
||||
}]
|
||||
},{type:'-'},{
|
||||
title: 'menu item 4'
|
||||
,id: ''
|
||||
},{
|
||||
title: 'menu item 5'
|
||||
,id: '#1'
|
||||
},{
|
||||
title: 'menu item 6'
|
||||
,id: '#1'
|
||||
}]
|
||||
,click: function(obj, othis){
|
||||
if(obj.id === 'reload'){
|
||||
},
|
||||
data: [
|
||||
{
|
||||
title: 'menu item 1',
|
||||
id: '#1'
|
||||
},
|
||||
{
|
||||
title: 'menu item 2',
|
||||
id: 'reload'
|
||||
},
|
||||
{ type: '-' },
|
||||
{
|
||||
title: 'menu item 3',
|
||||
id: '#3',
|
||||
children: [
|
||||
{
|
||||
title: 'menu item 3-1',
|
||||
id: '#1'
|
||||
},
|
||||
{
|
||||
title: 'menu item 3-2',
|
||||
id: '#2'
|
||||
},
|
||||
{
|
||||
title: 'menu item 3-3',
|
||||
id: '#3'
|
||||
}
|
||||
]
|
||||
},
|
||||
{ type: '-' },
|
||||
{
|
||||
title: 'menu item 4',
|
||||
id: ''
|
||||
},
|
||||
{
|
||||
title: 'menu item 5',
|
||||
id: '#1'
|
||||
},
|
||||
{
|
||||
title: 'menu item 6',
|
||||
id: '#1'
|
||||
}
|
||||
],
|
||||
click: function (obj, othis) {
|
||||
if (obj.id === 'reload') {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
return;
|
||||
|
||||
dropdown.render({
|
||||
elem: document
|
||||
,content: '123'
|
||||
elem: document,
|
||||
content: '123'
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "layui",
|
||||
"version": "2.9.6",
|
||||
"version": "2.9.7",
|
||||
"description": "Classic modular Front-End UI library",
|
||||
"keywords": [
|
||||
"layui",
|
||||
|
|
|
@ -85,12 +85,14 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
|
|||
.layui-laydate .layui-laydate-list{position: absolute; left: 0; top: 0; width: 100%; height: 100%; padding: 10px; box-sizing: border-box; background-color: #fff;}
|
||||
.layui-laydate .layui-laydate-list>li{position: relative; display: inline-block; width: 33.3%; height: 36px; line-height: 36px; margin: 3px 0; vertical-align: middle; text-align: center; cursor: pointer; list-style: none;}
|
||||
.layui-laydate .laydate-month-list>li{width: 25%; margin: 17px 0;}
|
||||
.laydate-time-list{}
|
||||
.layui-laydate .laydate-time-list>li{height: 100%; margin: 0; line-height: normal; cursor: default;}
|
||||
.laydate-time-list{display: table;}
|
||||
.layui-laydate .laydate-time-list>li{display: table-cell; height: 100%; margin: 0; line-height: normal; cursor: default;}
|
||||
.layui-laydate .laydate-time-list p{position: relative; top: -4px; margin: 0; line-height: 29px;}
|
||||
.layui-laydate .laydate-time-list ol{height: 181px; overflow: hidden;}
|
||||
.layui-laydate .laydate-time-list>li:hover ol{overflow-y: auto;}
|
||||
.layui-laydate .laydate-time-list ol li{width: 130%; padding-left: 33px; height: 30px; line-height: 30px; text-align: left; cursor: pointer;}
|
||||
.layui-laydate .laydate-time-list-hide-1 ol li{padding-left: 53px;}
|
||||
.layui-laydate .laydate-time-list-hide-2 ol li{padding-left: 117px;}
|
||||
|
||||
/* 提示 */
|
||||
.layui-laydate-hint{position: absolute; top: 115px; left: 50%; width: 250px; margin-left: -125px; line-height: 20px; padding: 15px; text-align: center; font-size: 12px; color: #FF5722;}
|
||||
|
@ -183,3 +185,5 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
|
|||
.laydate-theme-fullpanel .laydate-time-show .laydate-set-ym span[lay-type="year"],
|
||||
.laydate-theme-fullpanel .laydate-time-show .laydate-set-ym span[lay-type="month"] {display: inline-block !important;}
|
||||
.laydate-theme-fullpanel .laydate-btns-time{display: none;}
|
||||
.laydate-theme-fullpanel .laydate-time-list-hide-1 ol li{padding-left: 49px;}
|
||||
.laydate-theme-fullpanel .laydate-time-list-hide-2 ol li{padding-left: 107px;}
|
||||
|
|
|
@ -6,7 +6,7 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;}
|
|||
|
||||
/* common */
|
||||
.layui-layer-shade, .layui-layer{position:fixed; _position:absolute; pointer-events: auto;}
|
||||
.layui-layer-shade{top:0; left:0; width:100%; height:100%; _height:expression(document.body.offsetHeight+"px");}
|
||||
.layui-layer-shade{opacity: 0; transition: opacity .35s cubic-bezier(0.34, 0.69, 0.1, 1); top:0; left:0; width:100%; height:100%; _height:expression(document.body.offsetHeight+"px");}
|
||||
.layui-layer{-webkit-overflow-scrolling: touch;}
|
||||
.layui-layer{top:150px; left: 0; margin:0; padding:0; background-color:#fff; -webkit-background-clip: content; border-radius: 2px; box-shadow: 1px 1px 50px rgba(0,0,0,.3);}
|
||||
.layui-layer-close{position:absolute;}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
};
|
||||
|
||||
var Layui = function(){
|
||||
this.v = '2.9.6'; // Layui 版本号
|
||||
this.v = '2.9.7'; // Layui 版本号
|
||||
};
|
||||
|
||||
// 识别预先可能定义的指定全局对象
|
||||
|
|
|
@ -377,14 +377,19 @@ layui.define(['jquery', 'laytpl', 'lay', 'util'], function(exports){
|
|||
Class.prototype.remove = function(){
|
||||
var that = this;
|
||||
var options = that.config;
|
||||
var elemPrev = thisModule.prevElem;
|
||||
var prevContentElem = thisModule.prevElem;
|
||||
|
||||
// 若存在已打开的面板元素,则移除
|
||||
if(elemPrev){
|
||||
elemPrev.data('prevElem') && (
|
||||
elemPrev.data('prevElem').data(MOD_INDEX +'_opened', false)
|
||||
);
|
||||
elemPrev.remove();
|
||||
if(prevContentElem){
|
||||
var prevId = prevContentElem.attr('lay-id');
|
||||
var prevTriggerElem = prevContentElem.data('prevElem');
|
||||
var prevInstance = thisModule.getThis(prevId);
|
||||
var prevOnClose = prevInstance.config.close;
|
||||
|
||||
prevTriggerElem && prevTriggerElem.data(MOD_INDEX +'_opened', false);
|
||||
prevContentElem.remove();
|
||||
delete thisModule.prevElem;
|
||||
typeof prevOnClose === 'function' && prevOnClose.call(prevInstance.config, prevTriggerElem);
|
||||
}
|
||||
lay('.' + STR_ELEM_SHADE).remove();
|
||||
};
|
||||
|
|
|
@ -16,10 +16,12 @@ layui.define('jquery', function(exports){
|
|||
options = options || {};
|
||||
|
||||
var elem = $(options.elem); if(!elem[0]) return;
|
||||
var scrollElem = $(options.scrollElem || document); //滚动条所在元素
|
||||
var mb = options.mb || 50; //与底部的临界距离
|
||||
var isAuto = 'isAuto' in options ? options.isAuto : true; //是否自动滚动加载
|
||||
var end = options.end || '没有更多了'; //“末页”显示文案
|
||||
var scrollElem = $(options.scrollElem || document); // 滚动条所在元素
|
||||
var threshold = 'mb' in options ? options.mb : 50; // 临界距离
|
||||
var isAuto = 'isAuto' in options ? options.isAuto : true; // 否自动滚动加载
|
||||
var end = options.end || '没有更多了'; // “末页”显示文案
|
||||
var direction = options.direction || 'bottom';
|
||||
var isTop = direction === 'top';
|
||||
|
||||
//滚动条所在元素是否为document
|
||||
var notDocument = options.scrollElem && options.scrollElem !== document;
|
||||
|
@ -29,18 +31,30 @@ layui.define('jquery', function(exports){
|
|||
,more = $('<div class="layui-flow-more"><a href="javascript:;">'+ ELEM_TEXT +'</a></div>');
|
||||
|
||||
if(!elem.find('.layui-flow-more')[0]){
|
||||
elem.append(more);
|
||||
elem[isTop ? 'prepend' : 'append'](more);
|
||||
}
|
||||
|
||||
//加载下一个元素
|
||||
var next = function(html, over){
|
||||
var scrollHeightStart = notDocument ? scrollElem.prop('scrollHeight') : document.documentElement.scrollHeight;
|
||||
var scrollTopStart = scrollElem.scrollTop();
|
||||
html = $(html);
|
||||
more.before(html);
|
||||
more[isTop ? 'after' : 'before'](html);
|
||||
over = over == 0 ? true : null;
|
||||
over ? more.html(end) : more.find('a').html(ELEM_TEXT);
|
||||
isOver = over;
|
||||
lock = null;
|
||||
lazyimg && lazyimg();
|
||||
if(isTop){
|
||||
var scrollHeightEnd = notDocument ? scrollElem.prop('scrollHeight') : document.documentElement.scrollHeight;
|
||||
if(page === 1){
|
||||
// 首次渲染后滑动到底部
|
||||
scrollElem.scrollTop(scrollHeightEnd);
|
||||
}else if(page > 1){
|
||||
var nextElementHeight = scrollHeightEnd - scrollHeightStart;
|
||||
scrollElem.scrollTop(scrollTopStart + nextElementHeight);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//触发请求
|
||||
|
@ -64,6 +78,7 @@ layui.define('jquery', function(exports){
|
|||
lazyimg = that.lazyimg({
|
||||
elem: options.elem + ' img'
|
||||
,scrollElem: options.scrollElem
|
||||
,direction: options.direction
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -85,7 +100,7 @@ layui.define('jquery', function(exports){
|
|||
: document.documentElement.scrollHeight;
|
||||
|
||||
//临界点
|
||||
if(scrollHeight - top - height <= mb){
|
||||
if(!isTop ? scrollHeight - top - height <= threshold : top <= threshold){
|
||||
lock || done();
|
||||
}
|
||||
}, 100);
|
||||
|
@ -101,6 +116,8 @@ layui.define('jquery', function(exports){
|
|||
|
||||
var scrollElem = $(options.scrollElem || document); //滚动条所在元素
|
||||
var elem = options.elem || 'img';
|
||||
var direction = options.direction || 'bottom';
|
||||
var isTop = direction === 'top';
|
||||
|
||||
//滚动条所在元素是否为document
|
||||
var notDocument = options.scrollElem && options.scrollElem !== document;
|
||||
|
@ -113,7 +130,7 @@ layui.define('jquery', function(exports){
|
|||
}() : item.offset().top;
|
||||
|
||||
/* 始终只加载在当前屏范围内的图片 */
|
||||
if(elemTop >= start && elemTop <= end){
|
||||
if((isTop ? elemTop + item.height() : elemTop) >= start && elemTop <= end){
|
||||
if(item.attr('lay-src')){
|
||||
var src = item.attr('lay-src');
|
||||
layui.img(src, function(){
|
||||
|
|
|
@ -375,6 +375,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||
var CLASS = 'layui-form-select';
|
||||
var TITLE = 'layui-select-title';
|
||||
var NONE = 'layui-select-none';
|
||||
var CREATE_OPTION = 'layui-select-create-option';
|
||||
var initValue = '';
|
||||
var thatInput;
|
||||
var selects = elem || elemForm.find('select');
|
||||
|
@ -382,14 +383,18 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||
// 隐藏 select
|
||||
var hide = function(e, clear){
|
||||
if(!$(e.target).parent().hasClass(TITLE) || clear){
|
||||
$('.'+CLASS).removeClass(CLASS+'ed ' + CLASS+'up');
|
||||
var elem = $('.' + CLASS);
|
||||
elem.removeClass(CLASS+'ed ' + CLASS+'up');
|
||||
if(elem.hasClass('layui-select-creatable')){
|
||||
elem.children('dl').children('.' + CREATE_OPTION).remove();
|
||||
}
|
||||
thatInput && initValue && thatInput.val(initValue);
|
||||
}
|
||||
thatInput = null;
|
||||
};
|
||||
|
||||
// 各种事件
|
||||
var events = function(reElem, disabled, isSearch){
|
||||
var events = function(reElem, disabled, isSearch, isCreatable){
|
||||
var select = $(this);
|
||||
var title = reElem.find('.' + TITLE);
|
||||
var input = title.find('input');
|
||||
|
@ -408,6 +413,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||
var showDown = function(){
|
||||
var top = reElem.offset().top + reElem.outerHeight() + 5 - $win.scrollTop();
|
||||
var dlHeight = dl.outerHeight();
|
||||
var dds = dl.children('dd');
|
||||
|
||||
index = select[0].selectedIndex; // 获取最新的 selectedIndex
|
||||
reElem.addClass(CLASS+'ed');
|
||||
|
@ -432,6 +438,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||
reElem.removeClass(CLASS+'ed ' + CLASS+'up');
|
||||
input.blur();
|
||||
nearElem = null;
|
||||
isCreatable && dl.children('.' + CREATE_OPTION).remove();
|
||||
|
||||
if(choose) return;
|
||||
|
||||
|
@ -569,10 +576,18 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||
// 检测值是否不属于 select 项
|
||||
var notOption = function(value, callback, origin){
|
||||
var num = 0;
|
||||
var dds = dl.children('dd');
|
||||
var hasEquals = false;
|
||||
var rawValue = value;
|
||||
layui.each(dds, function(){
|
||||
var othis = $(this);
|
||||
var text = othis.text();
|
||||
|
||||
// 需要区分大小写
|
||||
if(isCreatable && text === rawValue){
|
||||
hasEquals = true;
|
||||
}
|
||||
|
||||
// 是否区分大小写
|
||||
if(laySearch !== 'cs'){
|
||||
text = text.toLowerCase();
|
||||
|
@ -583,17 +598,18 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||
var not = text.indexOf(value) === -1;
|
||||
|
||||
if(value === '' || (origin === 'blur') ? value !== text : not) num++;
|
||||
origin === 'keyup' && othis[not ? 'addClass' : 'removeClass'](HIDE);
|
||||
origin === 'keyup' && othis[(not && (isCreatable ? !othis.hasClass(CREATE_OPTION) : true)) ? 'addClass' : 'removeClass'](HIDE);
|
||||
});
|
||||
// 处理 select 分组元素
|
||||
origin === 'keyup' && layui.each(dts, function(){
|
||||
var othis = $(this)
|
||||
,thisDds = othis.nextUntil('dt').filter('dd') // 当前分组下的dd元素
|
||||
,allHide = thisDds.length == thisDds.filter('.' + HIDE).length; // 当前分组下所有dd元素都隐藏了
|
||||
var othis = $(this);
|
||||
var thisDds = othis.nextUntil('dt').filter('dd'); // 当前分组下的dd元素
|
||||
if(isCreatable) thisDds = thisDds.not('.' + CREATE_OPTION);
|
||||
var allHide = thisDds.length == thisDds.filter('.' + HIDE).length; // 当前分组下所有dd元素都隐藏了
|
||||
othis[allHide ? 'addClass' : 'removeClass'](HIDE);
|
||||
});
|
||||
var none = num === dds.length;
|
||||
return callback(none), none;
|
||||
return callback(none, hasEquals), none;
|
||||
};
|
||||
|
||||
// 搜索匹配
|
||||
|
@ -607,11 +623,27 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||
return false;
|
||||
}
|
||||
|
||||
notOption(value, function(none){
|
||||
if(none){
|
||||
dl.find('.'+NONE)[0] || dl.append('<p class="'+ NONE +'">无匹配项</p>');
|
||||
} else {
|
||||
dl.find('.'+NONE).remove();
|
||||
notOption(value, function(none, hasEquals){
|
||||
if(isCreatable){
|
||||
if(hasEquals){
|
||||
dl.children('.' + CREATE_OPTION).remove();
|
||||
}else{
|
||||
// 和初始渲染保持行为一致
|
||||
var textVal = $('<div>' + value +'</div>').text();
|
||||
var createOptionElem = dl.children('.' + CREATE_OPTION);
|
||||
if(createOptionElem[0]){
|
||||
createOptionElem.attr('lay-value', value);
|
||||
createOptionElem.text(textVal);
|
||||
}else{
|
||||
dl.append('<dd class="' + CREATE_OPTION + '" lay-value="'+ value +'">' + textVal + '</dd>');
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(none){
|
||||
dl.find('.'+NONE)[0] || dl.append('<p class="'+ NONE +'">无匹配项</p>');
|
||||
} else {
|
||||
dl.find('.'+NONE).remove();
|
||||
}
|
||||
}
|
||||
}, 'keyup');
|
||||
|
||||
|
@ -622,6 +654,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||
dl.find('.'+ THIS).removeClass(THIS);
|
||||
(select[0].options[0] || {}).value || dl.children('dd:eq(0)').addClass(THIS);
|
||||
dl.find('.'+ NONE).remove();
|
||||
isCreatable && dl.children('.' + CREATE_OPTION).remove();
|
||||
}
|
||||
|
||||
followScroll(); // 定位滚动条
|
||||
|
@ -653,7 +686,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||
}
|
||||
|
||||
// 选择
|
||||
dds.on('click', function(){
|
||||
dl.on('click', 'dd', function(){
|
||||
var othis = $(this), value = othis.attr('lay-value');
|
||||
var filter = select.attr('lay-filter'); // 获取过滤器
|
||||
|
||||
|
@ -666,6 +699,11 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||
othis.addClass(THIS);
|
||||
}
|
||||
|
||||
if(isCreatable && othis.hasClass(CREATE_OPTION)){
|
||||
othis.removeClass(CREATE_OPTION);
|
||||
select.append('<option value="' + value + '">' + value + '</option>');
|
||||
}
|
||||
|
||||
othis.siblings().removeClass(THIS);
|
||||
select.val(value).removeClass('layui-form-danger');
|
||||
|
||||
|
@ -698,13 +736,15 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||
if(typeof othis.attr('lay-ignore') === 'string') return othis.show();
|
||||
|
||||
var isSearch = typeof othis.attr('lay-search') === 'string'
|
||||
,isCreatable = typeof othis.attr('lay-creatable') === 'string' && isSearch
|
||||
,placeholder = optionsFirst ? (
|
||||
optionsFirst.value ? TIPS : (optionsFirst.innerHTML || TIPS)
|
||||
) : TIPS;
|
||||
|
||||
// 替代元素
|
||||
var reElem = $(['<div class="'+ (isSearch ? '' : 'layui-unselect ') + CLASS
|
||||
,(disabled ? ' layui-select-disabled' : '') +'">'
|
||||
,(disabled ? ' layui-select-disabled' : '')
|
||||
,(isCreatable ? ' layui-select-creatable' : '') + '">'
|
||||
,'<div class="'+ TITLE +'">'
|
||||
,('<input type="text" placeholder="'+ util.escape($.trim(placeholder)) +'" '
|
||||
+('value="'+ util.escape($.trim(value ? selected.html() : '')) +'"') // 默认值
|
||||
|
@ -734,7 +774,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|||
|
||||
hasRender[0] && hasRender.remove(); // 如果已经渲染,则Rerender
|
||||
othis.after(reElem);
|
||||
events.call(this, reElem, disabled, isSearch);
|
||||
events.call(this, reElem, disabled, isSearch, isCreatable);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1410,6 +1410,22 @@
|
|||
}
|
||||
};
|
||||
|
||||
var setTimeListVisibility = function(){
|
||||
var showHour = options.format.indexOf('H') !== -1;
|
||||
var showMinute = options.format.indexOf('m') !== -1;
|
||||
var showSecond = options.format.indexOf('s') !== -1;
|
||||
var liElem = ul.children;
|
||||
var hideCount = 0;
|
||||
|
||||
lay.each([showHour, showMinute, showSecond], function(i, isShow){
|
||||
if(!isShow){
|
||||
liElem[i].className += ' layui-hide';
|
||||
hideCount++;
|
||||
}
|
||||
})
|
||||
ul.className += (' laydate-time-list-hide-' + hideCount);
|
||||
}
|
||||
|
||||
//初始化时间对象
|
||||
if(options.range){
|
||||
if(!that[startEnd]){
|
||||
|
@ -1429,6 +1445,7 @@
|
|||
ul.appendChild(li);
|
||||
});
|
||||
setTimeStatus();
|
||||
setTimeListVisibility();
|
||||
}
|
||||
|
||||
//插入容器
|
||||
|
|
|
@ -258,6 +258,9 @@ doms.anim = {
|
|||
doms.SHADE = 'layui-layer-shade';
|
||||
doms.MOVE = 'layui-layer-move';
|
||||
|
||||
var SHADE_KEY = 'LAYUI-LAYER-SHADE-KEY';
|
||||
var RECORD_HEIGHT_KEY = 'LAYUI_LAYER_CONTENT_RECORD_HEIGHT';
|
||||
|
||||
// 默认配置
|
||||
Class.pt.config = {
|
||||
type: 0,
|
||||
|
@ -397,7 +400,22 @@ Class.pt.creat = function(){
|
|||
var content = config.content;
|
||||
var conType = typeof content === 'object';
|
||||
var body = $('body');
|
||||
|
||||
|
||||
var setAnim = function(layero){
|
||||
// anim 兼容旧版 shift
|
||||
if(config.shift){
|
||||
config.anim = config.shift;
|
||||
}
|
||||
|
||||
// 为兼容 jQuery3.0 的 css 动画影响元素尺寸计算
|
||||
if(doms.anim[config.anim]){
|
||||
var animClass = 'layer-anim '+ doms.anim[config.anim];
|
||||
layero.addClass(animClass).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
|
||||
$(this).removeClass(animClass);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 若 id 对应的弹层已经存在,则不重新创建
|
||||
if(config.id && $('.'+ doms[0]).find('#'+ config.id)[0]){
|
||||
return (function(){
|
||||
|
@ -413,6 +431,10 @@ Class.pt.creat = function(){
|
|||
} else if(options.hideOnClose){
|
||||
elemShade.show();
|
||||
layero.show();
|
||||
setAnim(layero);
|
||||
setTimeout(function(){
|
||||
elemShade.css({opacity: elemShade.data(SHADE_KEY)});
|
||||
}, 10);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
@ -427,11 +449,6 @@ Class.pt.creat = function(){
|
|||
config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];
|
||||
}
|
||||
|
||||
// anim 兼容旧版 shift
|
||||
if(config.shift){
|
||||
config.anim = config.shift;
|
||||
}
|
||||
|
||||
if(layer.ie == 6){
|
||||
config.fixed = false;
|
||||
}
|
||||
|
@ -486,7 +503,9 @@ Class.pt.creat = function(){
|
|||
that.shadeo.css({
|
||||
'background-color': config.shade[1] || '#000'
|
||||
,'opacity': config.shade[0] || config.shade
|
||||
,'transition': config.shade[2] || ''
|
||||
});
|
||||
that.shadeo.data(SHADE_KEY, config.shade[0] || config.shade);
|
||||
|
||||
config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]);
|
||||
|
||||
|
@ -518,14 +537,7 @@ Class.pt.creat = function(){
|
|||
layer.close(that.index);
|
||||
}, config.time);
|
||||
that.move().callback();
|
||||
|
||||
// 为兼容 jQuery3.0 的 css 动画影响元素尺寸计算
|
||||
if(doms.anim[config.anim]){
|
||||
var animClass = 'layer-anim '+ doms.anim[config.anim];
|
||||
that.layero.addClass(animClass).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
|
||||
$(this).removeClass(animClass);
|
||||
});
|
||||
}
|
||||
setAnim(that.layero);
|
||||
|
||||
// 记录配置信息
|
||||
that.layero.data('config', config);
|
||||
|
@ -957,14 +969,18 @@ Class.pt.openLayer = function(){
|
|||
// 记录宽高坐标,用于还原
|
||||
ready.record = function(layero){
|
||||
if(!layero[0]) return window.console && console.error('index error');
|
||||
var type = layero.attr('type');
|
||||
var contentElem = layero.find('.layui-layer-content');
|
||||
var contentRecordHeightElem = type === ready.type[2] ? contentElem.children('iframe') : contentElem;
|
||||
var area = [
|
||||
layero[0].style.width || layero.width(),
|
||||
layero[0].style.height || layero.height(),
|
||||
layero[0].style.width || ready.getStyle(layero[0], 'width'),
|
||||
layero[0].style.height || ready.getStyle(layero[0], 'height'),
|
||||
layero.position().top,
|
||||
layero.position().left + parseFloat(layero.css('margin-left'))
|
||||
];
|
||||
layero.find('.layui-layer-max').addClass('layui-layer-maxmin');
|
||||
layero.attr({area: area});
|
||||
contentElem.data(RECORD_HEIGHT_KEY, ready.getStyle(contentRecordHeightElem[0], 'height'));
|
||||
};
|
||||
|
||||
// 设置页面滚动条
|
||||
|
@ -1016,7 +1032,7 @@ layer.iframeSrc = function(index, url){
|
|||
// 设定层的样式
|
||||
layer.style = function(index, options, limit){
|
||||
var layero = $('#'+ doms[0] + index);
|
||||
var contElem = layero.find('.layui-layer-content');
|
||||
var contentElem = layero.find('.layui-layer-content');
|
||||
var type = layero.attr('type');
|
||||
var titHeight = layero.find(doms[1]).outerHeight() || 0;
|
||||
var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
|
||||
|
@ -1044,10 +1060,10 @@ layer.style = function(index, options, limit){
|
|||
height: (typeof options.height === 'number' ? options.height : layero.height()) - titHeight - btnHeight
|
||||
});
|
||||
} else {
|
||||
contElem.css({
|
||||
contentElem.css({
|
||||
height: (typeof options.height === 'number' ? options.height : layero.height()) - titHeight - btnHeight
|
||||
- parseFloat(contElem.css('padding-top'))
|
||||
- parseFloat(contElem.css('padding-bottom'))
|
||||
- parseFloat(contentElem.css('padding-top'))
|
||||
- parseFloat(contentElem.css('padding-bottom'))
|
||||
})
|
||||
}
|
||||
};
|
||||
|
@ -1118,9 +1134,11 @@ layer.min = function(index, options){
|
|||
layer.restore = function(index){
|
||||
var layero = $('#'+ doms[0] + index);
|
||||
var shadeo = $('#'+ doms.SHADE + index);
|
||||
var contentElem = layero.find('.layui-layer-content');
|
||||
var area = layero.attr('area').split(',');
|
||||
var type = layero.attr('type');
|
||||
var options = layero.data('config') || {};
|
||||
var contentRecordHeight = contentElem.data(RECORD_HEIGHT_KEY);
|
||||
|
||||
layero.removeData('maxminStatus'); // 移除最大最小状态
|
||||
|
||||
|
@ -1140,6 +1158,13 @@ layer.restore = function(index){
|
|||
|
||||
// 恢复页面滚动条弹层打开时的状态
|
||||
options.scrollbar ? ready.restScrollbar(index) : ready.setScrollbar(index);
|
||||
|
||||
// #1604
|
||||
if(contentRecordHeight !== undefined){
|
||||
contentElem.removeData(RECORD_HEIGHT_KEY);
|
||||
var contentRecordHeightElem = type === ready.type[2] ? contentElem.children('iframe') : contentElem;
|
||||
contentRecordHeightElem.css({height: contentRecordHeight});
|
||||
}
|
||||
|
||||
// 恢复遮罩
|
||||
shadeo.show();
|
||||
|
@ -1245,11 +1270,15 @@ layer.close = function(index, callback){
|
|||
}
|
||||
};
|
||||
// 移除遮罩
|
||||
var removeShade = (function fn(){
|
||||
$('#'+ doms.SHADE + index)[
|
||||
hideOnClose ? 'hide' : 'remove'
|
||||
]();
|
||||
})();
|
||||
var shadeo = $('#'+ doms.SHADE + index);
|
||||
if((layer.ie && layer.ie < 10) || !options.isOutAnim){
|
||||
shadeo[hideOnClose ? 'hide' : 'remove']();
|
||||
}else{
|
||||
shadeo.css({opacity: 0});
|
||||
setTimeout(function(){
|
||||
shadeo[hideOnClose ? 'hide' : 'remove']();
|
||||
}, 350);
|
||||
}
|
||||
|
||||
// 是否允许关闭动画
|
||||
if(options.isOutAnim){
|
||||
|
@ -1292,8 +1321,18 @@ layer.closeAll = function(type, callback){
|
|||
|
||||
// 根据弹层类型关闭最近打开的层
|
||||
layer.closeLast = function(type, callback){
|
||||
type = type || 'page';
|
||||
layer.close($('.layui-layer-'+ type +':last').attr("times"), callback);
|
||||
var layerIndexList = [];
|
||||
var isArrayType = $.isArray(type);
|
||||
$(typeof type === 'string' ? '.layui-layer-' + type : '.layui-layer').each(function(i, el){
|
||||
var layero = $(el);
|
||||
var shouldSkip = (isArrayType && type.indexOf(layero.attr('type')) === -1) || layero.css('display') === 'none';
|
||||
if(shouldSkip) return true;
|
||||
layerIndexList.push(Number(layero.attr('times')));
|
||||
});
|
||||
if(layerIndexList.length > 0){
|
||||
var layerIndexMax = Math.max.apply(null, layerIndexList);
|
||||
layer.close(layerIndexMax, callback);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -1646,7 +1685,7 @@ layer.photos = function(options, loop, key){
|
|||
}
|
||||
|
||||
dict.loadi = layer.load(1, {
|
||||
shade: 'shade' in options ? false : 0.9,
|
||||
shade: 'shade' in options ? false : [0.9, undefined, 'unset'],
|
||||
scrollbar: false
|
||||
});
|
||||
|
||||
|
@ -1681,7 +1720,7 @@ layer.photos = function(options, loop, key){
|
|||
return [imgarea[0]+'px', imgarea[1]+'px'];
|
||||
}(),
|
||||
title: false,
|
||||
shade: 0.9,
|
||||
shade: [0.9, undefined, 'unset'],
|
||||
shadeClose: true,
|
||||
closeBtn: false,
|
||||
move: '.layer-layer-photos-main img',
|
||||
|
|
Loading…
Reference in New Issue