feat(core): Mixly.FileTree读取子树时支持自定义text和icon
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user