Files
workspace/code/sllog/Sllog-User-Ui/src/store/router.ts
T
2025-06-18 16:30:01 +08:00

19 lines
444 B
TypeScript

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