[Closes #10] Reactive breadcrumbs
This commit is contained in:
parent
6d3cdb560d
commit
a1708317ec
19 changed files with 200 additions and 33 deletions
24
app/stores/breadcrumbs.ts
Normal file
24
app/stores/breadcrumbs.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { defineStore } from "pinia";
|
||||
|
||||
export interface BreadcrumbItem {
|
||||
label: string;
|
||||
to?: string;
|
||||
}
|
||||
|
||||
export const useBreadcrumbStore = defineStore("breadcrumb", {
|
||||
state: () => ({
|
||||
items: [] as BreadcrumbItem[],
|
||||
}),
|
||||
|
||||
actions: {
|
||||
setBreadcrumbs(items: BreadcrumbItem[]) {
|
||||
this.items = items;
|
||||
},
|
||||
addBreadcrumb(item: BreadcrumbItem) {
|
||||
this.items.push(item);
|
||||
},
|
||||
clear() {
|
||||
this.items = [];
|
||||
},
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue