-
Notifications
You must be signed in to change notification settings - Fork 1
规范化 URL 实现 #2
Copy link
Copy link
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Type
Fields
Give feedbackNo fields configured for Feature.
RouterOptions.base
base是路由的基础路径配置项,用于指定路由的前缀路径。类型定义:
默认值:
new URL(location.href)new URL('http://localhost')router.push(pushUrl)
URL 解析遵循以下优先级顺序:
绝对地址:
new URL(pushUrl)解析https://example.com/path包含域名的相对地址:
new URL(normalizeUrl(pushUrl))解析//example.com/path站内相对地址:
new URL(pushUrl, base)解析path/to/page