diff --git a/build/configs.js b/build/configs.js index f81ec3a93..685a64846 100644 --- a/build/configs.js +++ b/build/configs.js @@ -55,6 +55,9 @@ function genConfig (opts) { format: opts.format, banner, name: 'VueRouter' + }, + watch: { + chokidar: false } } diff --git a/src/index.js b/src/index.js index a1a7b8507..6ea5d6257 100644 --- a/src/index.js +++ b/src/index.js @@ -41,12 +41,20 @@ export default class VueRouter { this.afterHooks = [] this.matcher = createMatcher(options.routes || [], this) + let CustomHistory let mode = options.mode || 'hash' this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false if (this.fallback) { mode = 'hash' } - if (!inBrowser) { + + if (options.mode && options.mode.constructor === Object) { + mode = options.mode.name + + CustomHistory = options.mode.factory(AbstractHistory) + } + + if (!inBrowser && !CustomHistory) { mode = 'abstract' } this.mode = mode @@ -62,6 +70,11 @@ export default class VueRouter { this.history = new AbstractHistory(this, options.base) break default: + if (CustomHistory) { + this.history = new CustomHistory(this, options.base) + break + } + if (process.env.NODE_ENV !== 'production') { assert(false, `invalid mode: ${mode}`) } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy