Created
September 1, 2022 06:00
-
-
Save ciming/4cc3e543a7b512c32a58718fb6dafb25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//生成URL | |
const searchParams = new URLSearchParams(); | |
searchParams.set('foo', 'bar'); | |
searchParams.set('hello', 'world'); | |
const searchParams = new URLSearchParams([ | |
['foo', 'bar'], | |
['hello', 'world'], | |
]); | |
const searchParams = new URLSearchParams({ | |
foo: 'bar', | |
hello: 'world', | |
}); | |
const searchParams = new URLSearchParams('foo=bar&hello=world'); | |
// Logs 'foo=bar&hello=world' | |
console.log(searchParams.toString()); | |
//URL解析 | |
Object.fromEntries(searchParams); | |
const searchParams = new URLSearchParams(location.search); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment