feat(core): Mixly.FileTree读取子树时支持自定义text和icon
This commit is contained in:
@@ -637,12 +637,14 @@ class FileTree extends Component {
|
||||
const content = await this.readFolder(inPath);
|
||||
for (let item of content) {
|
||||
const { type, id, title, children } = item;
|
||||
const text = path.basename(id);
|
||||
let icon = 'icon-doc';
|
||||
if (type === 'folder') {
|
||||
icon = this.#getFolderIcon_(text);
|
||||
} else {
|
||||
icon = this.#getFileIcon_(text);
|
||||
const text = item.text ?? path.basename(id);
|
||||
let icon = item.icon ?? 'icon-doc';
|
||||
if (!item.icon) {
|
||||
if (type === 'folder') {
|
||||
icon = this.#getFolderIcon_(text);
|
||||
} else {
|
||||
icon = this.#getFileIcon_(text);
|
||||
}
|
||||
}
|
||||
output.push({
|
||||
text,
|
||||
|
||||
Reference in New Issue
Block a user