From 23202137e138050a8c72d3b940faf68af3e62708 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Tue, 14 Mar 2023 09:55:13 +0800
Subject: [PATCH 01/25] =?UTF-8?q?=E4=BC=98=E5=8C=96=20code=20=E6=B8=B2?=
=?UTF-8?q?=E6=9F=93=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/code.js | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/src/modules/code.js b/src/modules/code.js
index a223d8fd..278ec6b9 100644
--- a/src/modules/code.js
+++ b/src/modules/code.js
@@ -14,6 +14,7 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
// 常量
var CONST = {
ELEM_VIEW: 'layui-code-view',
+ ELEM_TAB: 'layui-tab',
ELEM_TITLE: 'layui-code-title',
ELEM_FULL: 'layui-code-full',
ELEM_PREVIEW: 'layui-code-preview',
@@ -24,11 +25,11 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
// 默认参数项
var config = {
elem: '.layui-code', // 元素选择器
- title: '</>', // 标题
- about: '', // 右上角信息
- ln: true, // 是否显示行号
- header: false, // 是否显示头部区域
-
+ title: '</>', // 代码栏标题
+ about: '', // 代码栏右上角信息
+ ln: true, // 代码区域是否显示行号
+ header: false, // 是否显示代码栏头部区域
+ // 默认文本
text: {
code: util.escape('>'),
preview: 'Preview'
@@ -50,7 +51,6 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
// 从内至外渲染
layui.each(options.elem.get().reverse(), function(index, item){
var othis = $(item);
- var html = trim(othis.html());
// 合并属性上的参数,并兼容旧版本属性写法 lay-*
var options = $.extend(true, {}, opts, lay.options(item), function(obj){
@@ -65,7 +65,7 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
}({}));
// 获得代码
- var codes = function(){
+ var codes = othis.data('code') || function(){
var arr = [];
var textarea = othis.children('textarea');
@@ -73,10 +73,6 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
textarea.each(function(){
arr.push(trim(this.value));
});
-
- if(textarea[0]){
- html = util.escape(arr.join(''));
- }
// 内容直接放置在元素外层
if(arr.length === 0){
@@ -86,6 +82,8 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
return arr;
}();
+ othis.data('code', codes);
+
// 是否开启预览
if(options.preview){
var FILTER_VALUE = 'LAY-CODE-DF-'+ index;
@@ -102,7 +100,8 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
'layui-border'
].join(' ') +'">');
var elemToolbar = $('
');
- var elemViewHas = othis.prev('.' + CONST.ELEM_PREVIEW);
+ var elemViewHas = othis.parent('.' + CONST.ELEM_PREVIEW);
+ var elemTabHas = othis.prev('.'+ CONST.ELEM_TAB);
var elemPreviewViewHas = othis.next('.' + CONST.ELEM_ITEM +'-preview');
if(options.id) elemView.attr('id', options.id);
@@ -168,8 +167,9 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
});
// 移除旧结构
- if(elemViewHas[0]) elemViewHas.remove();
- if(elemPreviewViewHas[0]) elemPreviewViewHas.remove();
+ if(elemTabHas[0]) elemTabHas.remove(); // 移除 tab
+ if(elemPreviewViewHas[0]) elemPreviewViewHas.remove(); // 移除预览区域
+ if(elemViewHas[0]) othis.unwrap(); // 移除外层容器
elemTabView.append(elemHeaderView); // 追加标签头
options.tools && elemTabView.append(elemToolbar); // 追加工具栏
@@ -247,9 +247,14 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
// 自定义风格
if(options.skin){
if(options.skin === 'notepad') options.skin = 'dark';
+ othis.removeClass('layui-code-dark layui-code-light');
othis.addClass('layui-code-'+ options.skin);
}
+
+ // code
+ var html = util.escape(codes.join(''));
+
// 转义 HTML 标签
if(options.encode) html = util.escape(html);
html = html.replace(/[\r\t\n]+/g, ''); // 转义换行符
From 235d9fd40fcabcaf0f2231240939a958747fcd28 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Tue, 14 Mar 2023 09:55:50 +0800
Subject: [PATCH 02/25] =?UTF-8?q?=E8=B0=83=E6=95=B4=20carousel=20=E7=9A=84?=
=?UTF-8?q?=20`jump`=20=E6=96=B9=E6=B3=95=E4=B8=BA=20`goto`?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/carousel.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/modules/carousel.js b/src/modules/carousel.js
index cf8efb86..1715392e 100644
--- a/src/modules/carousel.js
+++ b/src/modules/carousel.js
@@ -196,7 +196,7 @@ layui.define('jquery', function(exports){
};
// 跳转到特定下标
- Class.prototype.jump = function(index){
+ Class.prototype.goto = function(index){
var that = this;
var options = that.config;
@@ -236,9 +236,9 @@ layui.define('jquery', function(exports){
tplInd.css('margin-top', -(tplInd.height()/2));
}
- //事件
+ // 事件
tplInd.find('li').on(options.trigger === 'hover' ? 'mouseover' : options.trigger, function(){
- that.jump($(this).index());
+ that.goto($(this).index());
});
};
From 4ce74ef4e943988125b2da3e9fa193386722edae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Tue, 14 Mar 2023 09:56:17 +0800
Subject: [PATCH 03/25] =?UTF-8?q?=E4=BC=98=E5=8C=96=20table=20=E9=9A=90?=
=?UTF-8?q?=E8=97=8F=E5=9B=BA=E5=AE=9A=E5=88=97=E7=9A=84=E5=88=A4=E6=96=AD?=
=?UTF-8?q?=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/table.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/modules/table.js b/src/modules/table.js
index e5a114d8..558f8da2 100644
--- a/src/modules/table.js
+++ b/src/modules/table.js
@@ -1720,7 +1720,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
// 固定列区域高度
var mainHeight = that.layMain.height();
var fixHeight = mainHeight - scollHeight;
-
+
that.layFixed.find(ELEM_BODY).css(
'height',
layMainTable.height() >= fixHeight ? fixHeight : 'auto'
@@ -1728,7 +1728,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
// 表格宽度小于容器宽度时,隐藏固定列
that.layFixRight[
- table.cache[that.key].length && outWidth > 0
+ (table.cache[that.key] && table.cache[that.key].length) && outWidth > 0
? 'removeClass'
: 'addClass'
](HIDE);
From d9f76c0dcd131194c44537b0805fec0f5fc534a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Tue, 14 Mar 2023 09:57:03 +0800
Subject: [PATCH 04/25] =?UTF-8?q?=E4=BC=98=E5=8C=96=20`util.timeAgo()`=20?=
=?UTF-8?q?=E6=96=B9=E6=B3=95=E6=96=87=E6=9C=AC=E7=BB=86=E8=8A=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/util.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/modules/util.js b/src/modules/util.js
index 9d3cafdd..de296f40 100644
--- a/src/modules/util.js
+++ b/src/modules/util.js
@@ -183,11 +183,11 @@ layui.define('jquery', function(exports){
//30天以内,返回“多久前”
if(stamp >= 1000*60*60*24){
- return ((stamp/1000/60/60/24)|0) + '天前';
+ return ((stamp/1000/60/60/24)|0) + ' 天前';
} else if(stamp >= 1000*60*60){
- return ((stamp/1000/60/60)|0) + '小时前';
+ return ((stamp/1000/60/60)|0) + ' 小时前';
} else if(stamp >= 1000*60*3){ //3分钟以内为:刚刚
- return ((stamp/1000/60)|0) + '分钟前';
+ return ((stamp/1000/60)|0) + ' 分钟前';
} else if(stamp < 0){
return '未来';
} else {
From 5663d60d210bbfc03266600d9256fd655ca74a09 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Thu, 16 Mar 2023 13:19:11 +0800
Subject: [PATCH 05/25] =?UTF-8?q?=E4=BC=98=E5=8C=96=20rate=20=E7=9B=B8?=
=?UTF-8?q?=E5=85=B3=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=85=88=E7=BA=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/css/layui.css | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/css/layui.css b/src/css/layui.css
index 3a0a8ee0..0c6061e9 100644
--- a/src/css/layui.css
+++ b/src/css/layui.css
@@ -1423,6 +1423,7 @@ body .layui-util-face .layui-layer-content{padding:0; background-color:#fff; co
.layui-rate,
.layui-rate *{display: inline-block; vertical-align: middle;}
.layui-rate{padding: 10px 5px 10px 0; font-size: 0;}
+.layui-rate li{margin-top: 0 !important;}
.layui-rate li i.layui-icon{ font-size: 20px; color: #FFB800;}
.layui-rate li i.layui-icon{margin-right: 5px; transition: all .3s; -webkit-transition: all .3s;}
.layui-rate li i:hover{cursor: pointer; transform: scale(1.12); -webkit-transform: scale(1.12);}
From 9b6426e089ffc5ed81ae87be283d501f1e57bc6a Mon Sep 17 00:00:00 2001
From: morning-star
Date: Sun, 19 Mar 2023 00:23:40 +0800
Subject: [PATCH 06/25] =?UTF-8?q?=E4=BC=98=E5=8C=96=20form=20=E5=8C=B9?=
=?UTF-8?q?=E9=85=8D=E5=A4=8D=E9=80=89=E6=A1=86=E5=92=8C=E5=8D=95=E9=80=89?=
=?UTF-8?q?=E6=A1=86=E7=9A=84=E6=AD=A3=E5=88=99=E8=A1=A8=E8=BE=BE=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/form.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/modules/form.js b/src/modules/form.js
index 7778dbb8..9b58e18d 100644
--- a/src/modules/form.js
+++ b/src/modules/form.js
@@ -136,7 +136,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
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[init_name || item.name] = item.value;
});
@@ -848,7 +848,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
// 是否属于美化替换后的表单元素
var isForm2Elem = item.tagName.toLowerCase() === 'select' || (
- /^checkbox|radio$/.test(item.type)
+ /^(checkbox|radio)$/.test(item.type)
);
errorText = errorText || rule[1];
From 461ae352b855a15eec762a52c7214998e1b33995 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Sun, 19 Mar 2023 22:27:32 +0800
Subject: [PATCH 07/25] =?UTF-8?q?=E4=BC=98=E5=8C=96=20dropdown=20=E7=9A=84?=
=?UTF-8?q?=20`id`=20=E5=B1=9E=E6=80=A7=E5=8F=96=E5=80=BC=E4=BC=98?=
=?UTF-8?q?=E5=85=88=E7=BA=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/dropdown.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js
index 3421eafb..c9fa3a9b 100644
--- a/src/modules/dropdown.js
+++ b/src/modules/dropdown.js
@@ -113,8 +113,10 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
return newThat.reload(options);
}
- //初始化 id 参数
- options.id = ('id' in options) ? options.id : that.index;
+ // 初始化 id 属性 - 优先取 options > 元素 id > 自增索引
+ options.id = 'id' in options ? options.id : (
+ options.elem.attr('id') || that.index
+ );
if(options.show) that.render(rerender); //初始即显示
that.events(); //事件
From 9c6a0a81826733e0c6b2518e5aff7bcfc505f053 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Sun, 19 Mar 2023 22:37:57 +0800
Subject: [PATCH 08/25] =?UTF-8?q?=E4=BC=98=E5=8C=96=20dropdown=20=E5=88=9D?=
=?UTF-8?q?=E5=A7=8B=E5=8C=96=E6=96=B9=E6=B3=95=E7=9B=B8=E5=85=B3=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/dropdown.js | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js
index c9fa3a9b..6bb29f1e 100644
--- a/src/modules/dropdown.js
+++ b/src/modules/dropdown.js
@@ -89,13 +89,13 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
that.init(true);
};
- //初始化准备
+ // 初始化准备
Class.prototype.init = function(rerender){
- var that = this
- ,options = that.config
- ,elem = options.elem = $(options.elem);
+ var that = this;
+ var options = that.config;
+ var elem = options.elem = $(options.elem);
- //若 elem 非唯一
+ // 若 elem 非唯一
if(elem.length > 1){
layui.each(elem, function(){
dropdown.render($.extend({}, options, {
@@ -105,7 +105,7 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
return that;
}
- //若重复执行 render,则视为 reload 处理
+ // 若重复执行 render,则视为 reload 处理
if(!rerender && elem[0] && elem.data(MOD_INDEX)){
var newThat = thisModule.getThis(elem.data(MOD_INDEX));
if(!newThat) return;
@@ -115,11 +115,11 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
// 初始化 id 属性 - 优先取 options > 元素 id > 自增索引
options.id = 'id' in options ? options.id : (
- options.elem.attr('id') || that.index
+ elem.attr('id') || that.index
);
- if(options.show) that.render(rerender); //初始即显示
- that.events(); //事件
+ if(options.show) that.render(rerender); // 初始即显示
+ that.events(); // 事件
};
//渲染
From 40d3c330abeb5701ac73e2cf0094e575c2020bb7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Sun, 19 Mar 2023 23:20:21 +0800
Subject: [PATCH 09/25] =?UTF-8?q?=E4=BC=98=E5=8C=96=20transfer=20=E7=9A=84?=
=?UTF-8?q?=20`id`=20=E5=B1=9E=E6=80=A7=E5=8F=96=E5=80=BC=E4=BC=98?=
=?UTF-8?q?=E5=85=88=E7=BA=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/transfer.js | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/modules/transfer.js b/src/modules/transfer.js
index 8c85dce4..cfe15454 100644
--- a/src/modules/transfer.js
+++ b/src/modules/transfer.js
@@ -148,8 +148,11 @@ layui.define(['laytpl', 'form'], function(exports){
options.data = options.data || [];
options.value = options.value || [];
- //索引
- that.key = options.id || that.index;
+ // 初始化 id 属性 - 优先取 options > 元素 id > 自增索引
+ options.id = 'id' in options ? options.id : (
+ elem.attr('id') || that.index
+ );
+ that.key = options.id;
//插入组件结构
othis.html(that.elem);
From b8e27d6bcd062c867b11a7f70b2196856e4a9244 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Sun, 19 Mar 2023 23:21:23 +0800
Subject: [PATCH 10/25] =?UTF-8?q?=E4=BC=98=E5=8C=96=20slider=20=E7=9A=84?=
=?UTF-8?q?=20`elem`=20=E4=BB=A5=E6=94=AF=E6=8C=81=E5=90=8C=E6=97=B6?=
=?UTF-8?q?=E6=B8=B2=E6=9F=93=E5=A4=9A=E4=B8=AA=E5=AE=9E=E4=BE=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/slider.js | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/modules/slider.js b/src/modules/slider.js
index 3dbaf586..a3f6bb20 100644
--- a/src/modules/slider.js
+++ b/src/modules/slider.js
@@ -2,10 +2,11 @@
* slider 滑块组件
*/
-layui.define('jquery', function(exports){
+layui.define(['jquery', 'lay'], function(exports){
'use strict';
- var $ = layui.$
+ var $ = layui.$;
+ var lay = layui.lay;
// 外部接口
var slider = {
@@ -80,8 +81,22 @@ layui.define('jquery', function(exports){
//滑块渲染
Class.prototype.render = function(){
- var that = this
- ,options = that.config;
+ var that = this;
+ var options = that.config;
+
+ // 若 elem 非唯一,则拆分为多个实例
+ var elem = $(options.elem);
+ if(elem.length > 1){
+ layui.each(elem, function(){
+ slider.render($.extend({}, options, {
+ elem: this
+ }));
+ });
+ return that;
+ }
+
+ // 合并 lay-options 属性上的配置信息
+ $.extend(options, lay.options(elem[0]));
//间隔值不能小于 1
if(options.step < 1) options.step = 1;
From c9df4095f4e0ee23e6314cd3a69755332f9f01c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Sun, 19 Mar 2023 23:22:16 +0800
Subject: [PATCH 11/25] =?UTF-8?q?=E4=BC=98=E5=8C=96=20rate=20=E7=9A=84=20`?=
=?UTF-8?q?id`=20=E5=B1=9E=E6=80=A7=E5=8F=96=E5=80=BC=E4=BC=98=E5=85=88?=
=?UTF-8?q?=E7=BA=A7=E5=8F=8A=20`elem`=20=E5=8F=AF=E5=90=8C=E6=97=B6?=
=?UTF-8?q?=E6=B8=B2=E6=9F=93=E5=A4=9A=E4=B8=AA=E5=AE=9E=E4=BE=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/rate.js | 34 ++++++++++++++++++++++++++--------
1 file changed, 26 insertions(+), 8 deletions(-)
diff --git a/src/modules/rate.js b/src/modules/rate.js
index c0a77d44..23d7faf2 100644
--- a/src/modules/rate.js
+++ b/src/modules/rate.js
@@ -2,12 +2,14 @@
* rate 评分评星组件
*/
-layui.define('jquery',function(exports){
+layui.define(['jquery', 'lay'],function(exports){
"use strict";
- var $ = layui.jquery
- //外部接口
- ,rate = {
+ var $ = layui.jquery;
+ var lay = layui.lay;
+
+ // 外部接口
+ var rate = {
config: {}
,index: layui.rate ? (layui.rate.index + 10000) : 0
@@ -24,7 +26,7 @@ layui.define('jquery',function(exports){
}
}
- //操作当前实例
+ // 操作当前实例
,thisRate = function(){
var that = this
,options = that.config;
@@ -62,10 +64,26 @@ layui.define('jquery',function(exports){
//评分渲染
Class.prototype.render = function(){
- var that = this
- ,options = that.config
- ,style = options.theme ? ('style="color: '+ options.theme + ';"') : '';
+ var that = this;
+ var options = that.config;
+
+ // 若 elem 非唯一,则拆分为多个实例
+ var elem = $(options.elem);
+ if(elem.length > 1){
+ layui.each(elem, function(){
+ rate.render($.extend({}, options, {
+ elem: this
+ }));
+ });
+ return that;
+ }
+ // 合并 lay-options 属性上的配置信息
+ $.extend(options, lay.options(elem[0]));
+
+ // 自定义主题
+ var style = options.theme ? ('style="color: '+ options.theme + ';"') : '';
+
options.elem = $(options.elem);
//最大值不能大于总长度
From 15e23d37e5114af8cb69dd9611b9d97e71d727d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Sun, 19 Mar 2023 23:22:39 +0800
Subject: [PATCH 12/25] =?UTF-8?q?=E4=BC=98=E5=8C=96=20colorpicker=20?=
=?UTF-8?q?=E7=9A=84=20`id`=20=E5=B1=9E=E6=80=A7=E5=8F=96=E5=80=BC?=
=?UTF-8?q?=E4=BC=98=E5=85=88=E7=BA=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/colorpicker.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/modules/colorpicker.js b/src/modules/colorpicker.js
index 44877ca1..620bd9b4 100644
--- a/src/modules/colorpicker.js
+++ b/src/modules/colorpicker.js
@@ -222,8 +222,10 @@ layui.define(['jquery', 'lay'], function(exports){
that.elemColorBox = elemColorBox
);
- //初始化 id 参数
- options.id = ('id' in options) ? options.id : that.index;
+ // 初始化 id 属性 - 优先取 options > 元素 id > 自增索引
+ options.id = 'id' in options ? options.id : (
+ elem.attr('id') || that.index
+ );
// 获取背景色值
that.color = that.elemColorBox.find('.'+ PICKER_TRIG_SPAN)[0].style.background;
From e5caea867bc6ba5277107385063bd05c8c9ee187 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Sun, 19 Mar 2023 23:23:08 +0800
Subject: [PATCH 13/25] =?UTF-8?q?=E4=BC=98=E5=8C=96=20carousel=20=E7=9A=84?=
=?UTF-8?q?=20`id`=20=E5=B1=9E=E6=80=A7=E5=8F=96=E5=80=BC=E4=BC=98?=
=?UTF-8?q?=E5=85=88=E7=BA=A7=E5=8F=8A=20`elem`=20=E5=8F=AF=E5=90=8C?=
=?UTF-8?q?=E6=97=B6=E6=B8=B2=E6=9F=93=E5=A4=9A=E4=B8=AA=E5=AE=9E=E4=BE=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/carousel.js | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/src/modules/carousel.js b/src/modules/carousel.js
index 1715392e..765abe93 100644
--- a/src/modules/carousel.js
+++ b/src/modules/carousel.js
@@ -3,15 +3,17 @@
* MIT Licensed
*/
-layui.define('jquery', function(exports){
+layui.define(['jquery', 'lay'], function(exports){
"use strict";
- var $ = layui.$
- ,hint = layui.hint()
- ,device = layui.device()
+ var $ = layui.$;
+ var lay = layui.lay;
+
+ var hint = layui.hint();
+ var device = layui.device();
//外部接口
- ,carousel = {
+ var carousel = {
config: {} //全局配置项
//设置全局项
@@ -55,8 +57,22 @@ layui.define('jquery', function(exports){
//轮播渲染
Class.prototype.render = function(){
- var that = this
- ,options = that.config;
+ var that = this;
+ var options = that.config;
+
+ // 若 elem 非唯一,则拆分为多个实例
+ var elem = $(options.elem);
+ if(elem.length > 1){
+ layui.each(elem, function(){
+ carousel.render($.extend({}, options, {
+ elem: this
+ }));
+ });
+ return that;
+ }
+
+ // 合并 lay-options 属性上的配置信息
+ $.extend(options, lay.options(elem[0]));
options.elem = $(options.elem);
if(!options.elem[0]) return;
From 83e870e5698f73b6e4063a9917b4c389da873f38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Sun, 19 Mar 2023 23:23:47 +0800
Subject: [PATCH 14/25] =?UTF-8?q?=E4=BC=98=E5=8C=96=20dropdown=20=E5=AF=B9?=
=?UTF-8?q?=E5=85=83=E7=B4=A0=E5=B1=9E=E6=80=A7=20`lay-options`=20?=
=?UTF-8?q?=E7=9A=84=E8=AF=86=E5=88=AB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/dropdown.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js
index 6bb29f1e..5f1901a7 100644
--- a/src/modules/dropdown.js
+++ b/src/modules/dropdown.js
@@ -105,6 +105,9 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
return that;
}
+ // 合并 lay-options 属性上的配置信息
+ $.extend(options, lay.options(elem[0]));
+
// 若重复执行 render,则视为 reload 处理
if(!rerender && elem[0] && elem.data(MOD_INDEX)){
var newThat = thisModule.getThis(elem.data(MOD_INDEX));
From 2f8dcfbf6a7ae55bf60a6a7d49825fe3c52de9bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Sun, 19 Mar 2023 23:24:18 +0800
Subject: [PATCH 15/25] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20slider=20=E7=A4=BA?=
=?UTF-8?q?=E4=BE=8B=E6=96=87=E4=BB=B6=E4=BB=A3=E7=A0=81=E7=BC=A9=E8=BF=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
examples/slider.html | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/examples/slider.html b/examples/slider.html
index c638d123..72556009 100644
--- a/examples/slider.html
+++ b/examples/slider.html
@@ -12,11 +12,11 @@
-
+