feat(core): Mixly.FileTree读取子树时支持自定义text和icon

This commit is contained in:
王立帮
2026-01-23 10:08:20 +08:00
parent 51d5a286f7
commit 70e3547cd8

View File

@@ -637,13 +637,15 @@ class FileTree extends Component {
const content = await this.readFolder(inPath); const content = await this.readFolder(inPath);
for (let item of content) { for (let item of content) {
const { type, id, title, children } = item; const { type, id, title, children } = item;
const text = path.basename(id); const text = item.text ?? path.basename(id);
let icon = 'icon-doc'; let icon = item.icon ?? 'icon-doc';
if (!item.icon) {
if (type === 'folder') { if (type === 'folder') {
icon = this.#getFolderIcon_(text); icon = this.#getFolderIcon_(text);
} else { } else {
icon = this.#getFileIcon_(text); icon = this.#getFileIcon_(text);
} }
}
output.push({ output.push({
text, text,
id, id,