Files
workspace/code/iibta/iibta-vue/src/store/router.ts
T
2025-08-14 17:28:32 +08:00

19 lines
413 B
TypeScript

import { defineStore } from "pinia";
import { useRoute } from "vue-router";
import { useRouter } from "vue-router";
export const useRouterStore = defineStore("router", () => {
const route = useRoute();
const router = useRouter();
const getCurrentPath = () => {
return route.path;
};
const toPath = (path: string) => {
router.push(path);
};
return {
getCurrentPath,
toPath,
};
});