未验证 提交 57349976 编写于 作者: 熊泽源 提交者: Gitee

【OpenHarmony开源贡献者计划2022】update zh-cn/application-dev/device/vibrator-guidelines.md. 修改格式

Signed-off-by: Nzyxionga <zyxionga@isoftstone.com>
上级 89d8b4dc
......@@ -24,36 +24,36 @@
```
"reqPermissions": [
{
"name": "ohos.permission.ACCELEROMETER",
"reason": "",
"usedScene": {
"ability": [
".MainAbility"
],
"when": "inuse"
}
},
{
"name": "ohos.permission.VIBRATE",
"reason": "",
"usedScene": {
"ability": [
".MainAbility"
],
"when": "inuse"
}
},
{
"name": "ohos.permission.ACTIVITY_MOTION",
"reason": "",
"usedScene": {
"ability": [
".MainAbility"
],
"when": "inuse"
}
},
{
"name": "ohos.permission.ACCELEROMETER",
"reason": "",
"usedScene": {
"ability": [
".MainAbility"
],
"when": "inuse"
}
},
{
"name": "ohos.permission.VIBRATE",
"reason": "",
"usedScene": {
"ability": [
".MainAbility"
],
"when": "inuse"
}
},
{
"name": "ohos.permission.ACTIVITY_MOTION",
"reason": "",
"usedScene": {
"ability": [
".MainAbility"
],
"when": "inuse"
}
},
]
```
......@@ -61,12 +61,12 @@
```
import vibrator from "@ohos.vibrator"
vibrator.vibrate(1000).then((error)=>{
if(error){//调用失败,打印error.code和error.message
Console.log("Promise return failed.error.code"+error.code+"error.message"+error.message);
}else{//调用成功,设备开始振动
vibrator.vibrate(1000).then((error) => {
if (error) { //调用失败,打印error.code和error.message
Console.log("Promise return failed.error.code " + error.code + "error.message " + error.message);
} else { //调用成功,设备开始振动
Console.log("Promise returned to indicate a successful vibration.")
};
}
})
```
......@@ -74,12 +74,12 @@
```
import vibrator from "@ohos.vibrator"
vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then((error)=>{
if(error){//调用失败,打印error.code和error.message
Console.log("Promise return failed.error.code"+error.code+"error.message"+error.message);
}else{//调用成功,设备停止振动
vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then((error) => {
if (error) { //调用失败,打印error.code和error.message
Console.log("Promise return failed.error.code " + error.code + "error.message " + error.message);
} else { //调用成功,设备停止振动
Console.log("Promise returned to indicate successful.");
};
}
})
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册