feat: finish ssr
This commit is contained in:
parent
6dea685fee
commit
3444884905
12 changed files with 163 additions and 40 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { cached } from '../util/core'
|
||||
import { inBrowser } from '../util/env'
|
||||
|
||||
const decode = decodeURIComponent
|
||||
const encode = encodeURIComponent
|
||||
|
|
@ -31,10 +32,13 @@ export function stringifyQuery (obj) {
|
|||
return qs.length ? `?${qs.join('&')}` : ''
|
||||
}
|
||||
|
||||
export const getBasePath = cached(base => {
|
||||
export const getBasePath = cached((base = '') => {
|
||||
// TODO
|
||||
const path = inBrowser ? window.location.pathname : ''
|
||||
|
||||
return /^(\/|https?:)/g.test(base)
|
||||
? base
|
||||
: cleanPath(window.location.pathname + '/' + base)
|
||||
: cleanPath(path + '/' + base)
|
||||
})
|
||||
|
||||
export function getPath (...args) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue