{"id":16892062,"url":"https://github.com/zhanba/umi-plugin-typed-route","last_synced_at":"2025-04-11T13:22:50.688Z","repository":{"id":57385694,"uuid":"224125758","full_name":"zhanba/umi-plugin-typed-route","owner":"zhanba","description":"Type-safe route navigation","archived":false,"fork":false,"pushed_at":"2024-09-10T18:05:38.000Z","size":1135,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-29T14:24:27.266Z","etag":null,"topics":["react-router","umi-plugin","umijs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhanba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-26T07:09:53.000Z","updated_at":"2023-03-08T16:42:55.000Z","dependencies_parsed_at":"2024-10-29T13:29:47.388Z","dependency_job_id":null,"html_url":"https://github.com/zhanba/umi-plugin-typed-route","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"8975d3c5be938838714d98ca5cff11d5c64a7fbf"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhanba%2Fumi-plugin-typed-route","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhanba%2Fumi-plugin-typed-route/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhanba%2Fumi-plugin-typed-route/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhanba%2Fumi-plugin-typed-route/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhanba","download_url":"https://codeload.github.com/zhanba/umi-plugin-typed-route/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248409318,"owners_count":21098766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react-router","umi-plugin","umijs"],"created_at":"2024-10-13T17:09:41.256Z","updated_at":"2025-04-11T13:22:50.646Z","avatar_url":"https://github.com/zhanba.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# umi-plugin-typed-route\n\n在webapp中跳转路由时，还在使用下面的方式拼接路由吗？是否在路由过多时感到难以维护？\n```ts\nhistory.push(`/app/welcome`);\nhistory.push(`/app/${projectId}`);\nhistory.push(`/app/${projectId}/${userId}`);\n```\n`umi-plugin-typed-route`为你提供类型安全的路由跳转！\n\n```ts\nhistory.push(pathFactory.app.welcome());\nhistory.push(pathFactory.app.project({projectId: 123}));\nhistory.push(pathFactory.app.project.user({projectId: 123, userId: \"tom\"}));\n```\n\n## Install\n\n```sh\nnpm i -D umi-plugin-typed-route\n```\n\n## Usage\n1. config umi\n```ts\nexport default {\n    plugins: [\"umi-plugin-typed-route\"],\n}\n```\n\n2. modify routes\n\nadd `name` proprety for every route.\n\n为每个路由配置下列属性：\n- `name`: required, 路由的英文名称，使用在代码中, 全英文\n- `query`: optional, 查询字符串query string的key值数组,如`?sort=desc`则配置`[\"sort\"]`\n- `title`: optional, 当前路由和页面的名称，建议中文\n- `description`: optional, 当前路由和页面的描述\n\n例子🌰：\n```ts\nexport default {\n    routes: [\n        {\n            path: '/',\n            name: 'app',\n            title: '首页',\n            description: '应用首页'\n        }\n    ]\n}\n```\n\n3. use in your page\n\n`npm start`启动项目\n\n```ts\nimport { history， pathFactory } from 'umi';\n// import { history， pathFactory } from '@alipay/bigfish';\n\nhistory.push(pathFactory.app.welcome());\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhanba%2Fumi-plugin-typed-route","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhanba%2Fumi-plugin-typed-route","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhanba%2Fumi-plugin-typed-route/lists"}