Created dtos folder
This commit is contained in:
parent
2e7ba45484
commit
9705e0d150
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"name": "canteen-frontend",
|
||||
"name": "dartachalani",
|
||||
"version": "0.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "canteen-frontend",
|
||||
"name": "dartachalani",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"axios": "^1.11.0",
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, type PropType, ref } from "vue";
|
||||
import { onMounted, type PropType, ref } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import type { SidebarItem } from "@/dtos/common/Sidebar";
|
||||
import { useSidebar } from "@/stores/App/App";
|
||||
|
|
@ -117,7 +117,7 @@ import { storeToRefs } from "pinia";
|
|||
import { watch, nextTick } from "vue";
|
||||
const router = useRouter();
|
||||
|
||||
const emit = defineEmits(["toggleSideBar"]);
|
||||
// const emit = defineEmits(["toggleSideBar"]);
|
||||
|
||||
const sidebarStore = useSidebar();
|
||||
const { isSidebarOpen } = storeToRefs(sidebarStore);
|
||||
|
|
|
|||
13
src/dtos/common/Sidebar.d.ts
vendored
Normal file
13
src/dtos/common/Sidebar.d.ts
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import type { RouteLocationRaw } from "vue-router";
|
||||
|
||||
export type SidebarItem = {
|
||||
label: string;
|
||||
to?: RouteLocationRaw;
|
||||
icon?: string;
|
||||
isVisible?: boolean;
|
||||
children?: {
|
||||
label: string;
|
||||
to: RouteLocationRaw;
|
||||
isVisible?: boolean;
|
||||
}[];
|
||||
};
|
||||
23
src/stores/App/App.ts
Normal file
23
src/stores/App/App.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { acceptHMRUpdate, defineStore } from "pinia";
|
||||
|
||||
export const useSidebar = defineStore("sidebar", {
|
||||
state: () => ({
|
||||
sidebarOpen: true,
|
||||
}),
|
||||
|
||||
getters: {
|
||||
isSidebarOpen(state) {
|
||||
return state.sidebarOpen;
|
||||
},
|
||||
},
|
||||
|
||||
actions: {
|
||||
setSidebarStatus(value: boolean) {
|
||||
this.sidebarOpen = value;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (import.meta.hot) {
|
||||
import.meta.hot.accept(acceptHMRUpdate(useSidebar, import.meta.hot));
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user