import { defineStore } from "pinia"
import { RouteRecordNormalized} from "vue-router"
import { router } from "../router"
import { getRouteByName } from "../util/handleRoutes"
let defaultRoute = getRouteByName('Home', router.getRoutes()) as RouteRecordNormalized
let visitedRoutes = [defaultRoute]
export const useRouteStore = defineStore('route', {
// 推荐使用 完整类型推断的箭头函数
state: () => {
return {
visitedRoutes
}
},
})
router pinia
最新推荐文章于 2024-09-07 13:38:28 发布