mirror of https://github.com/layui/layui
优化 layui.sort 新增一个参数控制是否直接修改数组顺序
parent
edbf24b8ca
commit
6d43db5e22
|
@ -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 || [])
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue