-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Conversation
There was a problem hiding this 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); |
There was a problem hiding this comment.
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)){ |
There was a problem hiding this comment.
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
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 🙂 |
if (base.charAt(0) !== '/') { | ||
if(/^[a-z]+:\/\//i.test(base)){ | ||
|
||
}else if (base.charAt(0) !== '/') { | ||
base = '/' + base; | ||
} | ||
// remove trailing slash |
There was a problem hiding this comment.
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前面的部分吗
There was a problem hiding this comment.
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>
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