fix(ssr): remove context
This commit is contained in:
parent
d53b8dadb3
commit
46261572e3
12 changed files with 58 additions and 59 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { getBasePath, getPath, isAbsolutePath } from '../util'
|
||||
import { getPath, isAbsolutePath } from '../util'
|
||||
import { noop } from '../../util/core'
|
||||
|
||||
function getAlias (path, alias) {
|
||||
|
|
@ -18,9 +18,13 @@ export class History {
|
|||
this.config = config
|
||||
}
|
||||
|
||||
getBasePath() {
|
||||
return this.config.basePath
|
||||
}
|
||||
|
||||
getFile (path) {
|
||||
const { config } = this
|
||||
const base = getBasePath(config.basePath)
|
||||
const base = this.getBasePath()
|
||||
|
||||
path = config.alias ? getAlias(path, config.alias) : path
|
||||
path = getFileName(path)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,15 @@ export class HashHistory extends History {
|
|||
this.mode = 'hash'
|
||||
}
|
||||
|
||||
getBasePath() {
|
||||
const path = window.location.pathname || ''
|
||||
const base = this.config.basePath
|
||||
|
||||
return /^(\/|https?:)/g.test(base)
|
||||
? base
|
||||
: cleanPath(path + '/' + base)
|
||||
}
|
||||
|
||||
getCurrentPath () {
|
||||
// We can't use location.hash here because it's not
|
||||
// consistent across browsers - Firefox will pre-decode it!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue