优化 layui.sort 新增一个参数控制是否直接修改数组顺序

pull/1247/head
sunxiaobin89 2023-04-28 16:31:11 +08:00
parent edbf24b8ca
commit 6d43db5e22
1 changed files with 3 additions and 3 deletions

View File

@ -614,9 +614,9 @@
};
// 将数组中的成员对象按照某个 key 的 value 值进行排序
Layui.prototype.sort = function(arr, key, desc){
Layui.prototype.sort = function(arr, key, desc, notClone){
var that = this
,clone = JSON.parse(
,clone = notClone ? (arr || []) : JSON.parse(
JSON.stringify(arr || [])
);