未验证 提交 e4fba9e4 编写于 作者: N ningning 提交者: Gitee

update zh-cn/application-dev/reference/apis/js-apis-pointer.md.

Signed-off-by: Nningning <3248127340@qq.com>
上级 e63df45e
......@@ -278,9 +278,12 @@ getPointerStyle(windowId: number, callback: AsyncCallback&lt;PointerStyle&gt;):
```js
import window from '@ohos.window';
window.getTopWindow((error, win) => {
win.getWindowProperties((error, properties) => {
let windowId = properties.id;
window.getLastWindow(this.context, (error, win) => {
if (error.code) {
console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error));
return;
}
let windowId = win.getWindowProperties().id;
if (windowId < 0) {
console.log(`Invalid windowId`);
return;
......@@ -292,7 +295,6 @@ window.getTopWindow((error, win) => {
} catch (error) {
console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
});
});
```
......@@ -321,9 +323,12 @@ getPointerStyle(windowId: number): Promise&lt;PointerStyle&gt;
```js
import window from '@ohos.window';
window.getTopWindow((error, win) => {
win.getWindowProperties((error, properties) => {
let windowId = properties.id;
window.getLastWindow(this.context, (error, win) => {
if (error.code) {
console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error));
return;
}
let windowId = win.getWindowProperties().id;
if (windowId < 0) {
console.log(`Invalid windowId`);
return;
......@@ -335,7 +340,6 @@ window.getTopWindow((error, win) => {
} catch (error) {
console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
});
});
```
......@@ -360,9 +364,12 @@ setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCal
```js
import window from '@ohos.window';
window.getTopWindow((error, win) => {
win.getWindowProperties((error, properties) => {
let windowId = properties.id;
window.getLastWindow(this.context, (error, win) => {
if (error.code) {
console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error));
return;
}
let windowId = win.getWindowProperties().id;
if (windowId < 0) {
console.log(`Invalid windowId`);
return;
......@@ -374,7 +381,6 @@ window.getTopWindow((error, win) => {
} catch (error) {
console.log(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
});
});
```
## pointer.setPointerStyle<sup>9+</sup>
......@@ -398,9 +404,12 @@ setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise&lt;void&g
```js
import window from '@ohos.window';
window.getTopWindow((error, win) => {
win.getWindowProperties((error, properties) => {
let windowId = properties.id;
window.getLastWindow(this.context, (error, win) => {
if (error.code) {
console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error));
return;
}
let windowId = win.getWindowProperties().id;
if (windowId < 0) {
console.log(`Invalid windowId`);
return;
......@@ -412,7 +421,6 @@ window.getTopWindow((error, win) => {
} catch (error) {
console.log(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
});
});
```
## PointerStyle<sup>9+</sup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册