{"id":13623090,"url":"https://github.com/zack24q/vue-navigation","last_synced_at":"2026-01-14T20:53:30.924Z","repository":{"id":41322044,"uuid":"85287935","full_name":"zack24q/vue-navigation","owner":"zack24q","description":"A page navigation library, record routes and cache pages, like native app navigation. 一个页面导航库，记录路由并缓存页面，像原生APP导航一样。","archived":false,"fork":false,"pushed_at":"2018-09-28T06:53:42.000Z","size":2302,"stargazers_count":1023,"open_issues_count":34,"forks_count":182,"subscribers_count":42,"default_branch":"master","last_synced_at":"2025-10-09T04:52:22.751Z","etag":null,"topics":["cache","navigation","page","vue","vue-router"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zack24q.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-17T08:22:41.000Z","updated_at":"2025-09-15T06:40:42.000Z","dependencies_parsed_at":"2022-08-10T01:54:16.946Z","dependency_job_id":null,"html_url":"https://github.com/zack24q/vue-navigation","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/zack24q/vue-navigation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zack24q%2Fvue-navigation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zack24q%2Fvue-navigation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zack24q%2Fvue-navigation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zack24q%2Fvue-navigation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zack24q","download_url":"https://codeload.github.com/zack24q/vue-navigation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zack24q%2Fvue-navigation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28434500,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cache","navigation","page","vue","vue-router"],"created_at":"2024-08-01T21:01:27.955Z","updated_at":"2026-01-14T20:53:30.896Z","avatar_url":"https://github.com/zack24q.png","language":"JavaScript","funding_links":[],"categories":["公用事业","Components \u0026 Libraries","JavaScript","Utilities","Utilities [🔝](#readme)"],"sub_categories":["页面导航","Utilities","Page Navigation"],"readme":"# vue-navigation\n\n[![npm](https://img.shields.io/npm/dm/vue-navigation.svg)](https://www.npmjs.com/package/vue-navigation)\n[![npm](https://img.shields.io/npm/v/vue-navigation.svg)](https://www.npmjs.com/package/vue-navigation)\u003c!-- [![npm (tag)](https://img.shields.io/npm/v/vue-navigation/next.svg)](https://www.npmjs.com/package/vue-navigation) --\u003e\n[![npm](https://img.shields.io/npm/l/vue-navigation.svg)](https://www.npmjs.com/package/vue-navigation)\n[![Github file size](https://img.shields.io/github/size/zack24q/vue-navigation/dist/vue-navigation.esm.min.js.svg)](https://github.com/zack24q/vue-navigation/blob/master/dist/vue-navigation.esm.min.js)\n\n\u003e require [vue](https://github.com/vuejs/vue) `2.x` and [vue-router](https://github.com/vuejs/vue-router) `2.x`.\n\n[中文文档](https://github.com/zack24q/vue-navigation/blob/master/README_CN.md)\n\nvue-navigation default behavior is similar to native mobile app (A、B、C are pages):\n\n1. A forward to B, then forward to C;\n2. C back to B, B will **recover from cache**;\n3. B forward to C again, C will **rebuild, not recover from cache**;\n4. C forward to A, A will **build, now the route contains two A instance**.\n\n**!important: vue-navigation adds a key to the url to distinguish the route. The default name of the key is VNK, which can be modified.**\n\n### DEMO\n\n[DEMO](https://zack24q.github.io/vue-navigation/examples/)\n\n[CODE](https://github.com/zack24q/vue-navigation/tree/master/examples)\n\n## Installing\n\n```bash\nnpm i -S vue-navigation\n```\n\nor\n\n```bash\nyarn add vue-navigation\n```\n\n## Usage\n\n### Basic Usage\n\nmain.js\n\n```javascript\nimport Vue from 'vue'\nimport router from './router' // vue-router instance\nimport Navigation from 'vue-navigation'\n\nVue.use(Navigation, {router})\n// bootstrap your app...\n```\nApp.vue\n\n```vue\n\u003ctemplate\u003e\n  \u003cnavigation\u003e\n    \u003crouter-view\u003e\u003c/router-view\u003e\n  \u003c/navigation\u003e\n\u003c/template\u003e\n```\n\n### Use with vuex2\n\nmain.js\n\n```javascript\nimport Vue from 'vue'\nimport router from './router' // vue-router instance\nimport store from './store' // vuex store instance\nimport Navigation from 'vue-navigation'\n\nVue.use(Navigation, {router, store})\n// bootstrap your app...\n```\n\nAfter passing in `store`, `vue-navigation` will register a module in `store` (default module name is `navigation`), and commit `navigation/FORWARD` or `navigation/BACK` or `navigation/REFRESH` when the page jumps.\n\n## Options\n\nOnly `router` is required.\n\n```javascript\nVue.use(Navigation, {router, store, moduleName: 'navigation', keyName: 'VNK'})\n```\n\n## Events\nfunctions: [ `on` | `once` | `off` ]\n\nevent types: [ `forward` | `back` | `replace` | `refresh` | `reset` ]\n\nparameter( `to` | `from` ) properties:\n- `name`\n  - type: string\n  - desc: name of the route(contains the key)\n- `route`\n  - type: object\n  - desc: vue-route`s route object\n\n```javascript\nthis.$navigation.on('forward', (to, from) =\u003e {})\nthis.$navigation.once('back', (to, from) =\u003e {})\nthis.$navigation.on('replace', (to, from) =\u003e {})\nthis.$navigation.off('refresh', (to, from) =\u003e {})\nthis.$navigation.on('reset', () =\u003e {})\n```\n\n## Methods\n\nUse `Vue.navigation` in global environment or use `this.$navigation` in vue instance.\n\n- `getRoutes()` get the routing records\n- `cleanRoutes()` clean the routing records\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzack24q%2Fvue-navigation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzack24q%2Fvue-navigation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzack24q%2Fvue-navigation/lists"}