From 3047798a55d61cc43f6ad5447364459f121f7586 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Tue, 11 Aug 2020 17:36:08 +0200 Subject: [PATCH 01/15] chore(changelog): 3.4.3 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c13dd77c..09b001c1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [3.4.3](https://github.com/vuejs/vue-router/compare/v3.4.2...v3.4.3) (2020-08-11) + +- Revert 4fbaa9f7880276e661227442ef5923131a589210: "fix: keep repeated params in query/hash relative locations" Closes #3289 + ## [3.4.2](https://github.com/vuejs/vue-router/compare/v3.4.1...v3.4.2) (2020-08-07) ### Bug Fixes From fda70673397a18f45c9423ee9f4a775ca6096c44 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 13 Aug 2020 13:42:18 +0200 Subject: [PATCH 02/15] fix(types): add missing NavigationFailure types Close #3293 --- src/util/errors.js | 1 + types/index.d.ts | 4 +++- types/router.d.ts | 25 +++++++++++++++++-------- types/test/index.ts | 31 +++++++++++++++++++++++++++---- 4 files changed, 48 insertions(+), 13 deletions(-) diff --git a/src/util/errors.js b/src/util/errors.js index bacf6881e..a61f6eea3 100644 --- a/src/util/errors.js +++ b/src/util/errors.js @@ -1,3 +1,4 @@ +// When changing thing, also edit router.d.ts export const NavigationFailureType = { redirected: 2, aborted: 4, diff --git a/types/index.d.ts b/types/index.d.ts index 649303649..504f2b56a 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -13,5 +13,7 @@ export { Location, Route, NavigationGuard, - NavigationGuardNext + NavigationGuardNext, + NavigationFailureType, + NavigationFailure } from './router' diff --git a/types/router.d.ts b/types/router.d.ts index 07f912eb6..49da2a7f3 100644 --- a/types/router.d.ts +++ b/types/router.d.ts @@ -21,7 +21,7 @@ export declare class VueRouter { constructor(options?: RouterOptions) app: Vue - options: RouterOptions; + options: RouterOptions mode: RouterMode currentRoute: Route @@ -63,15 +63,24 @@ export declare class VueRouter { static install: PluginFunction static version: string - static isNavigationFailure: (error: any, type?: NavigationFailureTypeE) => error is Error - static NavigationFailureType: NavigationFailureTypeE + static isNavigationFailure: ( + error: any, + type?: number + ) => error is NavigationFailure + static NavigationFailureType: NavigationFailureType } -export enum NavigationFailureTypeE { - redirected = 1, - aborted = 2, - cancelled = 3, - duplicated = 4 +export enum NavigationFailureType { + redirected= 2, + aborted= 4, + cancelled= 8, + duplicated= 16 +} + +export interface NavigationFailure extends Error { + to: Route + from: Route + type: number } type Position = { x: number; y: number } diff --git a/types/test/index.ts b/types/test/index.ts index 382953c19..c8e8331ff 100644 --- a/types/test/index.ts +++ b/types/test/index.ts @@ -1,7 +1,13 @@ import Vue, { ComponentOptions, AsyncComponent } from 'vue' import VueRouter from '../index' -import { Route, RouteRecord, RedirectOption } from '../index' +import { + Route, + RouteRecord, + RedirectOption, + NavigationFailure, + NavigationFailureType +} from '../index' Vue.use(VueRouter) @@ -11,6 +17,14 @@ const Bar = { template: '
bar
' } const Abc = { template: '
abc
' } const Async = () => Promise.resolve({ template: '
async
' }) +let err: any +if (VueRouter.isNavigationFailure(err, NavigationFailureType.aborted)) { + err.from.fullPath.split('/') +} + +let navigationFailure = new Error() as NavigationFailure +navigationFailure.to.fullPath.split('/') + const Hook: ComponentOptions = { template: '
hook
', @@ -181,8 +195,16 @@ router.push({ }) router.replace({ name: 'home' }) -router.push('/', () => {}, () => {}) -router.replace('/foo', () => {}, () => {}) +router.push( + '/', + () => {}, + () => {} +) +router.replace( + '/foo', + () => {}, + () => {} +) // promises @@ -204,7 +226,8 @@ router.forward() const Components: ( | ComponentOptions | typeof Vue - | AsyncComponent)[] = router.getMatchedComponents() + | AsyncComponent +)[] = router.getMatchedComponents() const vm = new Vue({ router, From 975f09b5a11596592e765f505a73945690b616cf Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 24 Aug 2020 15:51:47 +0200 Subject: [PATCH 03/15] build: automate release --- .github/workflows/release-tag.yml | 23 +++++++++++++++++++++++ README.md | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release-tag.yml diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml new file mode 100644 index 000000000..7fdbae077 --- /dev/null +++ b/.github/workflows/release-tag.yml @@ -0,0 +1,23 @@ +on: + push: + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +name: Create Release + +jobs: + build: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@master + - name: Create Release for Tag + id: release_tag + uses: yyx990803/release-tag@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + body: | + Please refer to [CHANGELOG.md](https://github.com/vuejs/vue-router-next/blob/master/CHANGELOG.md) for details. diff --git a/README.md b/README.md index b375363a4..5242c068a 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Get started with the [documentation](http://router.vuejs.org), or play with the ### Development Setup -``` bash +```bash # install deps npm install @@ -61,7 +61,7 @@ Please make sure to read the [Contributing Guide](https://github.com/vuejs/vue/b ## Changelog -Details changes for each release are documented in the [release notes](https://github.com/vuejs/vue-router/releases). +Details changes for each release are documented in the [`CHANGELOG.md file`](https://github.com/vuejs/vue-router/blob/dev/CHANGELOG.md). ## Stay In Touch From af6e7a0c5b9c16f86a769dc44ec8100d9bf79f9d Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 24 Aug 2020 15:55:20 +0200 Subject: [PATCH 04/15] build: correct link [skip ci] --- .github/workflows/release-tag.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index 7fdbae077..268578f3f 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -20,4 +20,4 @@ jobs: with: tag_name: ${{ github.ref }} body: | - Please refer to [CHANGELOG.md](https://github.com/vuejs/vue-router-next/blob/master/CHANGELOG.md) for details. + Please refer to [CHANGELOG.md](https://github.com/vuejs/vue-router/blob/dev/CHANGELOG.md) for details. From c69ff7bd60228fb79acd764c3fdae91015a49103 Mon Sep 17 00:00:00 2001 From: Volodymyr Makukha Date: Mon, 31 Aug 2020 16:32:21 +0300 Subject: [PATCH 05/15] feat(history): Reset history.current when all apps are destroyed (#3298) * feat(history): Reset history.current when all apps are destroyed * test(history): adding restart-app test * refactor: split History.teardown method * refactor: general History.teardown method --- examples/index.html | 1 + examples/restart-app/app.js | 66 +++++++++++++++++++++++++++++++++ examples/restart-app/index.html | 21 +++++++++++ src/history/base.js | 9 ++++- src/index.js | 6 +-- test/e2e/specs/restart-app.js | 45 ++++++++++++++++++++++ 6 files changed, 142 insertions(+), 6 deletions(-) create mode 100644 examples/restart-app/app.js create mode 100644 examples/restart-app/index.html create mode 100644 test/e2e/specs/restart-app.js diff --git a/examples/index.html b/examples/index.html index f9fbf1b9a..5f2cd4f32 100644 --- a/examples/index.html +++ b/examples/index.html @@ -29,6 +29,7 @@

Vue Router Examples

  • Nested Routers
  • Keepalive View
  • Multiple Apps
  • +
  • Restart App
  • diff --git a/examples/restart-app/app.js b/examples/restart-app/app.js new file mode 100644 index 000000000..424affe10 --- /dev/null +++ b/examples/restart-app/app.js @@ -0,0 +1,66 @@ +import Vue from 'vue' +import VueRouter from 'vue-router' + +const Home = { template: '
    home
    ' } +const Foo = { template: '
    foo
    ' } + +const routes = [ + { path: '/', component: Home }, + { path: '/foo', component: Foo } +] + +const router = new VueRouter({ + mode: 'history', + base: __dirname, + routes +}) + +// track number of beforeResolve +const increment = name => { + const counter = document.getElementById(name) + counter.innerHTML++ +} + +document.getElementById('beforeEach').innerHTML = 0 +router.beforeEach((to, from, next) => { + increment('beforeEach') + next() +}) + +document.getElementById('beforeResolve').innerHTML = 0 +router.beforeResolve((to, from, next) => { + increment('beforeResolve') + next() +}) + +document.getElementById('afterEach').innerHTML = 0 +router.afterEach((to, from) => { + increment('afterEach') +}) + +Vue.use(VueRouter) + +let vueInstance +const mountEl = document.getElementById('mount') +const unmountEl = document.getElementById('unmount') + +mountEl.addEventListener('click', () => { + vueInstance = new Vue({ + router, + template: ` +
    +

    Hello "Restart-app"

    +
      +
    • Go to Home
    • +
    • Go to Foo
    • +
    + +
    + ` + }).$mount('#app') +}) + +unmountEl.addEventListener('click', () => { + vueInstance.$destroy() + vueInstance.$el.innerHTML = '' +}) diff --git a/examples/restart-app/index.html b/examples/restart-app/index.html new file mode 100644 index 000000000..c8885ad66 --- /dev/null +++ b/examples/restart-app/index.html @@ -0,0 +1,21 @@ + + +← Examples index + +
    + + + + +
    + +Count beforeEach:
    +Count beforeResolve:
    +Count afterEach:
    + +
    + +
    + + + \ No newline at end of file diff --git a/src/history/base.js b/src/history/base.js index 072cfb8e8..3397e8709 100644 --- a/src/history/base.js +++ b/src/history/base.js @@ -252,11 +252,18 @@ export class History { // Default implementation is empty } - teardownListeners () { + teardown () { + // clean up event listeners + // https://github.com/vuejs/vue-router/issues/2341 this.listeners.forEach(cleanupListener => { cleanupListener() }) this.listeners = [] + + // reset current history route + // https://github.com/vuejs/vue-router/issues/3294 + this.current = START + this.pending = null } } diff --git a/src/index.js b/src/index.js index 22ecff96d..3eda7f778 100644 --- a/src/index.js +++ b/src/index.js @@ -102,11 +102,7 @@ export default class VueRouter { // we do not release the router so it can be reused if (this.app === app) this.app = this.apps[0] || null - if (!this.app) { - // clean up event listeners - // https://github.com/vuejs/vue-router/issues/2341 - this.history.teardownListeners() - } + if (!this.app) this.history.teardown() }) // main app previously initialized diff --git a/test/e2e/specs/restart-app.js b/test/e2e/specs/restart-app.js new file mode 100644 index 000000000..0dca5c3b8 --- /dev/null +++ b/test/e2e/specs/restart-app.js @@ -0,0 +1,45 @@ +const bsStatus = require('../browserstack-send-status') + +module.exports = { + ...bsStatus(), + + '@tags': ['history'], + + basic: function (browser) { + browser + .url('http://localhost:8080/restart-app/') + .waitForElementVisible('#mount', 1000) + .assert.containsText('#beforeEach', '0') + .assert.containsText('#beforeResolve', '0') + .assert.containsText('#afterEach', '0') + + // Mounting will trigger hooks + .click('#mount') + .waitForElementVisible('#app > *', 1000) + .assert.containsText('#beforeEach', '1') + .assert.containsText('#beforeResolve', '1') + .assert.containsText('#afterEach', '1') + .assert.containsText('#view', 'home') + + // Navigate to foo route will trigger hooks + .click('#app li:nth-child(2) a') + .assert.containsText('#beforeEach', '2') + .assert.containsText('#beforeResolve', '2') + .assert.containsText('#afterEach', '2') + .assert.containsText('#view', 'foo') + + // Unmount + .click('#unmount') + .assert.containsText('#app', '') + + // Second mounting will trigger hooks + .click('#mount') + .waitForElementVisible('#app > *', 1000) + .assert.containsText('#beforeEach', '3') + .assert.containsText('#beforeResolve', '3') + .assert.containsText('#afterEach', '3') + .assert.containsText('#view', 'foo') + + .end() + } +} From ecc8e27e5d3e7270d6a7942539d2f7d96308d5cd Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Fri, 4 Sep 2020 19:39:04 +0200 Subject: [PATCH 06/15] fix(types): fix VueRouter.NavigationFailureType --- docs/guide/advanced/navigation-failures.md | 7 ++++--- test/unit/specs/error-handling.spec.js | 2 ++ types/router.d.ts | 12 +++++++----- types/test/index.ts | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/docs/guide/advanced/navigation-failures.md b/docs/guide/advanced/navigation-failures.md index d784a4aec..234b01fa3 100644 --- a/docs/guide/advanced/navigation-failures.md +++ b/docs/guide/advanced/navigation-failures.md @@ -11,15 +11,16 @@ When using `router-link`, Vue Router calls `router.push` to trigger a navigation When using a `router-link` component, **none of these failures will log an error**. However, if you are using `router.push` or `router.replace`, you might come across an _"Uncaught (in promise) Error"_ message followed by a more specific message in your console. Let's understand how to differentiate _Navigation Failures_. ::: tip Background story - In v3.2.0, _Navigation Failures_ were exposed through the two optional callbacks of `router.push`: `onComplete` and `onAbort`. Since version 3.1.0, `router.push` and `router.replace` return a _Promise_ if no `onComplete`/`onAbort` callback is provided. This _Promise_ resolves instead of invoking `onComplete` and rejects instead of invoking `onAbort`. - ::: +In v3.2.0, _Navigation Failures_ were exposed through the two optional callbacks of `router.push`: `onComplete` and `onAbort`. Since version 3.1.0, `router.push` and `router.replace` return a _Promise_ if no `onComplete`/`onAbort` callback is provided. This _Promise_ resolves instead of invoking `onComplete` and rejects instead of invoking `onAbort`. +::: ## Detecting Navigation Failures _Navigation Failures_ are `Error` instances with a few extra properties. To check if an error comes from the Router, use the `isNavigationFailure` function: ```js -import { NavigationFailureType, isNavigationFailure } from 'vue-router' +import VueRouter from 'vue-router' +const { isNavigationFailure, NavigationFailureType } = VueRouter // trying to access the admin page router.push('/admin').catch(failure => { diff --git a/test/unit/specs/error-handling.spec.js b/test/unit/specs/error-handling.spec.js index 2f0589f4d..1d2b35a95 100644 --- a/test/unit/specs/error-handling.spec.js +++ b/test/unit/specs/error-handling.spec.js @@ -57,6 +57,8 @@ describe('error handling', () => { router.push('/foo') router.push('/foo').catch(err => { expect(err.type).toBe(NavigationFailureType.duplicated) + expect(VueRouter.isNavigationFailure(err)).toBe(true) + expect(VueRouter.isNavigationFailure(err, NavigationFailureType.duplicated)).toBe(true) done() }) }) diff --git a/types/router.d.ts b/types/router.d.ts index 49da2a7f3..b587bf3e1 100644 --- a/types/router.d.ts +++ b/types/router.d.ts @@ -67,14 +67,16 @@ export declare class VueRouter { error: any, type?: number ) => error is NavigationFailure - static NavigationFailureType: NavigationFailureType + static NavigationFailureType: { + [k in keyof typeof NavigationFailureType]: NavigationFailureType + } } export enum NavigationFailureType { - redirected= 2, - aborted= 4, - cancelled= 8, - duplicated= 16 + redirected = 2, + aborted = 4, + cancelled = 8, + duplicated = 16 } export interface NavigationFailure extends Error { diff --git a/types/test/index.ts b/types/test/index.ts index c8e8331ff..3405e0765 100644 --- a/types/test/index.ts +++ b/types/test/index.ts @@ -18,7 +18,7 @@ const Abc = { template: '
    abc
    ' } const Async = () => Promise.resolve({ template: '
    async
    ' }) let err: any -if (VueRouter.isNavigationFailure(err, NavigationFailureType.aborted)) { +if (VueRouter.isNavigationFailure(err, VueRouter.NavigationFailureType.aborted)) { err.from.fullPath.split('/') } From e52d6482606283c13fe62e2b01cf445b4495154a Mon Sep 17 00:00:00 2001 From: Ugo Cottin Date: Mon, 14 Sep 2020 16:48:42 +0200 Subject: [PATCH 07/15] docs(fr): correction of nested routes and components (#3322) Co-authored-by: Eduardo San Martin Morote --- docs/fr/guide/essentials/nested-routes.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/fr/guide/essentials/nested-routes.md b/docs/fr/guide/essentials/nested-routes.md index be0fc9cfb..fa513fb64 100644 --- a/docs/fr/guide/essentials/nested-routes.md +++ b/docs/fr/guide/essentials/nested-routes.md @@ -58,13 +58,13 @@ const router = new VueRouter({ { // `UserProfile` va être rendu à l'intérieur du `` de `User` // quand `/utilisateur/:id/profil` concorde - path: 'profile', + path: 'profil', component: UserProfile }, { // `UserPosts` va être rendu à l'intérieur du `` de `User` // quand `/utilisateur/:id/billets` concorde - path: 'posts', + path: 'billets', component: UserPosts } ] @@ -85,7 +85,7 @@ const router = new VueRouter({ { path: '/utilisateur/:id', component: User, children: [ - // `UserProfile` va être rendu à l'intérieur du `` de `User` + // `UserHome` va être rendu à l'intérieur du `` de `User` // quand `/utilisateur/:id` concorde { path: '', component: UserHome }, From b8a6d60af24fc66d399014ae86b53350a9f0f395 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Tue, 15 Sep 2020 10:18:29 +0200 Subject: [PATCH 08/15] docs: add custom theme for ads --- docs/.vuepress/config.js | 6 +- docs/.vuepress/theme/Layout.vue | 36 ++++++ .../.vuepress/theme/components/BuySellAds.vue | 110 ++++++++++++++++++ docs/.vuepress/theme/components/CarbonAds.vue | 64 ++++++++++ docs/.vuepress/theme/index.js | 3 + 5 files changed, 218 insertions(+), 1 deletion(-) create mode 100644 docs/.vuepress/theme/Layout.vue create mode 100644 docs/.vuepress/theme/components/BuySellAds.vue create mode 100644 docs/.vuepress/theme/components/CarbonAds.vue create mode 100644 docs/.vuepress/theme/index.js diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 92de6c543..73fa124be 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -53,7 +53,7 @@ module.exports = ctx => ({ } ] ], - theme: '@vuepress/vue', + // theme: '@vuepress/vue', plugins: [ [ '@vuepress/pwa', @@ -70,6 +70,10 @@ module.exports = ctx => ({ indexName: 'vue-router' } : null, + carbonAds: { + serve: 'CEBICK3I', + placement: 'routervuejsorg' + }, repo: 'vuejs/vue-router', docsDir: 'docs', smoothScroll: true, diff --git a/docs/.vuepress/theme/Layout.vue b/docs/.vuepress/theme/Layout.vue new file mode 100644 index 000000000..784a273a0 --- /dev/null +++ b/docs/.vuepress/theme/Layout.vue @@ -0,0 +1,36 @@ + + + diff --git a/docs/.vuepress/theme/components/BuySellAds.vue b/docs/.vuepress/theme/components/BuySellAds.vue new file mode 100644 index 000000000..94c167dc0 --- /dev/null +++ b/docs/.vuepress/theme/components/BuySellAds.vue @@ -0,0 +1,110 @@ + + + + + diff --git a/docs/.vuepress/theme/components/CarbonAds.vue b/docs/.vuepress/theme/components/CarbonAds.vue new file mode 100644 index 000000000..3c1115420 --- /dev/null +++ b/docs/.vuepress/theme/components/CarbonAds.vue @@ -0,0 +1,64 @@ + + + + + diff --git a/docs/.vuepress/theme/index.js b/docs/.vuepress/theme/index.js new file mode 100644 index 000000000..b91b8a576 --- /dev/null +++ b/docs/.vuepress/theme/index.js @@ -0,0 +1,3 @@ +module.exports = { + extend: '@vuepress/theme-default' +} From ccbd917458e73a4eeff9158674893b16de7f79c1 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Tue, 15 Sep 2020 16:04:30 +0200 Subject: [PATCH 09/15] docs: fix ads --- docs/.vuepress/config.js | 3 ++- docs/.vuepress/theme/Layout.vue | 4 ++-- docs/.vuepress/theme/components/BuySellAds.vue | 4 ++-- docs/.vuepress/theme/components/CarbonAds.vue | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 73fa124be..79a145b9e 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -71,7 +71,8 @@ module.exports = ctx => ({ } : null, carbonAds: { - serve: 'CEBICK3I', + carbon: 'CEBICK3I', + custom: 'CEBICK3M', placement: 'routervuejsorg' }, repo: 'vuejs/vue-router', diff --git a/docs/.vuepress/theme/Layout.vue b/docs/.vuepress/theme/Layout.vue index 784a273a0..a9c034ad9 100644 --- a/docs/.vuepress/theme/Layout.vue +++ b/docs/.vuepress/theme/Layout.vue @@ -4,7 +4,7 @@ @@ -12,7 +12,7 @@ diff --git a/docs/.vuepress/theme/components/BuySellAds.vue b/docs/.vuepress/theme/components/BuySellAds.vue index 94c167dc0..fc0ac0b4f 100644 --- a/docs/.vuepress/theme/components/BuySellAds.vue +++ b/docs/.vuepress/theme/components/BuySellAds.vue @@ -11,7 +11,7 @@ const ID = 'bsa-cpc-script' export default { name: 'BuySellAds', props: { - serve: { + code: { type: String, required: true }, @@ -24,7 +24,7 @@ export default { methods: { load() { if (typeof _bsa !== 'undefined' && _bsa) { - _bsa.init('default', this.serve, `placement:${this.placement}`, { + _bsa.init('default', this.code, `placement:${this.placement}`, { target: '.bsa-cpc', align: 'horizontal', disable_css: 'true' diff --git a/docs/.vuepress/theme/components/CarbonAds.vue b/docs/.vuepress/theme/components/CarbonAds.vue index 3c1115420..1654acb91 100644 --- a/docs/.vuepress/theme/components/CarbonAds.vue +++ b/docs/.vuepress/theme/components/CarbonAds.vue @@ -6,7 +6,7 @@ export default { name: 'CarbonAds', props: { - serve: { + code: { type: String, required: true }, @@ -19,7 +19,7 @@ export default { mounted() { const s = document.createElement('script') s.id = '_carbonads_js' - s.src = `//cdn.carbonads.com/carbon.js?serve=${this.serve}&placement=${this.placement}` + s.src = `//cdn.carbonads.com/carbon.js?serve=${this.code}&placement=${this.placement}` this.$el.appendChild(s) } } From ddc29ac7df3a5e6ec670f7d5a0744c66a60796c6 Mon Sep 17 00:00:00 2001 From: fanhualu <42510043+fanhualu@users.noreply.github.com> Date: Tue, 22 Sep 2020 19:10:19 +0800 Subject: [PATCH 10/15] docs: typo (#3327) --- docs/zh/guide/essentials/redirect-and-alias.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/guide/essentials/redirect-and-alias.md b/docs/zh/guide/essentials/redirect-and-alias.md index a31810321..811dae65c 100644 --- a/docs/zh/guide/essentials/redirect-and-alias.md +++ b/docs/zh/guide/essentials/redirect-and-alias.md @@ -35,7 +35,7 @@ const router = new VueRouter({ }) ``` -注意[导航守卫](../advanced/navigation-guards.md)并没有应用在跳转路由上,而仅仅应用在其目标上。在下面这个例子中,为 `/a` 路由添加一个 `beforeEach` 守卫并不会有任何效果。 +注意[导航守卫](../advanced/navigation-guards.md)并没有应用在跳转路由上,而仅仅应用在其目标上。在下面这个例子中,为 `/a` 路由添加一个 `beforeEnter` 守卫并不会有任何效果。 其它高级用法,请参考[例子](https://github.com/vuejs/vue-router/blob/dev/examples/redirect/app.js)。 From 036fcedf8f03474e50660b12af3b643236bcdd67 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 24 Sep 2020 15:37:27 +0200 Subject: [PATCH 11/15] test: add assertion for initial redirection --- test/unit/specs/error-handling.spec.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/test/unit/specs/error-handling.spec.js b/test/unit/specs/error-handling.spec.js index 1d2b35a95..52d61e210 100644 --- a/test/unit/specs/error-handling.spec.js +++ b/test/unit/specs/error-handling.spec.js @@ -58,7 +58,9 @@ describe('error handling', () => { router.push('/foo').catch(err => { expect(err.type).toBe(NavigationFailureType.duplicated) expect(VueRouter.isNavigationFailure(err)).toBe(true) - expect(VueRouter.isNavigationFailure(err, NavigationFailureType.duplicated)).toBe(true) + expect( + VueRouter.isNavigationFailure(err, NavigationFailureType.duplicated) + ).toBe(true) done() }) }) @@ -156,7 +158,10 @@ describe('error handling', () => { // https://github.com/vuejs/vue-router/issues/3225 it('should trigger onReady onSuccess when redirecting', done => { const router = new VueRouter({ - routes: [{ path: '/', component: {}}, { path: '/foo', component: {}}] + routes: [ + { path: '/', component: {}}, + { path: '/foo', component: {}} + ] }) const onError = jasmine.createSpy('onError') @@ -177,6 +182,7 @@ describe('error handling', () => { .push('/') .catch(pushCatch) .finally(() => { + expect(router.currentRoute.path).toBe('/foo') expect(onReadyFail).not.toHaveBeenCalled() // in 3.2.0 it was called with undefined // expect(pushCatch).not.toHaveBeenCalled() @@ -188,12 +194,14 @@ describe('error handling', () => { it('should trigger onError if error is thrown inside redirect option', done => { const error = new Error('foo') - const config = [{ - path: '/oldpath/:part', - redirect: (to) => { - throw error + const config = [ + { + path: '/oldpath/:part', + redirect: to => { + throw error + } } - }] + ] const router = new VueRouter({ routes: config From 4da7021a1900fc0f36f362dc41e8132597c3b162 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 24 Sep 2020 16:06:18 +0200 Subject: [PATCH 12/15] fix(abstract): call afterHooks with go Fix #3250 --- src/history/abstract.js | 4 +++ test/unit/specs/abstract-history.spec.js | 42 ++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 test/unit/specs/abstract-history.spec.js diff --git a/src/history/abstract.js b/src/history/abstract.js index 325e4b954..c7d80708f 100644 --- a/src/history/abstract.js +++ b/src/history/abstract.js @@ -46,8 +46,12 @@ export class AbstractHistory extends History { this.confirmTransition( route, () => { + const prev = this.current this.index = targetIndex this.updateRoute(route) + this.router.afterHooks.forEach(hook => { + hook && hook(route, prev) + }) }, err => { if (isNavigationFailure(err, NavigationFailureType.duplicated)) { diff --git a/test/unit/specs/abstract-history.spec.js b/test/unit/specs/abstract-history.spec.js new file mode 100644 index 000000000..7835ab1e9 --- /dev/null +++ b/test/unit/specs/abstract-history.spec.js @@ -0,0 +1,42 @@ +import Vue from 'vue' +import VueRouter from '../../../src/index' + +Vue.use(VueRouter) + +const delay = t => new Promise(resolve => setTimeout(resolve, t)) + +describe('abstract history', () => { + it('run afterEach after initial navigation', done => { + const router = new VueRouter({ mode: 'abstract' }) + const afterEach = jasmine.createSpy('afterEach') + const onReady = jasmine.createSpy('ready') + const onError = jasmine.createSpy('error') + router.afterEach(afterEach) + router.onReady(onReady, onError) + + router.push('/').finally(() => { + expect(onReady).toHaveBeenCalled() + expect(onError).not.toHaveBeenCalled() + expect(afterEach).toHaveBeenCalled() + done() + }) + }) + + it('run afterEach after router.go', done => { + const router = new VueRouter({ mode: 'abstract' }) + const afterEach = jasmine.createSpy('afterEach') + + router + .push('/') + .then(() => router.push('/foo')) + .then(() => { + router.afterEach(afterEach) + router.go(-1) + return delay(30) + }) + .finally(() => { + expect(afterEach).toHaveBeenCalled() + done() + }) + }) +}) From 893d86b3c45120d0e13f8b989d28dbbec57df493 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 24 Sep 2020 17:02:58 +0200 Subject: [PATCH 13/15] fix(history): mark redundant navigation as pending Fix #3133 --- examples/basic/app.js | 12 ++++++++++++ src/history/base.js | 2 +- test/e2e/specs/basic.js | 18 ++++++++++++++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/examples/basic/app.js b/examples/basic/app.js index ba13679f2..2e22b6763 100644 --- a/examples/basic/app.js +++ b/examples/basic/app.js @@ -48,6 +48,16 @@ const router = new VueRouter({ ] }) +router.beforeEach((to, from, next) => { + if (to.query.delay) { + setTimeout(() => { + next() + }, Number(to.query.delay)) + } else { + next() + } +}) + // 4. Create and mount root instance. // Make sure to inject the router. // Route components will be rendered inside . @@ -73,6 +83,8 @@ const vueInstance = new Vue({
  • /foo (replace)
  • +
  • / (delay of 500ms)
  • +
  • /foo (delay of 500ms)
  • {{ n }}
    diff --git a/src/history/base.js b/src/history/base.js index 3397e8709..70158e395 100644 --- a/src/history/base.js +++ b/src/history/base.js @@ -137,6 +137,7 @@ export class History { confirmTransition (route: Route, onComplete: Function, onAbort?: Function) { const current = this.current + this.pending = route const abort = err => { // changed after adding errors with // https://github.com/vuejs/vue-router/pull/3047 before that change, @@ -183,7 +184,6 @@ export class History { resolveAsyncComponents(activated) ) - this.pending = route const iterator = (hook: NavigationGuard, next) => { if (this.pending !== route) { return abort(createNavigationCancelledError(current, route)) diff --git a/test/e2e/specs/basic.js b/test/e2e/specs/basic.js index f4d7d6f51..25d3fed3f 100644 --- a/test/e2e/specs/basic.js +++ b/test/e2e/specs/basic.js @@ -9,8 +9,8 @@ module.exports = { browser .url('http://localhost:8080/basic/') .waitForElementVisible('#app', 1000) - .assert.count('li', 9) - .assert.count('li a', 9) + .assert.count('li', 11) + .assert.count('li a', 11) // assert correct href with base .assert.attributeContains('li:nth-child(1) a', 'href', '/basic/') .assert.attributeContains('li:nth-child(2) a', 'href', '/basic/foo') @@ -76,5 +76,19 @@ module.exports = { .assert.containsText('#popstate-count', '0 popstate listeners') .end() + }, + + 'cancelling ongoing navigations': function (browser) { + browser + .url('http://localhost:8080/basic/?delay=200') + .waitForElementVisible('#app', 1000) + .assert.containsText('.view', 'home') + // go to foo with a delay + .click('li:nth-child(11) a') + .click('li:nth-child(10) a') + .waitFor(300) + // we should stay at /basic after the delay + .assert.urlEquals('http://localhost:8080/basic/?delay=200') + .assert.containsText('.view', 'home') } } From 6bc552bdfc1c3203150a08a36e71e2e56e78d61f Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 24 Sep 2020 19:31:26 +0200 Subject: [PATCH 14/15] build: bundle 3.4.4 --- dist/vue-router.common.js | 26 +++++++++++++++++--------- dist/vue-router.esm.browser.js | 26 +++++++++++++++++--------- dist/vue-router.esm.browser.min.js | 4 ++-- dist/vue-router.esm.js | 26 +++++++++++++++++--------- dist/vue-router.js | 26 +++++++++++++++++--------- dist/vue-router.min.js | 4 ++-- 6 files changed, 72 insertions(+), 40 deletions(-) diff --git a/dist/vue-router.common.js b/dist/vue-router.common.js index 64a6320f7..7a405fc01 100644 --- a/dist/vue-router.common.js +++ b/dist/vue-router.common.js @@ -1,5 +1,5 @@ /*! - * vue-router v3.4.3 + * vue-router v3.4.4 * (c) 2020 Evan You * @license MIT */ @@ -1908,6 +1908,7 @@ function runQueue (queue, fn, cb) { step(0); } +// When changing thing, also edit router.d.ts var NavigationFailureType = { redirected: 2, aborted: 4, @@ -2196,6 +2197,7 @@ History.prototype.confirmTransition = function confirmTransition (route, onCompl var this$1 = this; var current = this.current; + this.pending = route; var abort = function (err) { // changed after adding errors with // https://github.com/vuejs/vue-router/pull/3047 before that change, @@ -2245,7 +2247,6 @@ History.prototype.confirmTransition = function confirmTransition (route, onCompl resolveAsyncComponents(activated) ); - this.pending = route; var iterator = function (hook, next) { if (this$1.pending !== route) { return abort(createNavigationCancelledError(current, route)) @@ -2314,11 +2315,18 @@ History.prototype.setupListeners = function setupListeners () { // Default implementation is empty }; -History.prototype.teardownListeners = function teardownListeners () { +History.prototype.teardown = function teardown () { + // clean up event listeners + // https://github.com/vuejs/vue-router/issues/2341 this.listeners.forEach(function (cleanupListener) { cleanupListener(); }); this.listeners = []; + + // reset current history route + // https://github.com/vuejs/vue-router/issues/3294 + this.current = START; + this.pending = null; }; function normalizeBase (base) { @@ -2782,8 +2790,12 @@ var AbstractHistory = /*@__PURE__*/(function (History) { this.confirmTransition( route, function () { + var prev = this$1.current; this$1.index = targetIndex; this$1.updateRoute(route); + this$1.router.afterHooks.forEach(function (hook) { + hook && hook(route, prev); + }); }, function (err) { if (isNavigationFailure(err, NavigationFailureType.duplicated)) { @@ -2878,11 +2890,7 @@ VueRouter.prototype.init = function init (app /* Vue component instance */) { // we do not release the router so it can be reused if (this$1.app === app) { this$1.app = this$1.apps[0] || null; } - if (!this$1.app) { - // clean up event listeners - // https://github.com/vuejs/vue-router/issues/2341 - this$1.history.teardownListeners(); - } + if (!this$1.app) { this$1.history.teardown(); } }); // main app previously initialized @@ -3044,7 +3052,7 @@ function createHref (base, fullPath, mode) { } VueRouter.install = install; -VueRouter.version = '3.4.3'; +VueRouter.version = '3.4.4'; VueRouter.isNavigationFailure = isNavigationFailure; VueRouter.NavigationFailureType = NavigationFailureType; diff --git a/dist/vue-router.esm.browser.js b/dist/vue-router.esm.browser.js index 0ec72f100..7de329b2c 100644 --- a/dist/vue-router.esm.browser.js +++ b/dist/vue-router.esm.browser.js @@ -1,5 +1,5 @@ /*! - * vue-router v3.4.3 + * vue-router v3.4.4 * (c) 2020 Evan You * @license MIT */ @@ -1885,6 +1885,7 @@ function runQueue (queue, fn, cb) { step(0); } +// When changing thing, also edit router.d.ts const NavigationFailureType = { redirected: 2, aborted: 4, @@ -2191,6 +2192,7 @@ class History { confirmTransition (route, onComplete, onAbort) { const current = this.current; + this.pending = route; const abort = err => { // changed after adding errors with // https://github.com/vuejs/vue-router/pull/3047 before that change, @@ -2237,7 +2239,6 @@ class History { resolveAsyncComponents(activated) ); - this.pending = route; const iterator = (hook, next) => { if (this.pending !== route) { return abort(createNavigationCancelledError(current, route)) @@ -2306,11 +2307,18 @@ class History { // Default implementation is empty } - teardownListeners () { + teardown () { + // clean up event listeners + // https://github.com/vuejs/vue-router/issues/2341 this.listeners.forEach(cleanupListener => { cleanupListener(); }); this.listeners = []; + + // reset current history route + // https://github.com/vuejs/vue-router/issues/3294 + this.current = START; + this.pending = null; } } @@ -2742,8 +2750,12 @@ class AbstractHistory extends History { this.confirmTransition( route, () => { + const prev = this.current; this.index = targetIndex; this.updateRoute(route); + this.router.afterHooks.forEach(hook => { + hook && hook(route, prev); + }); }, err => { if (isNavigationFailure(err, NavigationFailureType.duplicated)) { @@ -2849,11 +2861,7 @@ class VueRouter { // we do not release the router so it can be reused if (this.app === app) this.app = this.apps[0] || null; - if (!this.app) { - // clean up event listeners - // https://github.com/vuejs/vue-router/issues/2341 - this.history.teardownListeners(); - } + if (!this.app) this.history.teardown(); }); // main app previously initialized @@ -3010,7 +3018,7 @@ function createHref (base, fullPath, mode) { } VueRouter.install = install; -VueRouter.version = '3.4.3'; +VueRouter.version = '3.4.4'; VueRouter.isNavigationFailure = isNavigationFailure; VueRouter.NavigationFailureType = NavigationFailureType; diff --git a/dist/vue-router.esm.browser.min.js b/dist/vue-router.esm.browser.min.js index a37205b85..fccc15c21 100644 --- a/dist/vue-router.esm.browser.min.js +++ b/dist/vue-router.esm.browser.min.js @@ -1,6 +1,6 @@ /*! - * vue-router v3.4.3 + * vue-router v3.4.4 * (c) 2020 Evan You * @license MIT */ -function t(t,e){for(const n in e)t[n]=e[n];return t}var e={name:"RouterView",functional:!0,props:{name:{type:String,default:"default"}},render(e,{props:r,children:o,parent:i,data:s}){s.routerView=!0;const a=i.$createElement,c=r.name,u=i.$route,h=i._routerViewCache||(i._routerViewCache={});let l=0,p=!1;for(;i&&i._routerRoot!==i;){const t=i.$vnode?i.$vnode.data:{};t.routerView&&l++,t.keepAlive&&i._directInactive&&i._inactive&&(p=!0),i=i.$parent}if(s.routerViewDepth=l,p){const t=h[c],e=t&&t.component;return e?(t.configProps&&n(e,s,t.route,t.configProps),a(e,s,o)):a()}const f=u.matched[l],d=f&&f.components[c];if(!f||!d)return h[c]=null,a();h[c]={component:d},s.registerRouteInstance=(t,e)=>{const n=f.instances[c];(e&&n!==t||!e&&n===t)&&(f.instances[c]=e)},(s.hook||(s.hook={})).prepatch=(t,e)=>{f.instances[c]=e.componentInstance},s.hook.init=t=>{t.data.keepAlive&&t.componentInstance&&t.componentInstance!==f.instances[c]&&(f.instances[c]=t.componentInstance)};const y=f.props&&f.props[c];return y&&(t(h[c],{route:u,configProps:y}),n(d,s,u,y)),a(d,s,o)}};function n(e,n,r,o){let i=n.props=function(t,e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0}}(r,o);if(i){i=n.props=t({},i);const r=n.attrs=n.attrs||{};for(const t in i)e.props&&t in e.props||(r[t]=i[t],delete i[t])}}const r=/[!'()*]/g,o=t=>"%"+t.charCodeAt(0).toString(16),i=/%2C/g,s=t=>encodeURIComponent(t).replace(r,o).replace(i,","),a=decodeURIComponent;const c=t=>null==t||"object"==typeof t?t:String(t);function u(t){const e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(t=>{const n=t.replace(/\+/g," ").split("="),r=a(n.shift()),o=n.length>0?a(n.join("=")):null;void 0===e[r]?e[r]=o:Array.isArray(e[r])?e[r].push(o):e[r]=[e[r],o]}),e):e}function h(t){const e=t?Object.keys(t).map(e=>{const n=t[e];if(void 0===n)return"";if(null===n)return s(e);if(Array.isArray(n)){const t=[];return n.forEach(n=>{void 0!==n&&(null===n?t.push(s(e)):t.push(s(e)+"="+s(n)))}),t.join("&")}return s(e)+"="+s(n)}).filter(t=>t.length>0).join("&"):null;return e?`?${e}`:""}const l=/\/?$/;function p(t,e,n,r){const o=r&&r.options.stringifyQuery;let i=e.query||{};try{i=f(i)}catch(t){}const s={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:i,params:e.params||{},fullPath:m(e,o),matched:t?y(t):[]};return n&&(s.redirectedFrom=m(n,o)),Object.freeze(s)}function f(t){if(Array.isArray(t))return t.map(f);if(t&&"object"==typeof t){const e={};for(const n in t)e[n]=f(t[n]);return e}return t}const d=p(null,{path:"/"});function y(t){const e=[];for(;t;)e.unshift(t),t=t.parent;return e}function m({path:t,query:e={},hash:n=""},r){return(t||"/")+(r||h)(e)+n}function g(t,e){return e===d?t===e:!!e&&(t.path&&e.path?t.path.replace(l,"")===e.path.replace(l,"")&&t.hash===e.hash&&w(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&w(t.query,e.query)&&w(t.params,e.params)))}function w(t={},e={}){if(!t||!e)return t===e;const n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(n=>{const r=t[n],o=e[n];return null==r||null==o?r===o:"object"==typeof r&&"object"==typeof o?w(r,o):String(r)===String(o)})}function v(t,e,n){const r=t.charAt(0);if("/"===r)return t;if("?"===r||"#"===r)return e+t;const o=e.split("/");n&&o[o.length-1]||o.pop();const i=t.replace(/^\//,"").split("/");for(let t=0;t=0&&(e=t.slice(r),t=t.slice(0,r));const o=t.indexOf("?");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{path:t,query:n,hash:e}}(i.path||""),a=n&&n.path||"/",h=s.path?v(s.path,a,r||i.append):a,l=function(t,e={},n){const r=n||u;let o;try{o=r(t||"")}catch(t){o={}}for(const t in e){const n=e[t];o[t]=Array.isArray(n)?n.map(c):c(n)}return o}(s.query,i.query,o&&o.options.parseQuery);let p=i.hash||s.hash;return p&&"#"!==p.charAt(0)&&(p=`#${p}`),{_normalized:!0,path:h,query:l,hash:p}}const B=[String,Object],F=[String,Array],H=()=>{};var N={name:"RouterLink",props:{to:{type:B,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,ariaCurrentValue:{type:String,default:"page"},event:{type:F,default:"click"}},render(e){const n=this.$router,r=this.$route,{location:o,route:i,href:s}=n.resolve(this.to,r,this.append),a={},c=n.options.linkActiveClass,u=n.options.linkExactActiveClass,h=null==c?"router-link-active":c,f=null==u?"router-link-exact-active":u,d=null==this.activeClass?h:this.activeClass,y=null==this.exactActiveClass?f:this.exactActiveClass,m=i.redirectedFrom?p(null,V(i.redirectedFrom),null,n):i;a[y]=g(r,m),a[d]=this.exact?a[y]:function(t,e){return 0===t.path.replace(l,"/").indexOf(e.path.replace(l,"/"))&&(!e.hash||t.hash===e.hash)&&function(t,e){for(const n in e)if(!(n in t))return!1;return!0}(t.query,e.query)}(r,m);const w=a[y]?this.ariaCurrentValue:null,v=t=>{z(t)&&(this.replace?n.replace(o,H):n.push(o,H))},b={click:z};Array.isArray(this.event)?this.event.forEach(t=>{b[t]=v}):b[this.event]=v;const x={class:a},R=!this.$scopedSlots.$hasNormal&&this.$scopedSlots.default&&this.$scopedSlots.default({href:s,route:i,navigate:v,isActive:a[d],isExactActive:a[y]});if(R){if(1===R.length)return R[0];if(R.length>1||!R.length)return 0===R.length?e():e("span",{},R)}if("a"===this.tag)x.on=b,x.attrs={href:s,"aria-current":w};else{const e=function t(e){if(e){let n;for(let r=0;r{!function t(e,n,r,o,i,s){const{path:a,name:c}=o;const u=o.pathToRegexpOptions||{};const h=function(t,e,n){n||(t=t.replace(/\/$/,""));return"/"===t[0]?t:null==e?t:b(`${e.path}/${t}`)}(a,i,u.strict);"boolean"==typeof o.caseSensitive&&(u.sensitive=o.caseSensitive);const l={path:h,regex:Q(h,u),components:o.components||{default:o.component},instances:{},name:c,parent:i,matchAs:s,redirect:o.redirect,beforeEnter:o.beforeEnter,meta:o.meta||{},props:null==o.props?{}:o.components?o.props:{default:o.props}};o.children&&o.children.forEach(o=>{const i=s?b(`${s}/${o.path}`):void 0;t(e,n,r,o,l,i)});n[l.path]||(e.push(l.path),n[l.path]=l);if(void 0!==o.alias){const s=Array.isArray(o.alias)?o.alias:[o.alias];for(let a=0;a!t.optional).map(t=>t.name);if("object"!=typeof c.params&&(c.params={}),i&&"object"==typeof i.params)for(const t in i.params)!(t in c.params)&&e.indexOf(t)>-1&&(c.params[t]=i.params[t]);return c.path=M(t.path,c.params),a(t,c,s)}if(c.path){c.params={};for(let t=0;t{window.removeEventListener("popstate",st)}}function ot(t,e,n,r){if(!t.app)return;const o=t.options.scrollBehavior;o&&t.app.$nextTick(()=>{const i=function(){const t=tt();if(t)return nt[t]}(),s=o.call(t,e,n,r?i:null);s&&("function"==typeof s.then?s.then(t=>{lt(t,i)}).catch(t=>{}):lt(s,i))})}function it(){const t=tt();t&&(nt[t]={x:window.pageXOffset,y:window.pageYOffset})}function st(t){it(),t.state&&t.state.key&&et(t.state.key)}function at(t){return ut(t.x)||ut(t.y)}function ct(t){return{x:ut(t.x)?t.x:window.pageXOffset,y:ut(t.y)?t.y:window.pageYOffset}}function ut(t){return"number"==typeof t}const ht=/^#\d/;function lt(t,e){const n="object"==typeof t;if(n&&"string"==typeof t.selector){const n=ht.test(t.selector)?document.getElementById(t.selector.slice(1)):document.querySelector(t.selector);if(n){let o=t.offset&&"object"==typeof t.offset?t.offset:{};e=function(t,e){const n=document.documentElement.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:r.left-n.left-e.x,y:r.top-n.top-e.y}}(n,o={x:ut((r=o).x)?r.x:0,y:ut(r.y)?r.y:0})}else at(t)&&(e=ct(t))}else n&&at(t)&&(e=ct(t));var r;e&&window.scrollTo(e.x,e.y)}const pt=K&&function(){const t=window.navigator.userAgent;return(-1===t.indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&(window.history&&"function"==typeof window.history.pushState)}();function ft(e,n){it();const r=window.history;try{if(n){const n=t({},r.state);n.key=tt(),r.replaceState(n,"",e)}else r.pushState({key:et(G())},"",e)}catch(t){window.location[n?"replace":"assign"](e)}}function dt(t){ft(t,!0)}function yt(t,e,n){const r=o=>{o>=t.length?n():t[o]?e(t[o],()=>{r(o+1)}):r(o+1)};r(0)}const mt={redirected:2,aborted:4,cancelled:8,duplicated:16};function gt(t,e){return vt(t,e,mt.redirected,`Redirected when going from "${t.fullPath}" to "${function(t){if("string"==typeof t)return t;if("path"in t)return t.path;const e={};return bt.forEach(n=>{n in t&&(e[n]=t[n])}),JSON.stringify(e,null,2)}(e)}" via a navigation guard.`)}function wt(t,e){return vt(t,e,mt.cancelled,`Navigation cancelled from "${t.fullPath}" to "${e.fullPath}" with a new navigation.`)}function vt(t,e,n,r){const o=new Error(r);return o._isRouter=!0,o.from=t,o.to=e,o.type=n,o}const bt=["params","query","hash"];function xt(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function Rt(t,e){return xt(t)&&t._isRouter&&(null==e||t.type===e)}function kt(t){return(e,n,r)=>{let o=!1,i=0,s=null;Et(t,(t,e,n,a)=>{if("function"==typeof t&&void 0===t.cid){o=!0,i++;const e=Ct(e=>{(function(t){return t.__esModule||At&&"Module"===t[Symbol.toStringTag]})(e)&&(e=e.default),t.resolved="function"==typeof e?e:D.extend(e),n.components[a]=e,--i<=0&&r()}),c=Ct(t=>{const e=`Failed to resolve async component ${a}: ${t}`;s||(s=xt(t)?t:new Error(e),r(s))});let u;try{u=t(e,c)}catch(t){c(t)}if(u)if("function"==typeof u.then)u.then(e,c);else{const t=u.component;t&&"function"==typeof t.then&&t.then(e,c)}}}),o||r()}}function Et(t,e){return $t(t.map(t=>Object.keys(t.components).map(n=>e(t.components[n],t.instances[n],t,n))))}function $t(t){return Array.prototype.concat.apply([],t)}const At="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function Ct(t){let e=!1;return function(...n){if(!e)return e=!0,t.apply(this,n)}}class Ot{constructor(t,e){this.router=t,this.base=function(t){if(!t)if(K){const e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";"/"!==t.charAt(0)&&(t="/"+t);return t.replace(/\/$/,"")}(e),this.current=d,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[],this.listeners=[]}listen(t){this.cb=t}onReady(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))}onError(t){this.errorCbs.push(t)}transitionTo(t,e,n){let r;try{r=this.router.match(t,this.current)}catch(t){throw this.errorCbs.forEach(e=>{e(t)}),t}this.confirmTransition(r,()=>{const t=this.current;this.updateRoute(r),e&&e(r),this.ensureURL(),this.router.afterHooks.forEach(e=>{e&&e(r,t)}),this.ready||(this.ready=!0,this.readyCbs.forEach(t=>{t(r)}))},t=>{n&&n(t),t&&!this.ready&&(this.ready=!0,Rt(t,mt.redirected)?this.readyCbs.forEach(t=>{t(r)}):this.readyErrorCbs.forEach(e=>{e(t)}))})}confirmTransition(t,e,n){const r=this.current,o=t=>{!Rt(t)&&xt(t)&&(this.errorCbs.length?this.errorCbs.forEach(e=>{e(t)}):console.error(t)),n&&n(t)},i=t.matched.length-1,s=r.matched.length-1;if(g(t,r)&&i===s&&t.matched[i]===r.matched[s])return this.ensureURL(),o(function(t,e){const n=vt(t,e,mt.duplicated,`Avoided redundant navigation to current location: "${t.fullPath}".`);return n.name="NavigationDuplicated",n}(r,t));const{updated:a,deactivated:c,activated:u}=function(t,e){let n;const r=Math.max(t.length,e.length);for(n=0;nt.beforeEnter),kt(u));this.pending=t;const l=(e,n)=>{if(this.pending!==t)return o(wt(r,t));try{e(t,r,e=>{!1===e?(this.ensureURL(!0),o(function(t,e){return vt(t,e,mt.aborted,`Navigation aborted from "${t.fullPath}" to "${e.fullPath}" via a navigation guard.`)}(r,t))):xt(e)?(this.ensureURL(!0),o(e)):"string"==typeof e||"object"==typeof e&&("string"==typeof e.path||"string"==typeof e.name)?(o(gt(r,t)),"object"==typeof e&&e.replace?this.replace(e):this.push(e)):n(e)})}catch(t){o(t)}};yt(h,l,()=>{const n=[];yt(function(t,e,n){return St(t,"beforeRouteEnter",(t,r,o,i)=>(function(t,e,n,r,o){return function(i,s,a){return t(i,s,t=>{"function"==typeof t&&r.push(()=>{!function t(e,n,r,o){n[r]&&!n[r]._isBeingDestroyed?e(n[r]):o()&&setTimeout(()=>{t(e,n,r,o)},16)}(t,e.instances,n,o)}),a(t)})}})(t,o,i,e,n))}(u,n,()=>this.current===t).concat(this.router.resolveHooks),l,()=>{if(this.pending!==t)return o(wt(r,t));this.pending=null,e(t),this.router.app&&this.router.app.$nextTick(()=>{n.forEach(t=>{t()})})})})}updateRoute(t){this.current=t,this.cb&&this.cb(t)}setupListeners(){}teardownListeners(){this.listeners.forEach(t=>{t()}),this.listeners=[]}}function St(t,e,n,r){const o=Et(t,(t,r,o,i)=>{const s=function(t,e){"function"!=typeof t&&(t=D.extend(t));return t.options[e]}(t,e);if(s)return Array.isArray(s)?s.map(t=>n(t,r,o,i)):n(s,r,o,i)});return $t(r?o.reverse():o)}function jt(t,e){if(e)return function(){return t.apply(e,arguments)}}class Lt extends Ot{constructor(t,e){super(t,e),this._startLocation=Tt(this.base)}setupListeners(){if(this.listeners.length>0)return;const t=this.router,e=t.options.scrollBehavior,n=pt&&e;n&&this.listeners.push(rt());const r=()=>{const e=this.current,r=Tt(this.base);this.current===d&&r===this._startLocation||this.transitionTo(r,r=>{n&&ot(t,r,e,!0)})};window.addEventListener("popstate",r),this.listeners.push(()=>{window.removeEventListener("popstate",r)})}go(t){window.history.go(t)}push(t,e,n){const{current:r}=this;this.transitionTo(t,t=>{ft(b(this.base+t.fullPath)),ot(this.router,t,r,!1),e&&e(t)},n)}replace(t,e,n){const{current:r}=this;this.transitionTo(t,t=>{dt(b(this.base+t.fullPath)),ot(this.router,t,r,!1),e&&e(t)},n)}ensureURL(t){if(Tt(this.base)!==this.current.fullPath){const e=b(this.base+this.current.fullPath);t?ft(e):dt(e)}}getCurrentLocation(){return Tt(this.base)}}function Tt(t){let e=decodeURI(window.location.pathname);return t&&0===e.toLowerCase().indexOf(t.toLowerCase())&&(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}class Pt extends Ot{constructor(t,e,n){super(t,e),n&&function(t){const e=Tt(t);if(!/^\/#/.test(e))return window.location.replace(b(t+"/#"+e)),!0}(this.base)||_t()}setupListeners(){if(this.listeners.length>0)return;const t=this.router.options.scrollBehavior,e=pt&&t;e&&this.listeners.push(rt());const n=()=>{const t=this.current;_t()&&this.transitionTo(qt(),n=>{e&&ot(this.router,n,t,!0),pt||Mt(n.fullPath)})},r=pt?"popstate":"hashchange";window.addEventListener(r,n),this.listeners.push(()=>{window.removeEventListener(r,n)})}push(t,e,n){const{current:r}=this;this.transitionTo(t,t=>{It(t.fullPath),ot(this.router,t,r,!1),e&&e(t)},n)}replace(t,e,n){const{current:r}=this;this.transitionTo(t,t=>{Mt(t.fullPath),ot(this.router,t,r,!1),e&&e(t)},n)}go(t){window.history.go(t)}ensureURL(t){const e=this.current.fullPath;qt()!==e&&(t?It(e):Mt(e))}getCurrentLocation(){return qt()}}function _t(){const t=qt();return"/"===t.charAt(0)||(Mt("/"+t),!1)}function qt(){let t=window.location.href;const e=t.indexOf("#");if(e<0)return"";const n=(t=t.slice(e+1)).indexOf("?");if(n<0){const e=t.indexOf("#");t=e>-1?decodeURI(t.slice(0,e))+t.slice(e):decodeURI(t)}else t=decodeURI(t.slice(0,n))+t.slice(n);return t}function Ut(t){const e=window.location.href,n=e.indexOf("#");return`${n>=0?e.slice(0,n):e}#${t}`}function It(t){pt?ft(Ut(t)):window.location.hash=t}function Mt(t){pt?dt(Ut(t)):window.location.replace(Ut(t))}class Vt extends Ot{constructor(t,e){super(t,e),this.stack=[],this.index=-1}push(t,e,n){this.transitionTo(t,t=>{this.stack=this.stack.slice(0,this.index+1).concat(t),this.index++,e&&e(t)},n)}replace(t,e,n){this.transitionTo(t,t=>{this.stack=this.stack.slice(0,this.index).concat(t),e&&e(t)},n)}go(t){const e=this.index+t;if(e<0||e>=this.stack.length)return;const n=this.stack[e];this.confirmTransition(n,()=>{this.index=e,this.updateRoute(n)},t=>{Rt(t,mt.duplicated)&&(this.index=e)})}getCurrentLocation(){const t=this.stack[this.stack.length-1];return t?t.fullPath:"/"}ensureURL(){}}class Bt{constructor(t={}){this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=X(t.routes||[],this);let e=t.mode||"hash";switch(this.fallback="history"===e&&!pt&&!1!==t.fallback,this.fallback&&(e="hash"),K||(e="abstract"),this.mode=e,e){case"history":this.history=new Lt(this,t.base);break;case"hash":this.history=new Pt(this,t.base,this.fallback);break;case"abstract":this.history=new Vt(this,t.base)}}match(t,e,n){return this.matcher.match(t,e,n)}get currentRoute(){return this.history&&this.history.current}init(t){if(this.apps.push(t),t.$once("hook:destroyed",()=>{const e=this.apps.indexOf(t);e>-1&&this.apps.splice(e,1),this.app===t&&(this.app=this.apps[0]||null),this.app||this.history.teardownListeners()}),this.app)return;this.app=t;const e=this.history;if(e instanceof Lt||e instanceof Pt){const t=t=>{const n=e.current,r=this.options.scrollBehavior;pt&&r&&"fullPath"in t&&ot(this,t,n,!1)},n=n=>{e.setupListeners(),t(n)};e.transitionTo(e.getCurrentLocation(),n,n)}e.listen(t=>{this.apps.forEach(e=>{e._route=t})})}beforeEach(t){return Ft(this.beforeHooks,t)}beforeResolve(t){return Ft(this.resolveHooks,t)}afterEach(t){return Ft(this.afterHooks,t)}onReady(t,e){this.history.onReady(t,e)}onError(t){this.history.onError(t)}push(t,e,n){if(!e&&!n&&"undefined"!=typeof Promise)return new Promise((e,n)=>{this.history.push(t,e,n)});this.history.push(t,e,n)}replace(t,e,n){if(!e&&!n&&"undefined"!=typeof Promise)return new Promise((e,n)=>{this.history.replace(t,e,n)});this.history.replace(t,e,n)}go(t){this.history.go(t)}back(){this.go(-1)}forward(){this.go(1)}getMatchedComponents(t){const e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map(t=>Object.keys(t.components).map(e=>t.components[e]))):[]}resolve(t,e,n){const r=V(t,e=e||this.history.current,n,this),o=this.match(r,e),i=o.redirectedFrom||o.fullPath;return{location:r,route:o,href:function(t,e,n){var r="hash"===n?"#"+e:e;return t?b(t+"/"+r):r}(this.history.base,i,this.mode),normalizedTo:r,resolved:o}}addRoutes(t){this.matcher.addRoutes(t),this.history.current!==d&&this.history.transitionTo(this.history.getCurrentLocation())}}function Ft(t,e){return t.push(e),()=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)}}Bt.install=function t(n){if(t.installed&&D===n)return;t.installed=!0,D=n;const r=t=>void 0!==t,o=(t,e)=>{let n=t.$options._parentVnode;r(n)&&r(n=n.data)&&r(n=n.registerRouteInstance)&&n(t,e)};n.mixin({beforeCreate(){r(this.$options.router)?(this._routerRoot=this,this._router=this.$options.router,this._router.init(this),n.util.defineReactive(this,"_route",this._router.history.current)):this._routerRoot=this.$parent&&this.$parent._routerRoot||this,o(this,this)},destroyed(){o(this)}}),Object.defineProperty(n.prototype,"$router",{get(){return this._routerRoot._router}}),Object.defineProperty(n.prototype,"$route",{get(){return this._routerRoot._route}}),n.component("RouterView",e),n.component("RouterLink",N);const i=n.config.optionMergeStrategies;i.beforeRouteEnter=i.beforeRouteLeave=i.beforeRouteUpdate=i.created},Bt.version="3.4.3",Bt.isNavigationFailure=Rt,Bt.NavigationFailureType=mt,K&&window.Vue&&window.Vue.use(Bt);export default Bt; \ No newline at end of file +function t(t,e){for(const n in e)t[n]=e[n];return t}var e={name:"RouterView",functional:!0,props:{name:{type:String,default:"default"}},render(e,{props:r,children:o,parent:i,data:s}){s.routerView=!0;const a=i.$createElement,c=r.name,u=i.$route,h=i._routerViewCache||(i._routerViewCache={});let l=0,p=!1;for(;i&&i._routerRoot!==i;){const t=i.$vnode?i.$vnode.data:{};t.routerView&&l++,t.keepAlive&&i._directInactive&&i._inactive&&(p=!0),i=i.$parent}if(s.routerViewDepth=l,p){const t=h[c],e=t&&t.component;return e?(t.configProps&&n(e,s,t.route,t.configProps),a(e,s,o)):a()}const f=u.matched[l],d=f&&f.components[c];if(!f||!d)return h[c]=null,a();h[c]={component:d},s.registerRouteInstance=(t,e)=>{const n=f.instances[c];(e&&n!==t||!e&&n===t)&&(f.instances[c]=e)},(s.hook||(s.hook={})).prepatch=(t,e)=>{f.instances[c]=e.componentInstance},s.hook.init=t=>{t.data.keepAlive&&t.componentInstance&&t.componentInstance!==f.instances[c]&&(f.instances[c]=t.componentInstance)};const y=f.props&&f.props[c];return y&&(t(h[c],{route:u,configProps:y}),n(d,s,u,y)),a(d,s,o)}};function n(e,n,r,o){let i=n.props=function(t,e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0}}(r,o);if(i){i=n.props=t({},i);const r=n.attrs=n.attrs||{};for(const t in i)e.props&&t in e.props||(r[t]=i[t],delete i[t])}}const r=/[!'()*]/g,o=t=>"%"+t.charCodeAt(0).toString(16),i=/%2C/g,s=t=>encodeURIComponent(t).replace(r,o).replace(i,","),a=decodeURIComponent;const c=t=>null==t||"object"==typeof t?t:String(t);function u(t){const e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(t=>{const n=t.replace(/\+/g," ").split("="),r=a(n.shift()),o=n.length>0?a(n.join("=")):null;void 0===e[r]?e[r]=o:Array.isArray(e[r])?e[r].push(o):e[r]=[e[r],o]}),e):e}function h(t){const e=t?Object.keys(t).map(e=>{const n=t[e];if(void 0===n)return"";if(null===n)return s(e);if(Array.isArray(n)){const t=[];return n.forEach(n=>{void 0!==n&&(null===n?t.push(s(e)):t.push(s(e)+"="+s(n)))}),t.join("&")}return s(e)+"="+s(n)}).filter(t=>t.length>0).join("&"):null;return e?`?${e}`:""}const l=/\/?$/;function p(t,e,n,r){const o=r&&r.options.stringifyQuery;let i=e.query||{};try{i=f(i)}catch(t){}const s={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:i,params:e.params||{},fullPath:m(e,o),matched:t?y(t):[]};return n&&(s.redirectedFrom=m(n,o)),Object.freeze(s)}function f(t){if(Array.isArray(t))return t.map(f);if(t&&"object"==typeof t){const e={};for(const n in t)e[n]=f(t[n]);return e}return t}const d=p(null,{path:"/"});function y(t){const e=[];for(;t;)e.unshift(t),t=t.parent;return e}function m({path:t,query:e={},hash:n=""},r){return(t||"/")+(r||h)(e)+n}function g(t,e){return e===d?t===e:!!e&&(t.path&&e.path?t.path.replace(l,"")===e.path.replace(l,"")&&t.hash===e.hash&&w(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&w(t.query,e.query)&&w(t.params,e.params)))}function w(t={},e={}){if(!t||!e)return t===e;const n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(n=>{const r=t[n],o=e[n];return null==r||null==o?r===o:"object"==typeof r&&"object"==typeof o?w(r,o):String(r)===String(o)})}function v(t,e,n){const r=t.charAt(0);if("/"===r)return t;if("?"===r||"#"===r)return e+t;const o=e.split("/");n&&o[o.length-1]||o.pop();const i=t.replace(/^\//,"").split("/");for(let t=0;t=0&&(e=t.slice(r),t=t.slice(0,r));const o=t.indexOf("?");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{path:t,query:n,hash:e}}(i.path||""),a=n&&n.path||"/",h=s.path?v(s.path,a,r||i.append):a,l=function(t,e={},n){const r=n||u;let o;try{o=r(t||"")}catch(t){o={}}for(const t in e){const n=e[t];o[t]=Array.isArray(n)?n.map(c):c(n)}return o}(s.query,i.query,o&&o.options.parseQuery);let p=i.hash||s.hash;return p&&"#"!==p.charAt(0)&&(p=`#${p}`),{_normalized:!0,path:h,query:l,hash:p}}const B=[String,Object],H=[String,Array],F=()=>{};var N={name:"RouterLink",props:{to:{type:B,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,ariaCurrentValue:{type:String,default:"page"},event:{type:H,default:"click"}},render(e){const n=this.$router,r=this.$route,{location:o,route:i,href:s}=n.resolve(this.to,r,this.append),a={},c=n.options.linkActiveClass,u=n.options.linkExactActiveClass,h=null==c?"router-link-active":c,f=null==u?"router-link-exact-active":u,d=null==this.activeClass?h:this.activeClass,y=null==this.exactActiveClass?f:this.exactActiveClass,m=i.redirectedFrom?p(null,V(i.redirectedFrom),null,n):i;a[y]=g(r,m),a[d]=this.exact?a[y]:function(t,e){return 0===t.path.replace(l,"/").indexOf(e.path.replace(l,"/"))&&(!e.hash||t.hash===e.hash)&&function(t,e){for(const n in e)if(!(n in t))return!1;return!0}(t.query,e.query)}(r,m);const w=a[y]?this.ariaCurrentValue:null,v=t=>{z(t)&&(this.replace?n.replace(o,F):n.push(o,F))},b={click:z};Array.isArray(this.event)?this.event.forEach(t=>{b[t]=v}):b[this.event]=v;const x={class:a},R=!this.$scopedSlots.$hasNormal&&this.$scopedSlots.default&&this.$scopedSlots.default({href:s,route:i,navigate:v,isActive:a[d],isExactActive:a[y]});if(R){if(1===R.length)return R[0];if(R.length>1||!R.length)return 0===R.length?e():e("span",{},R)}if("a"===this.tag)x.on=b,x.attrs={href:s,"aria-current":w};else{const e=function t(e){if(e){let n;for(let r=0;r{!function t(e,n,r,o,i,s){const{path:a,name:c}=o;const u=o.pathToRegexpOptions||{};const h=function(t,e,n){n||(t=t.replace(/\/$/,""));return"/"===t[0]?t:null==e?t:b(`${e.path}/${t}`)}(a,i,u.strict);"boolean"==typeof o.caseSensitive&&(u.sensitive=o.caseSensitive);const l={path:h,regex:Q(h,u),components:o.components||{default:o.component},instances:{},name:c,parent:i,matchAs:s,redirect:o.redirect,beforeEnter:o.beforeEnter,meta:o.meta||{},props:null==o.props?{}:o.components?o.props:{default:o.props}};o.children&&o.children.forEach(o=>{const i=s?b(`${s}/${o.path}`):void 0;t(e,n,r,o,l,i)});n[l.path]||(e.push(l.path),n[l.path]=l);if(void 0!==o.alias){const s=Array.isArray(o.alias)?o.alias:[o.alias];for(let a=0;a!t.optional).map(t=>t.name);if("object"!=typeof c.params&&(c.params={}),i&&"object"==typeof i.params)for(const t in i.params)!(t in c.params)&&e.indexOf(t)>-1&&(c.params[t]=i.params[t]);return c.path=M(t.path,c.params),a(t,c,s)}if(c.path){c.params={};for(let t=0;t{window.removeEventListener("popstate",st)}}function ot(t,e,n,r){if(!t.app)return;const o=t.options.scrollBehavior;o&&t.app.$nextTick(()=>{const i=function(){const t=tt();if(t)return nt[t]}(),s=o.call(t,e,n,r?i:null);s&&("function"==typeof s.then?s.then(t=>{lt(t,i)}).catch(t=>{}):lt(s,i))})}function it(){const t=tt();t&&(nt[t]={x:window.pageXOffset,y:window.pageYOffset})}function st(t){it(),t.state&&t.state.key&&et(t.state.key)}function at(t){return ut(t.x)||ut(t.y)}function ct(t){return{x:ut(t.x)?t.x:window.pageXOffset,y:ut(t.y)?t.y:window.pageYOffset}}function ut(t){return"number"==typeof t}const ht=/^#\d/;function lt(t,e){const n="object"==typeof t;if(n&&"string"==typeof t.selector){const n=ht.test(t.selector)?document.getElementById(t.selector.slice(1)):document.querySelector(t.selector);if(n){let o=t.offset&&"object"==typeof t.offset?t.offset:{};e=function(t,e){const n=document.documentElement.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:r.left-n.left-e.x,y:r.top-n.top-e.y}}(n,o={x:ut((r=o).x)?r.x:0,y:ut(r.y)?r.y:0})}else at(t)&&(e=ct(t))}else n&&at(t)&&(e=ct(t));var r;e&&window.scrollTo(e.x,e.y)}const pt=K&&function(){const t=window.navigator.userAgent;return(-1===t.indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&(window.history&&"function"==typeof window.history.pushState)}();function ft(e,n){it();const r=window.history;try{if(n){const n=t({},r.state);n.key=tt(),r.replaceState(n,"",e)}else r.pushState({key:et(G())},"",e)}catch(t){window.location[n?"replace":"assign"](e)}}function dt(t){ft(t,!0)}function yt(t,e,n){const r=o=>{o>=t.length?n():t[o]?e(t[o],()=>{r(o+1)}):r(o+1)};r(0)}const mt={redirected:2,aborted:4,cancelled:8,duplicated:16};function gt(t,e){return vt(t,e,mt.redirected,`Redirected when going from "${t.fullPath}" to "${function(t){if("string"==typeof t)return t;if("path"in t)return t.path;const e={};return bt.forEach(n=>{n in t&&(e[n]=t[n])}),JSON.stringify(e,null,2)}(e)}" via a navigation guard.`)}function wt(t,e){return vt(t,e,mt.cancelled,`Navigation cancelled from "${t.fullPath}" to "${e.fullPath}" with a new navigation.`)}function vt(t,e,n,r){const o=new Error(r);return o._isRouter=!0,o.from=t,o.to=e,o.type=n,o}const bt=["params","query","hash"];function xt(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function Rt(t,e){return xt(t)&&t._isRouter&&(null==e||t.type===e)}function kt(t){return(e,n,r)=>{let o=!1,i=0,s=null;Et(t,(t,e,n,a)=>{if("function"==typeof t&&void 0===t.cid){o=!0,i++;const e=Ct(e=>{(function(t){return t.__esModule||At&&"Module"===t[Symbol.toStringTag]})(e)&&(e=e.default),t.resolved="function"==typeof e?e:D.extend(e),n.components[a]=e,--i<=0&&r()}),c=Ct(t=>{const e=`Failed to resolve async component ${a}: ${t}`;s||(s=xt(t)?t:new Error(e),r(s))});let u;try{u=t(e,c)}catch(t){c(t)}if(u)if("function"==typeof u.then)u.then(e,c);else{const t=u.component;t&&"function"==typeof t.then&&t.then(e,c)}}}),o||r()}}function Et(t,e){return $t(t.map(t=>Object.keys(t.components).map(n=>e(t.components[n],t.instances[n],t,n))))}function $t(t){return Array.prototype.concat.apply([],t)}const At="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function Ct(t){let e=!1;return function(...n){if(!e)return e=!0,t.apply(this,n)}}class Ot{constructor(t,e){this.router=t,this.base=function(t){if(!t)if(K){const e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";"/"!==t.charAt(0)&&(t="/"+t);return t.replace(/\/$/,"")}(e),this.current=d,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[],this.listeners=[]}listen(t){this.cb=t}onReady(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))}onError(t){this.errorCbs.push(t)}transitionTo(t,e,n){let r;try{r=this.router.match(t,this.current)}catch(t){throw this.errorCbs.forEach(e=>{e(t)}),t}this.confirmTransition(r,()=>{const t=this.current;this.updateRoute(r),e&&e(r),this.ensureURL(),this.router.afterHooks.forEach(e=>{e&&e(r,t)}),this.ready||(this.ready=!0,this.readyCbs.forEach(t=>{t(r)}))},t=>{n&&n(t),t&&!this.ready&&(this.ready=!0,Rt(t,mt.redirected)?this.readyCbs.forEach(t=>{t(r)}):this.readyErrorCbs.forEach(e=>{e(t)}))})}confirmTransition(t,e,n){const r=this.current;this.pending=t;const o=t=>{!Rt(t)&&xt(t)&&(this.errorCbs.length?this.errorCbs.forEach(e=>{e(t)}):console.error(t)),n&&n(t)},i=t.matched.length-1,s=r.matched.length-1;if(g(t,r)&&i===s&&t.matched[i]===r.matched[s])return this.ensureURL(),o(function(t,e){const n=vt(t,e,mt.duplicated,`Avoided redundant navigation to current location: "${t.fullPath}".`);return n.name="NavigationDuplicated",n}(r,t));const{updated:a,deactivated:c,activated:u}=function(t,e){let n;const r=Math.max(t.length,e.length);for(n=0;nt.beforeEnter),kt(u)),l=(e,n)=>{if(this.pending!==t)return o(wt(r,t));try{e(t,r,e=>{!1===e?(this.ensureURL(!0),o(function(t,e){return vt(t,e,mt.aborted,`Navigation aborted from "${t.fullPath}" to "${e.fullPath}" via a navigation guard.`)}(r,t))):xt(e)?(this.ensureURL(!0),o(e)):"string"==typeof e||"object"==typeof e&&("string"==typeof e.path||"string"==typeof e.name)?(o(gt(r,t)),"object"==typeof e&&e.replace?this.replace(e):this.push(e)):n(e)})}catch(t){o(t)}};yt(h,l,()=>{const n=[];yt(function(t,e,n){return St(t,"beforeRouteEnter",(t,r,o,i)=>(function(t,e,n,r,o){return function(i,s,a){return t(i,s,t=>{"function"==typeof t&&r.push(()=>{!function t(e,n,r,o){n[r]&&!n[r]._isBeingDestroyed?e(n[r]):o()&&setTimeout(()=>{t(e,n,r,o)},16)}(t,e.instances,n,o)}),a(t)})}})(t,o,i,e,n))}(u,n,()=>this.current===t).concat(this.router.resolveHooks),l,()=>{if(this.pending!==t)return o(wt(r,t));this.pending=null,e(t),this.router.app&&this.router.app.$nextTick(()=>{n.forEach(t=>{t()})})})})}updateRoute(t){this.current=t,this.cb&&this.cb(t)}setupListeners(){}teardown(){this.listeners.forEach(t=>{t()}),this.listeners=[],this.current=d,this.pending=null}}function St(t,e,n,r){const o=Et(t,(t,r,o,i)=>{const s=function(t,e){"function"!=typeof t&&(t=D.extend(t));return t.options[e]}(t,e);if(s)return Array.isArray(s)?s.map(t=>n(t,r,o,i)):n(s,r,o,i)});return $t(r?o.reverse():o)}function jt(t,e){if(e)return function(){return t.apply(e,arguments)}}class Tt extends Ot{constructor(t,e){super(t,e),this._startLocation=Lt(this.base)}setupListeners(){if(this.listeners.length>0)return;const t=this.router,e=t.options.scrollBehavior,n=pt&&e;n&&this.listeners.push(rt());const r=()=>{const e=this.current,r=Lt(this.base);this.current===d&&r===this._startLocation||this.transitionTo(r,r=>{n&&ot(t,r,e,!0)})};window.addEventListener("popstate",r),this.listeners.push(()=>{window.removeEventListener("popstate",r)})}go(t){window.history.go(t)}push(t,e,n){const{current:r}=this;this.transitionTo(t,t=>{ft(b(this.base+t.fullPath)),ot(this.router,t,r,!1),e&&e(t)},n)}replace(t,e,n){const{current:r}=this;this.transitionTo(t,t=>{dt(b(this.base+t.fullPath)),ot(this.router,t,r,!1),e&&e(t)},n)}ensureURL(t){if(Lt(this.base)!==this.current.fullPath){const e=b(this.base+this.current.fullPath);t?ft(e):dt(e)}}getCurrentLocation(){return Lt(this.base)}}function Lt(t){let e=decodeURI(window.location.pathname);return t&&0===e.toLowerCase().indexOf(t.toLowerCase())&&(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}class Pt extends Ot{constructor(t,e,n){super(t,e),n&&function(t){const e=Lt(t);if(!/^\/#/.test(e))return window.location.replace(b(t+"/#"+e)),!0}(this.base)||_t()}setupListeners(){if(this.listeners.length>0)return;const t=this.router.options.scrollBehavior,e=pt&&t;e&&this.listeners.push(rt());const n=()=>{const t=this.current;_t()&&this.transitionTo(qt(),n=>{e&&ot(this.router,n,t,!0),pt||Mt(n.fullPath)})},r=pt?"popstate":"hashchange";window.addEventListener(r,n),this.listeners.push(()=>{window.removeEventListener(r,n)})}push(t,e,n){const{current:r}=this;this.transitionTo(t,t=>{It(t.fullPath),ot(this.router,t,r,!1),e&&e(t)},n)}replace(t,e,n){const{current:r}=this;this.transitionTo(t,t=>{Mt(t.fullPath),ot(this.router,t,r,!1),e&&e(t)},n)}go(t){window.history.go(t)}ensureURL(t){const e=this.current.fullPath;qt()!==e&&(t?It(e):Mt(e))}getCurrentLocation(){return qt()}}function _t(){const t=qt();return"/"===t.charAt(0)||(Mt("/"+t),!1)}function qt(){let t=window.location.href;const e=t.indexOf("#");if(e<0)return"";const n=(t=t.slice(e+1)).indexOf("?");if(n<0){const e=t.indexOf("#");t=e>-1?decodeURI(t.slice(0,e))+t.slice(e):decodeURI(t)}else t=decodeURI(t.slice(0,n))+t.slice(n);return t}function Ut(t){const e=window.location.href,n=e.indexOf("#");return`${n>=0?e.slice(0,n):e}#${t}`}function It(t){pt?ft(Ut(t)):window.location.hash=t}function Mt(t){pt?dt(Ut(t)):window.location.replace(Ut(t))}class Vt extends Ot{constructor(t,e){super(t,e),this.stack=[],this.index=-1}push(t,e,n){this.transitionTo(t,t=>{this.stack=this.stack.slice(0,this.index+1).concat(t),this.index++,e&&e(t)},n)}replace(t,e,n){this.transitionTo(t,t=>{this.stack=this.stack.slice(0,this.index).concat(t),e&&e(t)},n)}go(t){const e=this.index+t;if(e<0||e>=this.stack.length)return;const n=this.stack[e];this.confirmTransition(n,()=>{const t=this.current;this.index=e,this.updateRoute(n),this.router.afterHooks.forEach(e=>{e&&e(n,t)})},t=>{Rt(t,mt.duplicated)&&(this.index=e)})}getCurrentLocation(){const t=this.stack[this.stack.length-1];return t?t.fullPath:"/"}ensureURL(){}}class Bt{constructor(t={}){this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=X(t.routes||[],this);let e=t.mode||"hash";switch(this.fallback="history"===e&&!pt&&!1!==t.fallback,this.fallback&&(e="hash"),K||(e="abstract"),this.mode=e,e){case"history":this.history=new Tt(this,t.base);break;case"hash":this.history=new Pt(this,t.base,this.fallback);break;case"abstract":this.history=new Vt(this,t.base)}}match(t,e,n){return this.matcher.match(t,e,n)}get currentRoute(){return this.history&&this.history.current}init(t){if(this.apps.push(t),t.$once("hook:destroyed",()=>{const e=this.apps.indexOf(t);e>-1&&this.apps.splice(e,1),this.app===t&&(this.app=this.apps[0]||null),this.app||this.history.teardown()}),this.app)return;this.app=t;const e=this.history;if(e instanceof Tt||e instanceof Pt){const t=t=>{const n=e.current,r=this.options.scrollBehavior;pt&&r&&"fullPath"in t&&ot(this,t,n,!1)},n=n=>{e.setupListeners(),t(n)};e.transitionTo(e.getCurrentLocation(),n,n)}e.listen(t=>{this.apps.forEach(e=>{e._route=t})})}beforeEach(t){return Ht(this.beforeHooks,t)}beforeResolve(t){return Ht(this.resolveHooks,t)}afterEach(t){return Ht(this.afterHooks,t)}onReady(t,e){this.history.onReady(t,e)}onError(t){this.history.onError(t)}push(t,e,n){if(!e&&!n&&"undefined"!=typeof Promise)return new Promise((e,n)=>{this.history.push(t,e,n)});this.history.push(t,e,n)}replace(t,e,n){if(!e&&!n&&"undefined"!=typeof Promise)return new Promise((e,n)=>{this.history.replace(t,e,n)});this.history.replace(t,e,n)}go(t){this.history.go(t)}back(){this.go(-1)}forward(){this.go(1)}getMatchedComponents(t){const e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map(t=>Object.keys(t.components).map(e=>t.components[e]))):[]}resolve(t,e,n){const r=V(t,e=e||this.history.current,n,this),o=this.match(r,e),i=o.redirectedFrom||o.fullPath;return{location:r,route:o,href:function(t,e,n){var r="hash"===n?"#"+e:e;return t?b(t+"/"+r):r}(this.history.base,i,this.mode),normalizedTo:r,resolved:o}}addRoutes(t){this.matcher.addRoutes(t),this.history.current!==d&&this.history.transitionTo(this.history.getCurrentLocation())}}function Ht(t,e){return t.push(e),()=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)}}Bt.install=function t(n){if(t.installed&&D===n)return;t.installed=!0,D=n;const r=t=>void 0!==t,o=(t,e)=>{let n=t.$options._parentVnode;r(n)&&r(n=n.data)&&r(n=n.registerRouteInstance)&&n(t,e)};n.mixin({beforeCreate(){r(this.$options.router)?(this._routerRoot=this,this._router=this.$options.router,this._router.init(this),n.util.defineReactive(this,"_route",this._router.history.current)):this._routerRoot=this.$parent&&this.$parent._routerRoot||this,o(this,this)},destroyed(){o(this)}}),Object.defineProperty(n.prototype,"$router",{get(){return this._routerRoot._router}}),Object.defineProperty(n.prototype,"$route",{get(){return this._routerRoot._route}}),n.component("RouterView",e),n.component("RouterLink",N);const i=n.config.optionMergeStrategies;i.beforeRouteEnter=i.beforeRouteLeave=i.beforeRouteUpdate=i.created},Bt.version="3.4.4",Bt.isNavigationFailure=Rt,Bt.NavigationFailureType=mt,K&&window.Vue&&window.Vue.use(Bt);export default Bt; \ No newline at end of file diff --git a/dist/vue-router.esm.js b/dist/vue-router.esm.js index 310ee41a2..e0ad77b8f 100644 --- a/dist/vue-router.esm.js +++ b/dist/vue-router.esm.js @@ -1,5 +1,5 @@ /*! - * vue-router v3.4.3 + * vue-router v3.4.4 * (c) 2020 Evan You * @license MIT */ @@ -1906,6 +1906,7 @@ function runQueue (queue, fn, cb) { step(0); } +// When changing thing, also edit router.d.ts var NavigationFailureType = { redirected: 2, aborted: 4, @@ -2194,6 +2195,7 @@ History.prototype.confirmTransition = function confirmTransition (route, onCompl var this$1 = this; var current = this.current; + this.pending = route; var abort = function (err) { // changed after adding errors with // https://github.com/vuejs/vue-router/pull/3047 before that change, @@ -2243,7 +2245,6 @@ History.prototype.confirmTransition = function confirmTransition (route, onCompl resolveAsyncComponents(activated) ); - this.pending = route; var iterator = function (hook, next) { if (this$1.pending !== route) { return abort(createNavigationCancelledError(current, route)) @@ -2312,11 +2313,18 @@ History.prototype.setupListeners = function setupListeners () { // Default implementation is empty }; -History.prototype.teardownListeners = function teardownListeners () { +History.prototype.teardown = function teardown () { + // clean up event listeners + // https://github.com/vuejs/vue-router/issues/2341 this.listeners.forEach(function (cleanupListener) { cleanupListener(); }); this.listeners = []; + + // reset current history route + // https://github.com/vuejs/vue-router/issues/3294 + this.current = START; + this.pending = null; }; function normalizeBase (base) { @@ -2780,8 +2788,12 @@ var AbstractHistory = /*@__PURE__*/(function (History) { this.confirmTransition( route, function () { + var prev = this$1.current; this$1.index = targetIndex; this$1.updateRoute(route); + this$1.router.afterHooks.forEach(function (hook) { + hook && hook(route, prev); + }); }, function (err) { if (isNavigationFailure(err, NavigationFailureType.duplicated)) { @@ -2876,11 +2888,7 @@ VueRouter.prototype.init = function init (app /* Vue component instance */) { // we do not release the router so it can be reused if (this$1.app === app) { this$1.app = this$1.apps[0] || null; } - if (!this$1.app) { - // clean up event listeners - // https://github.com/vuejs/vue-router/issues/2341 - this$1.history.teardownListeners(); - } + if (!this$1.app) { this$1.history.teardown(); } }); // main app previously initialized @@ -3042,7 +3050,7 @@ function createHref (base, fullPath, mode) { } VueRouter.install = install; -VueRouter.version = '3.4.3'; +VueRouter.version = '3.4.4'; VueRouter.isNavigationFailure = isNavigationFailure; VueRouter.NavigationFailureType = NavigationFailureType; diff --git a/dist/vue-router.js b/dist/vue-router.js index 85e719cf4..067368dc7 100644 --- a/dist/vue-router.js +++ b/dist/vue-router.js @@ -1,5 +1,5 @@ /*! - * vue-router v3.4.3 + * vue-router v3.4.4 * (c) 2020 Evan You * @license MIT */ @@ -1912,6 +1912,7 @@ step(0); } + // When changing thing, also edit router.d.ts var NavigationFailureType = { redirected: 2, aborted: 4, @@ -2200,6 +2201,7 @@ var this$1 = this; var current = this.current; + this.pending = route; var abort = function (err) { // changed after adding errors with // https://github.com/vuejs/vue-router/pull/3047 before that change, @@ -2249,7 +2251,6 @@ resolveAsyncComponents(activated) ); - this.pending = route; var iterator = function (hook, next) { if (this$1.pending !== route) { return abort(createNavigationCancelledError(current, route)) @@ -2318,11 +2319,18 @@ // Default implementation is empty }; - History.prototype.teardownListeners = function teardownListeners () { + History.prototype.teardown = function teardown () { + // clean up event listeners + // https://github.com/vuejs/vue-router/issues/2341 this.listeners.forEach(function (cleanupListener) { cleanupListener(); }); this.listeners = []; + + // reset current history route + // https://github.com/vuejs/vue-router/issues/3294 + this.current = START; + this.pending = null; }; function normalizeBase (base) { @@ -2786,8 +2794,12 @@ this.confirmTransition( route, function () { + var prev = this$1.current; this$1.index = targetIndex; this$1.updateRoute(route); + this$1.router.afterHooks.forEach(function (hook) { + hook && hook(route, prev); + }); }, function (err) { if (isNavigationFailure(err, NavigationFailureType.duplicated)) { @@ -2882,11 +2894,7 @@ // we do not release the router so it can be reused if (this$1.app === app) { this$1.app = this$1.apps[0] || null; } - if (!this$1.app) { - // clean up event listeners - // https://github.com/vuejs/vue-router/issues/2341 - this$1.history.teardownListeners(); - } + if (!this$1.app) { this$1.history.teardown(); } }); // main app previously initialized @@ -3048,7 +3056,7 @@ } VueRouter.install = install; - VueRouter.version = '3.4.3'; + VueRouter.version = '3.4.4'; VueRouter.isNavigationFailure = isNavigationFailure; VueRouter.NavigationFailureType = NavigationFailureType; diff --git a/dist/vue-router.min.js b/dist/vue-router.min.js index a7eb7f49e..d255a6bd8 100644 --- a/dist/vue-router.min.js +++ b/dist/vue-router.min.js @@ -1,6 +1,6 @@ /*! - * vue-router v3.4.3 + * vue-router v3.4.4 * (c) 2020 Evan You * @license MIT */ -var t,e;t=this,e=function(){"use strict";function t(t,e){for(var r in e)t[r]=e[r];return t}var e={name:"RouterView",functional:!0,props:{name:{type:String,default:"default"}},render:function(e,n){var o=n.props,i=n.children,a=n.parent,u=n.data;u.routerView=!0;for(var s=a.$createElement,c=o.name,p=a.$route,f=a._routerViewCache||(a._routerViewCache={}),h=0,l=!1;a&&a._routerRoot!==a;){var d=a.$vnode?a.$vnode.data:{};d.routerView&&h++,d.keepAlive&&a._directInactive&&a._inactive&&(l=!0),a=a.$parent}if(u.routerViewDepth=h,l){var v=f[c],y=v&&v.component;return y?(v.configProps&&r(y,u,v.route,v.configProps),s(y,u,i)):s()}var m=p.matched[h],g=m&&m.components[c];if(!m||!g)return f[c]=null,s();f[c]={component:g},u.registerRouteInstance=function(t,e){var r=m.instances[c];(e&&r!==t||!e&&r===t)&&(m.instances[c]=e)},(u.hook||(u.hook={})).prepatch=function(t,e){m.instances[c]=e.componentInstance},u.hook.init=function(t){t.data.keepAlive&&t.componentInstance&&t.componentInstance!==m.instances[c]&&(m.instances[c]=t.componentInstance)};var w=m.props&&m.props[c];return w&&(t(f[c],{route:p,configProps:w}),r(g,u,p,w)),s(g,u,i)}};function r(e,r,n,o){var i=r.props=function(t,e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0}}(n,o);if(i){i=r.props=t({},i);var a=r.attrs=r.attrs||{};for(var u in i)e.props&&u in e.props||(a[u]=i[u],delete i[u])}}var n=/[!'()*]/g,o=function(t){return"%"+t.charCodeAt(0).toString(16)},i=/%2C/g,a=function(t){return encodeURIComponent(t).replace(n,o).replace(i,",")},u=decodeURIComponent,s=function(t){return null==t||"object"==typeof t?t:String(t)};function c(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var r=t.replace(/\+/g," ").split("="),n=u(r.shift()),o=r.length>0?u(r.join("=")):null;void 0===e[n]?e[n]=o:Array.isArray(e[n])?e[n].push(o):e[n]=[e[n],o]}),e):e}function p(t){var e=t?Object.keys(t).map(function(e){var r=t[e];if(void 0===r)return"";if(null===r)return a(e);if(Array.isArray(r)){var n=[];return r.forEach(function(t){void 0!==t&&(null===t?n.push(a(e)):n.push(a(e)+"="+a(t)))}),n.join("&")}return a(e)+"="+a(r)}).filter(function(t){return t.length>0}).join("&"):null;return e?"?"+e:""}var f=/\/?$/;function h(t,e,r,n){var o=n&&n.options.stringifyQuery,i=e.query||{};try{i=l(i)}catch(t){}var a={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:i,params:e.params||{},fullPath:y(e,o),matched:t?v(t):[]};return r&&(a.redirectedFrom=y(r,o)),Object.freeze(a)}function l(t){if(Array.isArray(t))return t.map(l);if(t&&"object"==typeof t){var e={};for(var r in t)e[r]=l(t[r]);return e}return t}var d=h(null,{path:"/"});function v(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function y(t,e){var r=t.path,n=t.query;void 0===n&&(n={});var o=t.hash;return void 0===o&&(o=""),(r||"/")+(e||p)(n)+o}function m(t,e){return e===d?t===e:!!e&&(t.path&&e.path?t.path.replace(f,"")===e.path.replace(f,"")&&t.hash===e.hash&&g(t.query,e.query):!(!t.name||!e.name)&&t.name===e.name&&t.hash===e.hash&&g(t.query,e.query)&&g(t.params,e.params))}function g(t,e){if(void 0===t&&(t={}),void 0===e&&(e={}),!t||!e)return t===e;var r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(function(r){var n=t[r],o=e[r];return null==n||null==o?n===o:"object"==typeof n&&"object"==typeof o?g(n,o):String(n)===String(o)})}function w(t,e,r){var n=t.charAt(0);if("/"===n)return t;if("?"===n||"#"===n)return e+t;var o=e.split("/");r&&o[o.length-1]||o.pop();for(var i=t.replace(/^\//,"").split("/"),a=0;a=0&&(e=t.slice(n),t=t.slice(0,n));var o=t.indexOf("?");return o>=0&&(r=t.slice(o+1),t=t.slice(0,o)),{path:t,query:r,hash:e}}(i.path||""),h=r&&r.path||"/",l=f.path?w(f.path,h,n||i.append):h,d=function(t,e,r){void 0===e&&(e={});var n,o=r||c;try{n=o(t||"")}catch(t){n={}}for(var i in e){var a=e[i];n[i]=Array.isArray(a)?a.map(s):s(a)}return n}(f.query,i.query,o&&o.options.parseQuery),v=i.hash||f.hash;return v&&"#"!==v.charAt(0)&&(v="#"+v),{_normalized:!0,path:l,query:d,hash:v}}var B,F=[String,Object],H=[String,Array],N=function(){},z={name:"RouterLink",props:{to:{type:F,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,ariaCurrentValue:{type:String,default:"page"},event:{type:H,default:"click"}},render:function(e){var r=this,n=this.$router,o=this.$route,i=n.resolve(this.to,o,this.append),a=i.location,u=i.route,s=i.href,c={},p=n.options.linkActiveClass,l=n.options.linkExactActiveClass,d=null==p?"router-link-active":p,v=null==l?"router-link-exact-active":l,y=null==this.activeClass?d:this.activeClass,g=null==this.exactActiveClass?v:this.exactActiveClass,w=u.redirectedFrom?h(null,V(u.redirectedFrom),null,n):u;c[g]=m(o,w),c[y]=this.exact?c[g]:function(t,e){return 0===t.path.replace(f,"/").indexOf(e.path.replace(f,"/"))&&(!e.hash||t.hash===e.hash)&&function(t,e){for(var r in e)if(!(r in t))return!1;return!0}(t.query,e.query)}(o,w);var b=c[g]?this.ariaCurrentValue:null,x=function(t){D(t)&&(r.replace?n.replace(a,N):n.push(a,N))},R={click:D};Array.isArray(this.event)?this.event.forEach(function(t){R[t]=x}):R[this.event]=x;var k={class:c},E=!this.$scopedSlots.$hasNormal&&this.$scopedSlots.default&&this.$scopedSlots.default({href:s,route:u,navigate:x,isActive:c[y],isExactActive:c[g]});if(E){if(1===E.length)return E[0];if(E.length>1||!E.length)return 0===E.length?e():e("span",{},E)}if("a"===this.tag)k.on=R,k.attrs={href:s,"aria-current":b};else{var A=function t(e){if(e)for(var r,n=0;n-1&&(u.params[h]=r.params[h]);return u.path=M(p.path,u.params),s(p,u,a)}if(u.path){u.params={};for(var l=0;l=t.length?r():t[o]?e(t[o],function(){n(o+1)}):n(o+1)};n(0)}var mt={redirected:2,aborted:4,cancelled:8,duplicated:16};function gt(t,e){return bt(t,e,mt.redirected,'Redirected when going from "'+t.fullPath+'" to "'+function(t){if("string"==typeof t)return t;if("path"in t)return t.path;var e={};return xt.forEach(function(r){r in t&&(e[r]=t[r])}),JSON.stringify(e,null,2)}(e)+'" via a navigation guard.')}function wt(t,e){return bt(t,e,mt.cancelled,'Navigation cancelled from "'+t.fullPath+'" to "'+e.fullPath+'" with a new navigation.')}function bt(t,e,r,n){var o=new Error(n);return o._isRouter=!0,o.from=t,o.to=e,o.type=r,o}var xt=["params","query","hash"];function Rt(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function kt(t,e){return Rt(t)&&t._isRouter&&(null==e||t.type===e)}function Et(t){return function(e,r,n){var o=!1,i=0,a=null;At(t,function(t,e,r,u){if("function"==typeof t&&void 0===t.cid){o=!0,i++;var s,c=_t(function(e){var o;((o=e).__esModule||Ct&&"Module"===o[Symbol.toStringTag])&&(e=e.default),t.resolved="function"==typeof e?e:B.extend(e),r.components[u]=e,--i<=0&&n()}),p=_t(function(t){var e="Failed to resolve async component "+u+": "+t;a||(a=Rt(t)?t:new Error(e),n(a))});try{s=t(c,p)}catch(t){p(t)}if(s)if("function"==typeof s.then)s.then(c,p);else{var f=s.component;f&&"function"==typeof f.then&&f.then(c,p)}}}),o||n()}}function At(t,e){return Ot(t.map(function(t){return Object.keys(t.components).map(function(r){return e(t.components[r],t.instances[r],t,r)})}))}function Ot(t){return Array.prototype.concat.apply([],t)}var Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function _t(t){var e=!1;return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(!e)return e=!0,t.apply(this,r)}}var jt=function(t,e){this.router=t,this.base=function(t){if(!t)if(K){var e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}(e),this.current=d,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[],this.listeners=[]};function St(t,e,r,n){var o=At(t,function(t,n,o,i){var a=function(t,e){return"function"!=typeof t&&(t=B.extend(t)),t.options[e]}(t,e);if(a)return Array.isArray(a)?a.map(function(t){return r(t,n,o,i)}):r(a,n,o,i)});return Ot(n?o.reverse():o)}function Lt(t,e){if(e)return function(){return t.apply(e,arguments)}}jt.prototype.listen=function(t){this.cb=t},jt.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},jt.prototype.onError=function(t){this.errorCbs.push(t)},jt.prototype.transitionTo=function(t,e,r){var n,o=this;try{n=this.router.match(t,this.current)}catch(t){throw this.errorCbs.forEach(function(e){e(t)}),t}this.confirmTransition(n,function(){var t=o.current;o.updateRoute(n),e&&e(n),o.ensureURL(),o.router.afterHooks.forEach(function(e){e&&e(n,t)}),o.ready||(o.ready=!0,o.readyCbs.forEach(function(t){t(n)}))},function(t){r&&r(t),t&&!o.ready&&(o.ready=!0,kt(t,mt.redirected)?o.readyCbs.forEach(function(t){t(n)}):o.readyErrorCbs.forEach(function(e){e(t)}))})},jt.prototype.confirmTransition=function(t,e,r){var n,o,i=this,a=this.current,u=function(t){!kt(t)&&Rt(t)&&(i.errorCbs.length?i.errorCbs.forEach(function(e){e(t)}):console.error(t)),r&&r(t)},s=t.matched.length-1,c=a.matched.length-1;if(m(t,a)&&s===c&&t.matched[s]===a.matched[c])return this.ensureURL(),u(((o=bt(n=a,t,mt.duplicated,'Avoided redundant navigation to current location: "'+n.fullPath+'".')).name="NavigationDuplicated",o));var p=function(t,e){var r,n=Math.max(t.length,e.length);for(r=0;r0)){var e=this.router,r=e.options.scrollBehavior,n=lt&&r;n&&this.listeners.push(nt());var o=function(){var r=t.current,o=Pt(t.base);t.current===d&&o===t._startLocation||t.transitionTo(o,function(t){n&&ot(e,t,r,!0)})};window.addEventListener("popstate",o),this.listeners.push(function(){window.removeEventListener("popstate",o)})}},e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,r){var n=this,o=this.current;this.transitionTo(t,function(t){dt(b(n.base+t.fullPath)),ot(n.router,t,o,!1),e&&e(t)},r)},e.prototype.replace=function(t,e,r){var n=this,o=this.current;this.transitionTo(t,function(t){vt(b(n.base+t.fullPath)),ot(n.router,t,o,!1),e&&e(t)},r)},e.prototype.ensureURL=function(t){if(Pt(this.base)!==this.current.fullPath){var e=b(this.base+this.current.fullPath);t?dt(e):vt(e)}},e.prototype.getCurrentLocation=function(){return Pt(this.base)},e}(jt);function Pt(t){var e=decodeURI(window.location.pathname);return t&&0===e.toLowerCase().indexOf(t.toLowerCase())&&(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}var Tt=function(t){function e(e,r,n){t.call(this,e,r),n&&function(t){var e=Pt(t);if(!/^\/#/.test(e))return window.location.replace(b(t+"/#"+e)),!0}(this.base)||qt()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this;if(!(this.listeners.length>0)){var e=this.router.options.scrollBehavior,r=lt&&e;r&&this.listeners.push(nt());var n=function(){var e=t.current;qt()&&t.transitionTo(Ut(),function(n){r&&ot(t.router,n,e,!0),lt||Vt(n.fullPath)})},o=lt?"popstate":"hashchange";window.addEventListener(o,n),this.listeners.push(function(){window.removeEventListener(o,n)})}},e.prototype.push=function(t,e,r){var n=this,o=this.current;this.transitionTo(t,function(t){Mt(t.fullPath),ot(n.router,t,o,!1),e&&e(t)},r)},e.prototype.replace=function(t,e,r){var n=this,o=this.current;this.transitionTo(t,function(t){Vt(t.fullPath),ot(n.router,t,o,!1),e&&e(t)},r)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;Ut()!==e&&(t?Mt(e):Vt(e))},e.prototype.getCurrentLocation=function(){return Ut()},e}(jt);function qt(){var t=Ut();return"/"===t.charAt(0)||(Vt("/"+t),!1)}function Ut(){var t=window.location.href,e=t.indexOf("#");if(e<0)return"";var r=(t=t.slice(e+1)).indexOf("?");if(r<0){var n=t.indexOf("#");t=n>-1?decodeURI(t.slice(0,n))+t.slice(n):decodeURI(t)}else t=decodeURI(t.slice(0,r))+t.slice(r);return t}function It(t){var e=window.location.href,r=e.indexOf("#");return(r>=0?e.slice(0,r):e)+"#"+t}function Mt(t){lt?dt(It(t)):window.location.hash=t}function Vt(t){lt?vt(It(t)):window.location.replace(It(t))}var Bt=function(t){function e(e,r){t.call(this,e,r),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,r){var n=this;this.transitionTo(t,function(t){n.stack=n.stack.slice(0,n.index+1).concat(t),n.index++,e&&e(t)},r)},e.prototype.replace=function(t,e,r){var n=this;this.transitionTo(t,function(t){n.stack=n.stack.slice(0,n.index).concat(t),e&&e(t)},r)},e.prototype.go=function(t){var e=this,r=this.index+t;if(!(r<0||r>=this.stack.length)){var n=this.stack[r];this.confirmTransition(n,function(){e.index=r,e.updateRoute(n)},function(t){kt(t,mt.duplicated)&&(e.index=r)})}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(jt),Ft=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=X(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!lt&&!1!==t.fallback,this.fallback&&(e="hash"),K||(e="abstract"),this.mode=e,e){case"history":this.history=new $t(this,t.base);break;case"hash":this.history=new Tt(this,t.base,this.fallback);break;case"abstract":this.history=new Bt(this,t.base)}},Ht={currentRoute:{configurable:!0}};function Nt(t,e){return t.push(e),function(){var r=t.indexOf(e);r>-1&&t.splice(r,1)}}return Ft.prototype.match=function(t,e,r){return this.matcher.match(t,e,r)},Ht.currentRoute.get=function(){return this.history&&this.history.current},Ft.prototype.init=function(t){var e=this;if(this.apps.push(t),t.$once("hook:destroyed",function(){var r=e.apps.indexOf(t);r>-1&&e.apps.splice(r,1),e.app===t&&(e.app=e.apps[0]||null),e.app||e.history.teardownListeners()}),!this.app){this.app=t;var r=this.history;if(r instanceof $t||r instanceof Tt){var n=function(t){r.setupListeners(),function(t){var n=r.current,o=e.options.scrollBehavior;lt&&o&&"fullPath"in t&&ot(e,t,n,!1)}(t)};r.transitionTo(r.getCurrentLocation(),n,n)}r.listen(function(t){e.apps.forEach(function(e){e._route=t})})}},Ft.prototype.beforeEach=function(t){return Nt(this.beforeHooks,t)},Ft.prototype.beforeResolve=function(t){return Nt(this.resolveHooks,t)},Ft.prototype.afterEach=function(t){return Nt(this.afterHooks,t)},Ft.prototype.onReady=function(t,e){this.history.onReady(t,e)},Ft.prototype.onError=function(t){this.history.onError(t)},Ft.prototype.push=function(t,e,r){var n=this;if(!e&&!r&&"undefined"!=typeof Promise)return new Promise(function(e,r){n.history.push(t,e,r)});this.history.push(t,e,r)},Ft.prototype.replace=function(t,e,r){var n=this;if(!e&&!r&&"undefined"!=typeof Promise)return new Promise(function(e,r){n.history.replace(t,e,r)});this.history.replace(t,e,r)},Ft.prototype.go=function(t){this.history.go(t)},Ft.prototype.back=function(){this.go(-1)},Ft.prototype.forward=function(){this.go(1)},Ft.prototype.getMatchedComponents=function(t){var e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},Ft.prototype.resolve=function(t,e,r){var n=V(t,e=e||this.history.current,r,this),o=this.match(n,e),i=o.redirectedFrom||o.fullPath;return{location:n,route:o,href:function(t,e,r){var n="hash"===r?"#"+e:e;return t?b(t+"/"+n):n}(this.history.base,i,this.mode),normalizedTo:n,resolved:o}},Ft.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==d&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(Ft.prototype,Ht),Ft.install=function t(r){if(!t.installed||B!==r){t.installed=!0,B=r;var n=function(t){return void 0!==t},o=function(t,e){var r=t.$options._parentVnode;n(r)&&n(r=r.data)&&n(r=r.registerRouteInstance)&&r(t,e)};r.mixin({beforeCreate:function(){n(this.$options.router)?(this._routerRoot=this,this._router=this.$options.router,this._router.init(this),r.util.defineReactive(this,"_route",this._router.history.current)):this._routerRoot=this.$parent&&this.$parent._routerRoot||this,o(this,this)},destroyed:function(){o(this)}}),Object.defineProperty(r.prototype,"$router",{get:function(){return this._routerRoot._router}}),Object.defineProperty(r.prototype,"$route",{get:function(){return this._routerRoot._route}}),r.component("RouterView",e),r.component("RouterLink",z);var i=r.config.optionMergeStrategies;i.beforeRouteEnter=i.beforeRouteLeave=i.beforeRouteUpdate=i.created}},Ft.version="3.4.3",Ft.isNavigationFailure=kt,Ft.NavigationFailureType=mt,K&&window.Vue&&window.Vue.use(Ft),Ft},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).VueRouter=e(); \ No newline at end of file +var t,e;t=this,e=function(){"use strict";function t(t,e){for(var r in e)t[r]=e[r];return t}var e={name:"RouterView",functional:!0,props:{name:{type:String,default:"default"}},render:function(e,n){var o=n.props,i=n.children,a=n.parent,u=n.data;u.routerView=!0;for(var s=a.$createElement,c=o.name,p=a.$route,f=a._routerViewCache||(a._routerViewCache={}),h=0,l=!1;a&&a._routerRoot!==a;){var d=a.$vnode?a.$vnode.data:{};d.routerView&&h++,d.keepAlive&&a._directInactive&&a._inactive&&(l=!0),a=a.$parent}if(u.routerViewDepth=h,l){var v=f[c],y=v&&v.component;return y?(v.configProps&&r(y,u,v.route,v.configProps),s(y,u,i)):s()}var m=p.matched[h],g=m&&m.components[c];if(!m||!g)return f[c]=null,s();f[c]={component:g},u.registerRouteInstance=function(t,e){var r=m.instances[c];(e&&r!==t||!e&&r===t)&&(m.instances[c]=e)},(u.hook||(u.hook={})).prepatch=function(t,e){m.instances[c]=e.componentInstance},u.hook.init=function(t){t.data.keepAlive&&t.componentInstance&&t.componentInstance!==m.instances[c]&&(m.instances[c]=t.componentInstance)};var w=m.props&&m.props[c];return w&&(t(f[c],{route:p,configProps:w}),r(g,u,p,w)),s(g,u,i)}};function r(e,r,n,o){var i=r.props=function(t,e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0}}(n,o);if(i){i=r.props=t({},i);var a=r.attrs=r.attrs||{};for(var u in i)e.props&&u in e.props||(a[u]=i[u],delete i[u])}}var n=/[!'()*]/g,o=function(t){return"%"+t.charCodeAt(0).toString(16)},i=/%2C/g,a=function(t){return encodeURIComponent(t).replace(n,o).replace(i,",")},u=decodeURIComponent,s=function(t){return null==t||"object"==typeof t?t:String(t)};function c(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var r=t.replace(/\+/g," ").split("="),n=u(r.shift()),o=r.length>0?u(r.join("=")):null;void 0===e[n]?e[n]=o:Array.isArray(e[n])?e[n].push(o):e[n]=[e[n],o]}),e):e}function p(t){var e=t?Object.keys(t).map(function(e){var r=t[e];if(void 0===r)return"";if(null===r)return a(e);if(Array.isArray(r)){var n=[];return r.forEach(function(t){void 0!==t&&(null===t?n.push(a(e)):n.push(a(e)+"="+a(t)))}),n.join("&")}return a(e)+"="+a(r)}).filter(function(t){return t.length>0}).join("&"):null;return e?"?"+e:""}var f=/\/?$/;function h(t,e,r,n){var o=n&&n.options.stringifyQuery,i=e.query||{};try{i=l(i)}catch(t){}var a={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:i,params:e.params||{},fullPath:y(e,o),matched:t?v(t):[]};return r&&(a.redirectedFrom=y(r,o)),Object.freeze(a)}function l(t){if(Array.isArray(t))return t.map(l);if(t&&"object"==typeof t){var e={};for(var r in t)e[r]=l(t[r]);return e}return t}var d=h(null,{path:"/"});function v(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function y(t,e){var r=t.path,n=t.query;void 0===n&&(n={});var o=t.hash;return void 0===o&&(o=""),(r||"/")+(e||p)(n)+o}function m(t,e){return e===d?t===e:!!e&&(t.path&&e.path?t.path.replace(f,"")===e.path.replace(f,"")&&t.hash===e.hash&&g(t.query,e.query):!(!t.name||!e.name)&&t.name===e.name&&t.hash===e.hash&&g(t.query,e.query)&&g(t.params,e.params))}function g(t,e){if(void 0===t&&(t={}),void 0===e&&(e={}),!t||!e)return t===e;var r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(function(r){var n=t[r],o=e[r];return null==n||null==o?n===o:"object"==typeof n&&"object"==typeof o?g(n,o):String(n)===String(o)})}function w(t,e,r){var n=t.charAt(0);if("/"===n)return t;if("?"===n||"#"===n)return e+t;var o=e.split("/");r&&o[o.length-1]||o.pop();for(var i=t.replace(/^\//,"").split("/"),a=0;a=0&&(e=t.slice(n),t=t.slice(0,n));var o=t.indexOf("?");return o>=0&&(r=t.slice(o+1),t=t.slice(0,o)),{path:t,query:r,hash:e}}(i.path||""),h=r&&r.path||"/",l=f.path?w(f.path,h,n||i.append):h,d=function(t,e,r){void 0===e&&(e={});var n,o=r||c;try{n=o(t||"")}catch(t){n={}}for(var i in e){var a=e[i];n[i]=Array.isArray(a)?a.map(s):s(a)}return n}(f.query,i.query,o&&o.options.parseQuery),v=i.hash||f.hash;return v&&"#"!==v.charAt(0)&&(v="#"+v),{_normalized:!0,path:l,query:d,hash:v}}var B,H=[String,Object],F=[String,Array],N=function(){},z={name:"RouterLink",props:{to:{type:H,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,ariaCurrentValue:{type:String,default:"page"},event:{type:F,default:"click"}},render:function(e){var r=this,n=this.$router,o=this.$route,i=n.resolve(this.to,o,this.append),a=i.location,u=i.route,s=i.href,c={},p=n.options.linkActiveClass,l=n.options.linkExactActiveClass,d=null==p?"router-link-active":p,v=null==l?"router-link-exact-active":l,y=null==this.activeClass?d:this.activeClass,g=null==this.exactActiveClass?v:this.exactActiveClass,w=u.redirectedFrom?h(null,V(u.redirectedFrom),null,n):u;c[g]=m(o,w),c[y]=this.exact?c[g]:function(t,e){return 0===t.path.replace(f,"/").indexOf(e.path.replace(f,"/"))&&(!e.hash||t.hash===e.hash)&&function(t,e){for(var r in e)if(!(r in t))return!1;return!0}(t.query,e.query)}(o,w);var b=c[g]?this.ariaCurrentValue:null,x=function(t){D(t)&&(r.replace?n.replace(a,N):n.push(a,N))},R={click:D};Array.isArray(this.event)?this.event.forEach(function(t){R[t]=x}):R[this.event]=x;var k={class:c},E=!this.$scopedSlots.$hasNormal&&this.$scopedSlots.default&&this.$scopedSlots.default({href:s,route:u,navigate:x,isActive:c[y],isExactActive:c[g]});if(E){if(1===E.length)return E[0];if(E.length>1||!E.length)return 0===E.length?e():e("span",{},E)}if("a"===this.tag)k.on=R,k.attrs={href:s,"aria-current":b};else{var A=function t(e){if(e)for(var r,n=0;n-1&&(u.params[h]=r.params[h]);return u.path=M(p.path,u.params),s(p,u,a)}if(u.path){u.params={};for(var l=0;l=t.length?r():t[o]?e(t[o],function(){n(o+1)}):n(o+1)};n(0)}var mt={redirected:2,aborted:4,cancelled:8,duplicated:16};function gt(t,e){return bt(t,e,mt.redirected,'Redirected when going from "'+t.fullPath+'" to "'+function(t){if("string"==typeof t)return t;if("path"in t)return t.path;var e={};return xt.forEach(function(r){r in t&&(e[r]=t[r])}),JSON.stringify(e,null,2)}(e)+'" via a navigation guard.')}function wt(t,e){return bt(t,e,mt.cancelled,'Navigation cancelled from "'+t.fullPath+'" to "'+e.fullPath+'" with a new navigation.')}function bt(t,e,r,n){var o=new Error(n);return o._isRouter=!0,o.from=t,o.to=e,o.type=r,o}var xt=["params","query","hash"];function Rt(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function kt(t,e){return Rt(t)&&t._isRouter&&(null==e||t.type===e)}function Et(t){return function(e,r,n){var o=!1,i=0,a=null;At(t,function(t,e,r,u){if("function"==typeof t&&void 0===t.cid){o=!0,i++;var s,c=_t(function(e){var o;((o=e).__esModule||Ct&&"Module"===o[Symbol.toStringTag])&&(e=e.default),t.resolved="function"==typeof e?e:B.extend(e),r.components[u]=e,--i<=0&&n()}),p=_t(function(t){var e="Failed to resolve async component "+u+": "+t;a||(a=Rt(t)?t:new Error(e),n(a))});try{s=t(c,p)}catch(t){p(t)}if(s)if("function"==typeof s.then)s.then(c,p);else{var f=s.component;f&&"function"==typeof f.then&&f.then(c,p)}}}),o||n()}}function At(t,e){return Ot(t.map(function(t){return Object.keys(t.components).map(function(r){return e(t.components[r],t.instances[r],t,r)})}))}function Ot(t){return Array.prototype.concat.apply([],t)}var Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function _t(t){var e=!1;return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(!e)return e=!0,t.apply(this,r)}}var jt=function(t,e){this.router=t,this.base=function(t){if(!t)if(K){var e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}(e),this.current=d,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[],this.listeners=[]};function St(t,e,r,n){var o=At(t,function(t,n,o,i){var a=function(t,e){return"function"!=typeof t&&(t=B.extend(t)),t.options[e]}(t,e);if(a)return Array.isArray(a)?a.map(function(t){return r(t,n,o,i)}):r(a,n,o,i)});return Ot(n?o.reverse():o)}function $t(t,e){if(e)return function(){return t.apply(e,arguments)}}jt.prototype.listen=function(t){this.cb=t},jt.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},jt.prototype.onError=function(t){this.errorCbs.push(t)},jt.prototype.transitionTo=function(t,e,r){var n,o=this;try{n=this.router.match(t,this.current)}catch(t){throw this.errorCbs.forEach(function(e){e(t)}),t}this.confirmTransition(n,function(){var t=o.current;o.updateRoute(n),e&&e(n),o.ensureURL(),o.router.afterHooks.forEach(function(e){e&&e(n,t)}),o.ready||(o.ready=!0,o.readyCbs.forEach(function(t){t(n)}))},function(t){r&&r(t),t&&!o.ready&&(o.ready=!0,kt(t,mt.redirected)?o.readyCbs.forEach(function(t){t(n)}):o.readyErrorCbs.forEach(function(e){e(t)}))})},jt.prototype.confirmTransition=function(t,e,r){var n=this,o=this.current;this.pending=t;var i,a,u=function(t){!kt(t)&&Rt(t)&&(n.errorCbs.length?n.errorCbs.forEach(function(e){e(t)}):console.error(t)),r&&r(t)},s=t.matched.length-1,c=o.matched.length-1;if(m(t,o)&&s===c&&t.matched[s]===o.matched[c])return this.ensureURL(),u(((a=bt(i=o,t,mt.duplicated,'Avoided redundant navigation to current location: "'+i.fullPath+'".')).name="NavigationDuplicated",a));var p=function(t,e){var r,n=Math.max(t.length,e.length);for(r=0;r0)){var e=this.router,r=e.options.scrollBehavior,n=lt&&r;n&&this.listeners.push(nt());var o=function(){var r=t.current,o=Tt(t.base);t.current===d&&o===t._startLocation||t.transitionTo(o,function(t){n&&ot(e,t,r,!0)})};window.addEventListener("popstate",o),this.listeners.push(function(){window.removeEventListener("popstate",o)})}},e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,r){var n=this,o=this.current;this.transitionTo(t,function(t){dt(b(n.base+t.fullPath)),ot(n.router,t,o,!1),e&&e(t)},r)},e.prototype.replace=function(t,e,r){var n=this,o=this.current;this.transitionTo(t,function(t){vt(b(n.base+t.fullPath)),ot(n.router,t,o,!1),e&&e(t)},r)},e.prototype.ensureURL=function(t){if(Tt(this.base)!==this.current.fullPath){var e=b(this.base+this.current.fullPath);t?dt(e):vt(e)}},e.prototype.getCurrentLocation=function(){return Tt(this.base)},e}(jt);function Tt(t){var e=decodeURI(window.location.pathname);return t&&0===e.toLowerCase().indexOf(t.toLowerCase())&&(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}var Lt=function(t){function e(e,r,n){t.call(this,e,r),n&&function(t){var e=Tt(t);if(!/^\/#/.test(e))return window.location.replace(b(t+"/#"+e)),!0}(this.base)||qt()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this;if(!(this.listeners.length>0)){var e=this.router.options.scrollBehavior,r=lt&&e;r&&this.listeners.push(nt());var n=function(){var e=t.current;qt()&&t.transitionTo(Ut(),function(n){r&&ot(t.router,n,e,!0),lt||Vt(n.fullPath)})},o=lt?"popstate":"hashchange";window.addEventListener(o,n),this.listeners.push(function(){window.removeEventListener(o,n)})}},e.prototype.push=function(t,e,r){var n=this,o=this.current;this.transitionTo(t,function(t){Mt(t.fullPath),ot(n.router,t,o,!1),e&&e(t)},r)},e.prototype.replace=function(t,e,r){var n=this,o=this.current;this.transitionTo(t,function(t){Vt(t.fullPath),ot(n.router,t,o,!1),e&&e(t)},r)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;Ut()!==e&&(t?Mt(e):Vt(e))},e.prototype.getCurrentLocation=function(){return Ut()},e}(jt);function qt(){var t=Ut();return"/"===t.charAt(0)||(Vt("/"+t),!1)}function Ut(){var t=window.location.href,e=t.indexOf("#");if(e<0)return"";var r=(t=t.slice(e+1)).indexOf("?");if(r<0){var n=t.indexOf("#");t=n>-1?decodeURI(t.slice(0,n))+t.slice(n):decodeURI(t)}else t=decodeURI(t.slice(0,r))+t.slice(r);return t}function It(t){var e=window.location.href,r=e.indexOf("#");return(r>=0?e.slice(0,r):e)+"#"+t}function Mt(t){lt?dt(It(t)):window.location.hash=t}function Vt(t){lt?vt(It(t)):window.location.replace(It(t))}var Bt=function(t){function e(e,r){t.call(this,e,r),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,r){var n=this;this.transitionTo(t,function(t){n.stack=n.stack.slice(0,n.index+1).concat(t),n.index++,e&&e(t)},r)},e.prototype.replace=function(t,e,r){var n=this;this.transitionTo(t,function(t){n.stack=n.stack.slice(0,n.index).concat(t),e&&e(t)},r)},e.prototype.go=function(t){var e=this,r=this.index+t;if(!(r<0||r>=this.stack.length)){var n=this.stack[r];this.confirmTransition(n,function(){var t=e.current;e.index=r,e.updateRoute(n),e.router.afterHooks.forEach(function(e){e&&e(n,t)})},function(t){kt(t,mt.duplicated)&&(e.index=r)})}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(jt),Ht=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=X(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!lt&&!1!==t.fallback,this.fallback&&(e="hash"),K||(e="abstract"),this.mode=e,e){case"history":this.history=new Pt(this,t.base);break;case"hash":this.history=new Lt(this,t.base,this.fallback);break;case"abstract":this.history=new Bt(this,t.base)}},Ft={currentRoute:{configurable:!0}};function Nt(t,e){return t.push(e),function(){var r=t.indexOf(e);r>-1&&t.splice(r,1)}}return Ht.prototype.match=function(t,e,r){return this.matcher.match(t,e,r)},Ft.currentRoute.get=function(){return this.history&&this.history.current},Ht.prototype.init=function(t){var e=this;if(this.apps.push(t),t.$once("hook:destroyed",function(){var r=e.apps.indexOf(t);r>-1&&e.apps.splice(r,1),e.app===t&&(e.app=e.apps[0]||null),e.app||e.history.teardown()}),!this.app){this.app=t;var r=this.history;if(r instanceof Pt||r instanceof Lt){var n=function(t){r.setupListeners(),function(t){var n=r.current,o=e.options.scrollBehavior;lt&&o&&"fullPath"in t&&ot(e,t,n,!1)}(t)};r.transitionTo(r.getCurrentLocation(),n,n)}r.listen(function(t){e.apps.forEach(function(e){e._route=t})})}},Ht.prototype.beforeEach=function(t){return Nt(this.beforeHooks,t)},Ht.prototype.beforeResolve=function(t){return Nt(this.resolveHooks,t)},Ht.prototype.afterEach=function(t){return Nt(this.afterHooks,t)},Ht.prototype.onReady=function(t,e){this.history.onReady(t,e)},Ht.prototype.onError=function(t){this.history.onError(t)},Ht.prototype.push=function(t,e,r){var n=this;if(!e&&!r&&"undefined"!=typeof Promise)return new Promise(function(e,r){n.history.push(t,e,r)});this.history.push(t,e,r)},Ht.prototype.replace=function(t,e,r){var n=this;if(!e&&!r&&"undefined"!=typeof Promise)return new Promise(function(e,r){n.history.replace(t,e,r)});this.history.replace(t,e,r)},Ht.prototype.go=function(t){this.history.go(t)},Ht.prototype.back=function(){this.go(-1)},Ht.prototype.forward=function(){this.go(1)},Ht.prototype.getMatchedComponents=function(t){var e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},Ht.prototype.resolve=function(t,e,r){var n=V(t,e=e||this.history.current,r,this),o=this.match(n,e),i=o.redirectedFrom||o.fullPath;return{location:n,route:o,href:function(t,e,r){var n="hash"===r?"#"+e:e;return t?b(t+"/"+n):n}(this.history.base,i,this.mode),normalizedTo:n,resolved:o}},Ht.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==d&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(Ht.prototype,Ft),Ht.install=function t(r){if(!t.installed||B!==r){t.installed=!0,B=r;var n=function(t){return void 0!==t},o=function(t,e){var r=t.$options._parentVnode;n(r)&&n(r=r.data)&&n(r=r.registerRouteInstance)&&r(t,e)};r.mixin({beforeCreate:function(){n(this.$options.router)?(this._routerRoot=this,this._router=this.$options.router,this._router.init(this),r.util.defineReactive(this,"_route",this._router.history.current)):this._routerRoot=this.$parent&&this.$parent._routerRoot||this,o(this,this)},destroyed:function(){o(this)}}),Object.defineProperty(r.prototype,"$router",{get:function(){return this._routerRoot._router}}),Object.defineProperty(r.prototype,"$route",{get:function(){return this._routerRoot._route}}),r.component("RouterView",e),r.component("RouterLink",z);var i=r.config.optionMergeStrategies;i.beforeRouteEnter=i.beforeRouteLeave=i.beforeRouteUpdate=i.created}},Ht.version="3.4.4",Ht.isNavigationFailure=kt,Ht.NavigationFailureType=mt,K&&window.Vue&&window.Vue.use(Ht),Ht},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).VueRouter=e(); \ No newline at end of file From 4a4b46fd5e5f3790dcdc64697009f4ac9cd40664 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 24 Sep 2020 19:31:28 +0200 Subject: [PATCH 15/15] chore(release): 3.4.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cdf53297f..7b6300a50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-router", - "version": "3.4.3", + "version": "3.4.4", "description": "Official router for Vue.js 2", "author": "Evan You", "license": "MIT",