使用
import URL from 'url'
const url = new URL('https://www.aaa.com:8989/bbb/ccc/ddd.html?e=1&f=2&g#h=3&i=4&j?k=5#l=6&e=4')
console.log(url)
结果
{
"href": "https://www.aaa.com:8989/bbb/ccc/ddd.html?e=1&f=2&g#h=3&i=4&j?k=5#l=6&e=4",
"origin": "https://www.aaa.com",
"protocol": "https:",
"host": "www.aaa.com",
"port": "8989",
"pathname": "/bbb/ccc/ddd.html",
"search": "?e=1&f=2&g&k=5",
"hash": "#h=3&i=4&j&l=6&e=4",
"params": {
"h": "3",
"i": "4",
"l": "6",
"e": "1",
"f": "2",
"k": "5"
}
}
代码
详细代码请移步我的另一篇文章文章来源地址https://www.toymoban.com/news/detail-706855.html
文章来源:https://www.toymoban.com/news/detail-706855.html
到了这里,关于手动实现uni-app可用的new URL的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!