文件名称排序和保存文件名称添加

pull/77/head
ChenX 6 years ago
parent 3e23cf6496
commit a6325be7ed

@ -27,7 +27,7 @@ export class Save implements Command
store.Put(StoreName.FileId, "fileCount", ++count);
fileInfo = {
fileId,
title: "新文件",
title: `新文件${count}`,
modifyTime: "",
isNew: false
}

@ -147,6 +147,12 @@ export class FilePanel extends React.Component<FileProps, FileState>
{
let store = await IndexedDbStore.CADStore();
let fileList = await store.GetDataList(StoreName.Data) as FileData[];;
fileList.sort((f1, f2) =>
{
if (f1.key.length !== f2.key.length) return f1.key.length - f2.key.length;
return f1.key.localeCompare(f2.key);
})
console.log(fileList.map(f => f.key));
this.setState({ fileList });
}

Loading…
Cancel
Save