xe-utils
Version:
JavaScript 函数库、工具类
11 lines (9 loc) • 541 B
JavaScript
import staticLocation from './staticLocation.js';import helperGetLocatOrigin from './helperGetLocatOrigin.js';import helperStringSubstring from './helperStringSubstring.js';import lastIndexOf from './lastIndexOf.js';function getBaseURL () {
if (staticLocation) {
var pathname = staticLocation.pathname
var lastIndex = lastIndexOf(pathname, '/') + 1
return helperGetLocatOrigin() + (lastIndex === pathname.length ? pathname : helperStringSubstring(pathname, 0, lastIndex))
}
return ''
}
export default getBaseURL