未验证 提交 22620d77 编写于 作者: O openharmony_ci 提交者: Gitee

!5457 翻译完成:5232 【轻量级 PR】js-apis-screenshot.md

Merge pull request !5457 from wusongqing/TR5232
......@@ -57,7 +57,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a cal
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Required permissions**: ohos.permission.CAPTURE_SCREEN
**Required permissions**: ohos.permission.CAPTURE_SCREEN (available only to system applications)
**Parameters**
......@@ -68,8 +68,8 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a cal
**Example**
```js
var ScreenshotOptions = {
```js
var ScreenshotOptions = {
"screenRect": {
"left": 200,
"top": 100,
......@@ -79,15 +79,15 @@ var ScreenshotOptions = {
"width": 300,
"height": 300},
"rotation": 0
};
screenshot.save(ScreenshotOptions, (err, data) => {
};
screenshot.save(ScreenshotOptions, (err, data) => {
if (err) {
console.error('Failed to save the screenshot. Error: ' + JSON.stringify(err));
return;
}
console.info('Screenshot saved. Data: ' + JSON.stringify(data));
});
```
});
```
## screenshot.save
......@@ -97,7 +97,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a pro
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Required permissions**: ohos.permission.CAPTURE_SCREEN
**Required permissions**: ohos.permission.CAPTURE_SCREEN (available only to system applications)
**Parameters**
......@@ -113,8 +113,8 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a pro
**Example**
```js
var ScreenshotOptions = {
```js
var ScreenshotOptions = {
"screenRect": {
"left": 200,
"top": 100,
......@@ -124,11 +124,11 @@ var ScreenshotOptions = {
"width": 300,
"height": 300},
"rotation": 0
};
let promise = screenshot.save(ScreenshotOptions);
promise.then(() => {
};
let promise = screenshot.save(ScreenshotOptions);
promise.then(() => {
console.log('screenshot save success');
}).catch((err) => {
}).catch((err) => {
console.log('screenshot save fail: ' + JSON.stringify(err));
});
```
\ No newline at end of file
});
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册