通过 a标签解析 url
const urlParsingNode = document.createElement('a') function resolveUrl(url) { urlParsingNode.setAttribute('href', url) const { protocol, host} = urlParsingNode; return { protocol, host } }
通过 a标签解析 url
const urlParsingNode = document.createElement('a') function resolveUrl(url) { urlParsingNode.setAttribute('href', url) const { protocol, host} = urlParsingNode; return { protocol, host } }