Skip to content

modify method when pass absolute path for option.base #1353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

thebeautyoflove
Copy link

my colleague and me use a static html to load pages from other site to prevent cross-main.
so when we want when we pass base like 'http://xxx.com' in option . vue-router can join the url accurately;
thank you

Copy link

@blqw blqw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Url, take care of the reference. http://jsrun.net/IxkKp/edit

@@ -561,7 +561,9 @@ function parsePath (path) {
}

function cleanPath (path) {
return path.replace(/\/\//g, '/')
var ishttp = /^\w+:\/\//.exec(path);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RepExpr here needs to be modified. because there's still this kind of situation:

//google.com

so the RegExpr should be it

/^([a-z]+:)?\/\//i

@@ -1759,7 +1761,9 @@ function normalizeBase (base) {
}
}
// make sure there's the starting slash
if (base.charAt(0) !== '/') {
if(/^[a-z]+:\/\//i.test(base)){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RepExpr here needs to be modified. because there's still this kind of situation:

//google.com
so the RegExpr should be it

/^([a-z]+:)?///i

@posva
Copy link
Member

posva commented May 28, 2017

Sorry for the delay. It looks like #1426 is something that may be related. There's still a bit more to investigate to make sure a correct solution is provided

The modifications should be to the source files. The files on the dist folder are generated 🙂
Thanks a lot for the PR but I'm closing this as we still need to do some checks

@posva posva closed this May 28, 2017
if (base.charAt(0) !== '/') {
if(/^[a-z]+:\/\//i.test(base)){

}else if (base.charAt(0) !== '/') {
base = '/' + base;
}
// remove trailing slash
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请问,需要修改源码才能实现在History模式下去掉http://api.com/http:/static.com/test前面的部分吗

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一般/开头的都是站内link , 如果是站外 link 的话, 可以使用<a target="_blank"></a>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants