From 7b6eef3eb7d96b59f66d18b5952500d99c8ed2c5 Mon Sep 17 00:00:00 2001 From: fengzewu Date: Thu, 9 Mar 2023 21:00:31 +0800 Subject: [PATCH] fix code Signed-off-by: fengzewu --- .../reference/apis/js-apis-image.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-image.md b/zh-cn/application-dev/reference/apis/js-apis-image.md index 37e3873ff9..eee086510f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-image.md +++ b/zh-cn/application-dev/reference/apis/js-apis-image.md @@ -947,8 +947,18 @@ createImageSource(uri: string): ImageSource **示例:** ```js -let context = featureAbility.getContext(); -let path = context.getCacheDir() + "test.jpg"; +//Stage模型 +const context = getContext(this); +const path = context.getCacheDir() + "/test.jpg"; +const imageSourceApi = image.createImageSource(path); +``` + +```js +//FA模型 +import featureAbility from '@ohos.ability.featureAbility'; + +const context = featureAbility.getContext(); +const path = context.getCacheDir() + "/test.jpg"; const imageSourceApi = image.createImageSource(path); ``` -- GitLab