| 123456789101112131415161718192021222324252627282930 |
- import { defineStore } from 'pinia';
- import type { Component } from 'vue';
- export interface MenuItem {
- key: string;
- label: string;
- icon: Component;
- path: string;
- }
- export interface LayoutConfig {
- menuItems: MenuItem[];
- }
- export const useLayoutStore = defineStore('layout', {
- state: () => ({
- menuItems: [] as MenuItem[],
- collapsed: false
- }),
- actions: {
- init(config: LayoutConfig) {
- this.menuItems = config.menuItems;
- },
- toggleCollapsed() {
- this.collapsed = !this.collapsed;
- }
- }
- });
|