harmony 鸿蒙Common Library Subsystem Changelog
Common Library Subsystem Changelog
Compared with OpenHarmony 3.2 Beta4, OpenHarmony 3.2.10.1(MR) has the following API changes in the URL module of the common library subsystem.
cl.commonlibrary.1 URLParams Class Changes
The constructor function of the URLParams class in the URL module of the common library subsystem is changed.
Specifically, constructor(init?: string[][]|Record
You need to adapt your application.
Change Impacts
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
Key API/Component Changes
Module | Class | Method/Attribute/Enum/Constant | Change Type |
---|---|---|---|
@ohos.url | URLParams | constructor(string[][] |Record<string, string> |string |URLSearchParams) | Deleted |
@ohos.url | URLParams | constructor(string[][] |Record<string, string> |string |URLParams) | Changed |
Adaptation Guide
The following illustrates how to create a URLParams object in your application.
Example:
import url from '@ohos.url'
try {
let params1 = new Url.URLParams('?user=abc&query=xyz')
let params2 = new Url.URLParams(params1)
var result= params2.toString()
console.log(result) //"user=abc&query=xyz"
} catch (err) {
console.error(`Fail to ceate URLParams.codeis${err.code},message is ${err.message}`);
}
cl.commonlibrary.2 URL Attribute Changes of URLParams Class APIs
The URL attributes of the URL module in the common library subsystem are changed.
Specifically, the searchParams: URLSearchParams attribute is deprecated, and the params: URLParams attribute is added.
You need to adapt your application.
Change Impacts
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
Key API/Component Changes
Module | Class | Method/Attribute/Enum/Constant | Change Type |
---|---|---|---|
@ohos.url | URL | searchParams: URLSearchParams; | Deprecated (in API version 9) |
@ohos.url | URL | params: URLParams; | Added |
Adaptation Guide
The following illustrates how to create a URLParams object in your application.
Example:
import url from '@ohos.url'
let that = new Url.URL('http://username:password@host:8080/directory/file?Hello=china#qwer=da')
let params = that.URLParams
var result = params.toString()
console.log(result) //%E4%BD%A0%E5%A5%BD=china
你可能感兴趣的鸿蒙文章
harmony 鸿蒙ArkUI Subsystem LocalStorage Class ChangeLog
harmony 鸿蒙Security Subsystem ChangeLog
harmony 鸿蒙Ability Subsystem Changelog
harmony 鸿蒙ChangeLog of JS API Changes in the commonlibrary Subsystem
harmony 鸿蒙ChangeLog of JS API Changes of the Distributed Data Management Subsystem
harmony 鸿蒙cl.multimedia.av_session.001 Change of All av_session APIs to System APIs
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦