update from server
This commit is contained in:
@@ -26,6 +26,23 @@ const removeHTMLTag = (str) => {
|
||||
return str;
|
||||
}
|
||||
|
||||
function groupBy(array, key) {
|
||||
return array.reduce((result, currentItem) => {
|
||||
// 使用 key 函数获取分组的键
|
||||
const groupKey = key(currentItem);
|
||||
// 检查结果对象中是否已经有了这个键
|
||||
const existingGroup = result.find(item => item.key === groupKey);
|
||||
if (existingGroup) {
|
||||
// 如果已存在,则将当前项添加到该组数组中
|
||||
existingGroup.items.push(currentItem);
|
||||
} else {
|
||||
// 如果不存在,则创建新组并添加当前项
|
||||
result.push({ key: groupKey, items: [currentItem] });
|
||||
}
|
||||
return result;
|
||||
}, []);
|
||||
}
|
||||
|
||||
const CREATE_PREVIEW_URL = (val) => {
|
||||
return FILE_STREAM_PREVIEW_ADDRESS + "?id=" + val
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user