feat(core): Mixly.PagesManager中add方法允许使用Object对tab进行配置

This commit is contained in:
王立帮
2025-04-29 19:07:07 +08:00
parent 805858b367
commit a0f85c8eb0
11 changed files with 81 additions and 232 deletions

View File

@@ -152,12 +152,19 @@ class PagesManager extends Component {
return this.get(this.#activeId_);
}
add(type, id, name = null, title = null, favicon = null) {
this.#tabs_.addTab({
name: name ?? id,
title: title ?? id,
type, favicon, id
});
add(...args) {
if (args[0] && typeof args[0] === 'object') {
this.#tabs_.addTab(args[0]);
} else {
const [type, id, name, title, favicon] = args;
this.#tabs_.addTab({
type,
id,
name: name ?? id,
title: title ?? id,
favicon
});
}
}
remove(id) {