代码拉取完成,页面将自动刷新
import _getURLPattern from './_getURLPattern'
/**
* 解析 URL 地址中的相关属性,返回解析后的对象数据
* @method getURLProps
* @since 1.4.0
* @param {String} url
* @return {Object}
*/
const getURLProps = (url = location.href) => {
const pattern = _getURLPattern()
const matches = pattern.exec(url)
const protocol = matches[1] ? matches[1].replace(':', '') : ''
const host = matches[5]
return {
protocol,
username: matches[3] || '',
password: matches[4] || '',
hostname: matches[6],
port: matches[13] ? matches[13].replace(':', '') : '',
host: matches[5],
pathname: matches[15],
search: matches[17] || '',
path: matches[14],
hash: matches[18] || '',
href: url,
origin: protocol + '://' + host
}
}
export default getURLProps
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。