diff --git a/zh-cn/application-dev/reference/apis/js-apis-curve.md b/zh-cn/application-dev/reference/apis/js-apis-curve.md index fff376653d0a691788e8623a0bd2e880de014476..4083dbbdb96fea6d4670808dfbbab26a9571e2e1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-curve.md +++ b/zh-cn/application-dev/reference/apis/js-apis-curve.md @@ -279,9 +279,9 @@ customCurve(interpolate: (fraction: number) => number): ICurve ```ts import Curves from '@ohos.curves' -let interpolate = function(fraction) { - return Math.sqrt(fraction) - } +let interpolate = (fraction:number):number => { + return Math.sqrt(fraction) +} let curve = Curves.customCurve(interpolate) // 创建一个用户自定义æ’值曲线 ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-font.md b/zh-cn/application-dev/reference/apis/js-apis-font.md index d1ae820a17ee9130f34c2a3ba0ccbb74c9b17083..ff5d03fda1579dfa9d2ab5d7408806b0f867a429 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-font.md +++ b/zh-cn/application-dev/reference/apis/js-apis-font.md @@ -104,7 +104,7 @@ import font from '@ohos.font'; @Entry @Component struct FontExample { - fontList: Array<string>; + fontList: Array<string> = new Array<string>(); build() { Column() { Button("getSystemFontList") @@ -164,8 +164,8 @@ import font from '@ohos.font'; @Entry @Component struct FontExample { - fontList: Array<string>; - fontInfo: font.FontInfo; + fontList: Array<string> = new Array<string>(); + fontInfo: font.FontInfo = font.getFontByName(''); build() { Column() { Button("getFontByName") diff --git a/zh-cn/application-dev/reference/apis/js-apis-matrix4.md b/zh-cn/application-dev/reference/apis/js-apis-matrix4.md index 9cd9ee889ea6dd9f31f196fbe6ed37fb73e6320d..c10be54904ed2a2ad8fafbe9ee0e798373a11448 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-matrix4.md +++ b/zh-cn/application-dev/reference/apis/js-apis-matrix4.md @@ -561,9 +561,9 @@ import matrix4 from '@ohos.matrix4' @Entry @Component struct Test { - private originPoint: [number, number] = [50, 50] + private originPoint: number[] = [50, 50] private matrix_1 = matrix4.identity().translate({ x: 150, y: -50 }) - private transformPoint = this.matrix_1.transformPoint(this.originPoint) + private transformPoint = this.matrix_1.transformPoint([this.originPoint[0], this.originPoint[1]]) private matrix_2 = matrix4.identity().translate({ x: this.transformPoint[0], y: this.transformPoint[1] }) build() { diff --git a/zh-cn/application-dev/reference/apis/js-apis-mediaquery.md b/zh-cn/application-dev/reference/apis/js-apis-mediaquery.md index 5277999966fe8f6d57f4bd059f23f7d5f332f54e..d6e81af5da132a9d69fe9c0f9ad563a6635ef153 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-mediaquery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-mediaquery.md @@ -30,14 +30,14 @@ matchMediaSync(condition: string): MediaQueryListener **å‚数:** -| å‚æ•°å | 类型 | å¿…å¡« | 说明 | -| --------- | ------ | ---- | ---------------------------------------- | -| condition | string | 是 | 媒体事件的匹é…æ¡ä»¶ï¼Œå…·ä½“å¯å‚考[媒体查询è¯æ³•è§„则](../../ui/arkts-layout-development-media-query.md#è¯æ³•è§„则)。 | +| å‚æ•°å | 类型 | å¿…å¡« | 说明 | +| --------- | ------ | ---- | ------------------------------------------------------------ | +| condition | string | 是 | 媒体事件的匹é…æ¡ä»¶ï¼Œå…·ä½“å¯å‚考[媒体查询è¯æ³•è§„则](../../ui/arkts-layout-development-media-query.md#è¯æ³•è§„则)。 | **返回值:** -| 类型 | 说明 | -| ------------------ | ---------------------- | +| 类型 | 说明 | +| ------------------ | -------------------------------------------- | | MediaQueryListener | 媒体事件监å¬å¥æŸ„,用于注册和去注册监å¬å›žè°ƒã€‚ | **示例:** @@ -71,10 +71,10 @@ on(type: 'change', callback: Callback<MediaQueryResult>): void **å‚数:** -| å‚æ•°å | 类型 | å¿…å¡« | 说明 | -| -------- | -------------------------------- | ---- | ---------------- | -| type | string | 是 | 必须填写å—符串'change'。 | -| callback | Callback<MediaQueryResult> | 是 | å‘媒体查询注册的回调 | +| å‚æ•°å | 类型 | å¿…å¡« | 说明 | +| -------- | -------------------------------- | ---- | ------------------------ | +| type | string | 是 | 必须填写å—符串'change'。 | +| callback | Callback<MediaQueryResult> | 是 | å‘媒体查询注册的回调 | **示例:** @@ -102,7 +102,7 @@ off(type: 'change', callback?: Callback<MediaQueryResult>): void import mediaquery from '@ohos.mediaquery' let listener = mediaquery.matchMediaSync('(orientation: landscape)'); //监å¬æ¨ªå±äº‹ä»¶ - function onPortrait(mediaQueryResult) { + function onPortrait(mediaQueryResult:mediaquery.MediaQueryResult) { if (mediaQueryResult.matches) { // do something here } else { @@ -141,7 +141,7 @@ struct MediaQueryExample { @State text: string = 'Portrait' listener = mediaquery.matchMediaSync('(orientation: landscape)') - onPortrait(mediaQueryResult) { + onPortrait(mediaQueryResult:mediaquery.MediaQueryResult) { if (mediaQueryResult.matches) { this.color = '#FFD700' this.text = 'Landscape' @@ -152,7 +152,7 @@ struct MediaQueryExample { } aboutToAppear() { - let portraitFunc = this.onPortrait.bind(this) // bind current js instance + let portraitFunc = (mediaQueryResult:mediaquery.MediaQueryResult):void=>this.onPortrait(mediaQueryResult) // bind current js instance this.listener.on('change', portraitFunc) } diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md b/zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md index 7a17fd7c56e4c767dac5a32fe67a8b8eac6ebba7..b1ca158ad766f477f665a8fa4dfebfa5174654d5 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md @@ -98,7 +98,10 @@ addListener(callback: (event: MediaQueryEvent) => void): void **示例:** ```ts -function maxWidthMatch(e){ +import mediaquery, { MediaQueryEvent } from '@system.mediaquery'; +let mMediaQueryList = mediaquery.matchMedia('(max-width: 466)'); + +function maxWidthMatch(e: MediaQueryEvent): void { if(e.matches){ // do something } @@ -124,13 +127,13 @@ removeListener(callback: (event: MediaQueryEvent) => void): void **示例:** ```ts -function maxWidthMatch(e){ +import mediaquery, { MediaQueryEvent } from '@system.mediaquery'; +let mMediaQueryList = mediaquery.matchMedia('(max-width: 466)'); + +function maxWidthMatch(e: MediaQueryEvent): void { if(e.matches){ // do something } } mMediaQueryList.removeListener(maxWidthMatch); -``` - - - +``` \ No newline at end of file