diff --git a/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md b/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md index 038f9160d5d8d274243642d70559916d7668386c..78f0bec7ffa1aa3efa02af6f4051f53d5c13bc2a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md +++ b/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md @@ -12,18 +12,18 @@ import pasteboard from '@ohos.pasteboard'; ``` -## 属性 +## 常量 **系统能力:** SystemCapability.MiscServices.Pasteboard | 名称 | 参数类型 | 值 | 说明 | | -------- | -------- | -------- | -------- | | MAX_RECORD_NUM7+ | number | 512 | 单个PasteData中所能包含的最大条目数。 | -| MIMETYPE_TEXT_HTML7+ | string | text/html | HTML内容的MIME类型定义。 | -| MIMETYPE_TEXT_WANT7+ | string | text/want | Want内容的MIME类型定义。 | -| MIMETYPE_TEXT_PLAIN7+ | string | text/plain | 纯文本内容的MIME类型定义。 | -| MIMETYPE_TEXT_URI7+ | string | text/uri | URI内容的MIME类型定义。 | -| MIMETYPE_PIXELMAP9+ | string | pixelMap | PixelMap内容的MIME类型定义。 | +| MIMETYPE_TEXT_HTML7+ | string | 'text/html' | HTML内容的MIME类型定义。 | +| MIMETYPE_TEXT_WANT7+ | string | 'text/want' | Want内容的MIME类型定义。 | +| MIMETYPE_TEXT_PLAIN7+ | string | 'text/plain' | 纯文本内容的MIME类型定义。 | +| MIMETYPE_TEXT_URI7+ | string | 'text/uri' | URI内容的MIME类型定义。 | +| MIMETYPE_PIXELMAP9+ | string | 'pixelMap' | PixelMap内容的MIME类型定义。 | ## ValueType9+ @@ -421,10 +421,10 @@ convertToTextV9(callback: AsyncCallback<string>): void let record = pasteboard.createUriRecord('dataability:///com.example.myapplication1/user.txt'); record.convertToTextV9((err, data) => { if (err) { - console.error('Failed to convert to text. Cause: ${err.message}'); + console.error(`Failed to convert to text. Cause: ${err.message}`); return; } - console.info('Succeeded in converting to text. Data: ${data}'); + console.info(`Succeeded in converting to text. Data: ${data}`); }); ``` @@ -447,9 +447,9 @@ convertToTextV9(): Promise<string> ```js let record = pasteboard.createUriRecord('dataability:///com.example.myapplication1/user.txt'); record.convertToTextV9().then((data) => { - console.info('Succeeded in converting to text. Data: ${data}'); + console.info(`Succeeded in converting to text. Data: ${data}`); }).catch((err) => { - console.error('Failed to convert to text. Cause: ${err.message}'); + console.error(`Failed to convert to text. Cause: ${err.message}`); }); ``` @@ -476,10 +476,10 @@ convertToText(callback: AsyncCallback<string>): void let record = pasteboard.createUriRecord('dataability:///com.example.myapplication1/user.txt'); record.convertToText((err, data) => { if (err) { - console.error('Failed to convert to text. Cause: ${err.message}'); + console.error(`Failed to convert to text. Cause: ${err.message}`); return; } - console.info('Succeeded in converting to text. Data: ${data}'); + console.info(`Succeeded in converting to text. Data: ${data}`); }); ``` @@ -505,9 +505,9 @@ convertToText(): Promise<string> ```js let record = pasteboard.createUriRecord('dataability:///com.example.myapplication1/user.txt'); record.convertToText().then((data) => { - console.info('Succeeded in converting to text. Data: ${data}'); + console.info(`Succeeded in converting to text. Data: ${data}`); }).catch((err) => { - console.error('Failed to convert to text. Cause: ${err.message}'); + console.error(`Failed to convert to text. Cause: ${err.message}`); }); ``` @@ -1251,7 +1251,7 @@ clearData(callback: AsyncCallback<void>): void ```js systemPasteboard.clearData((err, data) => { if (err) { - console.error('Failed to clear the pasteboard. Cause: ${err.message}'); + console.error(`Failed to clear the pasteboard. Cause: ${err.message}`); return; } console.info('Succeeded in clearing the pasteboard.'); @@ -1277,8 +1277,8 @@ clearData(): Promise<void> ```js systemPasteboard.clearData().then((data) => { console.info('Succeeded in clearing the pasteboard.'); -}).catch((err) => { - console.error('Failed to clear the pasteboard. Cause: ${err.message}'); +}).catch((err) => { + console.error(`Failed to clear the pasteboard. Cause: ${err.message}`); }); ``` @@ -1444,10 +1444,10 @@ hasData(callback: AsyncCallback<boolean>): void ```js systemPasteboard.hasData((err, data) => { if (err) { - console.error('Failed to check the PasteData. Cause: ${err.message}'); + console.error(`Failed to check the PasteData. Cause: ${err.message}`); return; } - console.info('Succeeded in checking the PasteData. Data: ${data}'); + console.info(`Succeeded in checking the PasteData. Data: ${data}`); }); ``` @@ -1469,9 +1469,9 @@ hasData(): Promise<boolean> ```js systemPasteboard.hasData().then((data) => { - console.info('Succeeded in checking the PasteData. Data: ${data}'); + console.info(`Succeeded in checking the PasteData. Data: ${data}`); }).catch((err) => { - console.error('Failed to check the PasteData. Cause: ${err.message}'); + console.error(`Failed to check the PasteData. Cause: ${err.message}`); }); ``` @@ -1497,7 +1497,7 @@ clear(callback: AsyncCallback<void>): void ```js systemPasteboard.clear((err, data) => { if (err) { - console.error('Failed to clear the PasteData. Cause: ${err.message}'); + console.error(`Failed to clear the PasteData. Cause: ${err.message}`); return; } console.info('Succeeded in clearing the PasteData.'); @@ -1527,7 +1527,7 @@ clear(): Promise<void> systemPasteboard.clear().then((data) => { console.info('Succeeded in clearing the PasteData.'); }).catch((err) => { - console.error('Failed to clear the PasteData. Cause: ${err.message}'); + console.error(`Failed to clear the PasteData. Cause: ${err.message}`); }); ``` @@ -1611,10 +1611,10 @@ hasPasteData(callback: AsyncCallback<boolean>): void ```js systemPasteboard.hasPasteData((err, data) => { if (err) { - console.error('Failed to check the PasteData. Cause: ${err.message}'); + console.error(`Failed to check the PasteData. Cause: ${err.message}`); return; } - console.info('Succeeded in checking the PasteData. Data: ${data}'); + console.info(`Succeeded in checking the PasteData. Data: ${data}`); }); ``` @@ -1639,9 +1639,9 @@ hasPasteData(): Promise<boolean> ```js systemPasteboard.hasPasteData().then((data) => { - console.info('Succeeded in checking the PasteData. Data: ${data}'); + console.info(`Succeeded in checking the PasteData. Data: ${data}`); }).catch((err) => { - console.error('Failed to check the PasteData. Cause: ${err.message}'); + console.error(`Failed to check the PasteData. Cause: ${err.message}`); }); ```