Zum Hauptinhalt springen

addProject()

Beschreibung

Fügt ein neues Projekt hinzu

Verwendung

addProject({
id?: string | number,
project?: object
}): void;

Parameter

  • id - (optional) die ID des neuen Projekts
  • project - (optional) ein Objekt mit den Parametern des Projekts:
    • label - (optional) eine Zeichenkette mit dem Namen des Projekts

Beispiel

const { ToDo, Toolbar } = todo;

const list = new ToDo("#root", {
projects: [
{ id: "first", label: "First project" },
{ id: "second", label: "Second project" },
{ id: "third", label: "Third project" },
]
});

const toolbar = new Toolbar("#toolbar", {
api: list.api,
});

// ein neues Projekt hinzufügen
list.addProject({
id: "fourth",
project: {
label: "Fourth project"
}
});

Verwandter Artikel: Operationen mit Projekten