[build] 4.0.1 next

This commit is contained in:
qingwei.li 2017-05-30 06:34:35 +08:00
commit 3db4841da3
No known key found for this signature in database
GPG key ID: B6DDC2F7AE80B2F4
5 changed files with 36 additions and 36 deletions

View file

@ -2732,17 +2732,6 @@ function stringifyQuery (obj) {
return qs.length ? ("?" + (qs.join('&'))) : ''
}
var getBasePath = cached(function (base) {
if ( base === void 0 ) base = '';
// TODO
var path = inBrowser ? window.location.pathname : '';
return /^(\/|https?:)/g.test(base)
? base
: cleanPath(path + '/' + base)
});
function getPath () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
@ -2774,7 +2763,7 @@ var Compiler = function Compiler (config, router) {
this.cacheTree = {};
this.toc = [];
this.linkTarget = config.externalLinkTarget || '_blank';
this.contentBase = getBasePath(config.basePath);
this.contentBase = router.getBasePath();
var renderer = this._initRenderer();
var compile;
@ -3233,7 +3222,7 @@ function renderMixin (proto) {
toggleClass(el, 'add', 'has-mask');
if (!isAbsolutePath(m[1])) {
path = getPath(getBasePath(this.config.basePath), m[1]);
path = getPath(this.router.getBasePath(), m[1]);
}
el.style.backgroundImage = "url(" + path + ")";
el.style.backgroundSize = 'cover';
@ -3317,10 +3306,14 @@ var History = function History (config) {
this.config = config;
};
History.prototype.getBasePath = function getBasePath () {
return this.config.basePath
};
History.prototype.getFile = function getFile (path) {
var ref = this;
var config = ref.config;
var base = getBasePath(config.basePath);
var base = this.getBasePath();
path = config.alias ? getAlias(path, config.alias) : path;
path = getFileName(path);
@ -3365,6 +3358,15 @@ var HashHistory = (function (History$$1) {
HashHistory.prototype = Object.create( History$$1 && History$$1.prototype );
HashHistory.prototype.constructor = HashHistory;
HashHistory.prototype.getBasePath = function getBasePath () {
var path = window.location.pathname || '';
var base = this.config.basePath;
return /^(\/|https?:)/g.test(base)
? base
: cleanPath(path + '/' + base)
};
HashHistory.prototype.getCurrentPath = function getCurrentPath () {
// We can't use location.hash here because it's not
// consistent across browsers - Firefox will pre-decode it!
@ -3628,6 +3630,7 @@ function fetchMixin (proto) {
var root = getParentPath(this.route.path);
var path = this.router.getFile(root + coverpage);
console.log(this.route.path, root, path);
if (this.route.path !== '/' || !coverpage) {
this._renderCover();
return
@ -3705,7 +3708,6 @@ var util = Object.freeze({
supportsPushState: supportsPushState,
parseQuery: parseQuery,
stringifyQuery: stringifyQuery,
getBasePath: getBasePath,
getPath: getPath,
isAbsolutePath: isAbsolutePath,
getParentPath: getParentPath,