fix(ssr): remove context

This commit is contained in:
qingwei.li 2017-05-30 06:32:41 +08:00
commit 46261572e3
No known key found for this signature in database
GPG key ID: B6DDC2F7AE80B2F4
12 changed files with 58 additions and 59 deletions

View file

@ -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)

View file

@ -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!