-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: build ui and store support for multiple layouts
- Loading branch information
1 parent
9f0ae26
commit d53d604
Showing
3 changed files
with
108 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { defineStore } from 'pinia'; | ||
import type { ContainerComponent } from '/@/layout'; | ||
import { FlexComponent } from '/@/layout'; | ||
|
||
interface Layout { | ||
name: string | ||
rootComponent: ContainerComponent | ||
} | ||
|
||
interface State { | ||
layouts: Layout[] | ||
selectedLayout: Layout | ||
} | ||
|
||
export const useLayoutsStore = defineStore('layouts', { | ||
state: (): State => { | ||
const initialLayout: Layout = { | ||
name: 'Untitled Layout', | ||
rootComponent: new FlexComponent(), | ||
}; | ||
|
||
return { | ||
layouts: [initialLayout], | ||
selectedLayout: initialLayout, | ||
}; | ||
}, | ||
actions: { | ||
selectLayout(layout: Layout) { | ||
this.selectedLayout = layout; | ||
}, | ||
setRootComponent(component: ContainerComponent) { | ||
this.selectedLayout.rootComponent = component; | ||
}, | ||
}, | ||
}); |