提交 af3f9781 编写于 作者: E ester.zhou

Update doc (10313)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 8020447f
# Development Board
# Development Board Usage
## How do I take screenshots on a development board?
......@@ -29,8 +27,8 @@ Applicable to: DevEco Studio 3.0.0.991
1. Create a profile in Previewer.
![en-us_image_0000001361254285](figures/en-us_image_0000001361254285.png)
2. Set the profile parameters as follows:
2. Set the profile parameters as follows:
Device type : default
Resolution: 720\*1280
......
# Device Management Development
## How do I obtain the DPI of a device?
Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9
Import the **@ohos.display** module and call the **getDefaultDisplay** API.
Import the **\@ohos.display** module and call the **getDefaultDisplay** API.
Example:
......@@ -20,5 +18,33 @@ display.getDefaultDisplay((err, data) => {
}
console.info('Test Succeeded in obtaining the default display object. Data:' + JSON.stringify(data));
console.info('Test densityDPI:' + JSON.stringify(data.densityDPI));
});https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-device-info.md)
});
```
## How do I obtain the type of the device where the application is running?
Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9
Import the **\@ohos.deviceInfo** module and call the **deviceInfo.deviceType** API.
For details, see [Device Information](../reference/apis/js-apis-device-info.md).
## How do I obtain the system version of a device?
Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
Use the **osFullName** attribute of the [deviceInfo](../reference/apis/js-apis-device-info.md) object.
## How do I obtain the UDID of an OpenHarmony device?
Applicable to: OpenHarmony SDK3.0, stage model of API version 9
- To obtain the UDID of the connected device, run the **hdc shell bm get --udid** command.
- For details about how to obtain the UDID from code, see [udid](../reference/apis/js-apis-device-info.md).
## How do I develop a shortcut key function?
Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9
To develop a shortcut key function, use the APIs in [Input Consumer](../reference/apis/js-apis-inputconsumer.md).
# ArkUI (JavaScript) Development
## How do I convert the fields in an XML file into JavaScript objects?
Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9
......@@ -13,38 +11,37 @@ Example:
```
import convertxml from '@ohos.convertxml';
// Code snippet
xml =
// XML strings
let xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
let conv = new convertxml.ConvertXML();
let conv = new convertxml.ConvertXML();
// Options for conversion. For details, see the reference document.
let options = {trim : false, declarationKey:"_declaration",
instructionKey : "_instruction", attributesKey : "_attributes",
textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
nameKey : "_name", elementsKey : "_elements"}
let result:any = conv.convert(xml, options) // Convert fields in the XML file into JavaScript objects.
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
}
let result: any = conv.convert(xml, options) // Convert fields in the XML file into JavaScript objects.
console.log('Test: ' + JSON.stringify(result))
console.log('Test: ' + result._declaration._attributes.version) // version field in XML file
console.log('Test: ' + result._elements[0]._elements[0]._elements[0]._text) // title field in XML file
console.log('Test: ' + result._declaration._attributes.version) // version field in the XML file
console.log('Test: ' + result._elements[0]._elements[0]._elements[0]._text) // title field in the XML file
```
Reference: [XML-to-JavaScript Conversion](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-convertxml.md)
## What are the differences between JavaScript, TypeScript, and eTS?
Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9
- JavaScript: a lightweight, weakly-typed programming language, most commonly known as the scripting language for web pages.
- TypeScript: a superset of JavaScript, with additions of static typing and more object-oriented APIs, enums, etc.
- eTS: a superset of TypeScript and the programming language for OpenHarmony ArkUI development, which powers UI development through a declarative development paradigm.
For details, see [XML-to-JavaScript Conversion](../reference/apis/js-apis-convertxml.md).
## How do I convert the time to the HHMMSS format?
......@@ -93,4 +90,5 @@ export default class DateTimeUtil{
return `${this.fill(hours)}${this.fill(minutes)}${this.fill(seconds)}`
}
}
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册