From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../web/api/urlsearchparams/tostring/index.html | 106 +++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 files/zh-cn/web/api/urlsearchparams/tostring/index.html (limited to 'files/zh-cn/web/api/urlsearchparams/tostring') diff --git a/files/zh-cn/web/api/urlsearchparams/tostring/index.html b/files/zh-cn/web/api/urlsearchparams/tostring/index.html new file mode 100644 index 0000000000..6efd11d077 --- /dev/null +++ b/files/zh-cn/web/api/urlsearchparams/tostring/index.html @@ -0,0 +1,106 @@ +--- +title: URLSearchParams.toString() +slug: Web/API/URLSearchParams/toString +translation_of: Web/API/URLSearchParams/toString +--- +

{{ApiRef("URL API")}}{{SeeCompatTable}} 

+ +

{{domxref("URLSearchParams")}} 接口的toString()方法 返回适用在URL中的查询字符串。

+ +

语法

+ +
URLSearchParams.toString()
+ +

返回值

+ +

字符串

+ +

实例

+ +
let url = new URL('https://example.com?foo=1&bar=2');
+let params = new URLSearchParams(url.search.slice(1));
+
+//Add a second foo parameter.
+params.append('foo', 4);
+console.log(params.toString());
+//Prints 'foo=1&bar=2&foo=4'.
+ +

规范

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('URL', '#urlsearchparams-stringification-behavior', "toString()")}}{{Spec2('URL')}}Initial definition. Appears in the IDL as stringifier.
+ +

浏览器兼容

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support{{CompatChrome(49.0)}}{{CompatVersionUnknown}}{{CompatNo}}{{CompatVersionUnknown}}{{CompatUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidAndroid WebviewFirefox Mobile (Gecko)IE MobileOpera MobileSafari MobileChrome for Android
Basic support{{CompatNo}}{{CompatChrome(49.0)}}{{CompatVersionUnknown}}{{CompatNo}}{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatChrome(49.0)}}
+
+ +

参考

+ + -- cgit v1.2.3-54-g00ecf