diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-mouse-key.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-mouse-key.md index d2311944b0908b312b12f43eba837fde2a2780b0..9706db4024e2a5b4f93adf11fb476e19f03d339f 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-mouse-key.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-mouse-key.md @@ -15,7 +15,7 @@ | 名称 | 支持冒泡 | 描述 | | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ | -| onHover(event: (isHover?: boolean) => void) | 否 | 鼠标进入或退出组件时触发该回调。
isHover:表示鼠标是否悬浮在组件上,鼠标进入时为true, 退出时为false。 | +| onHover(event: (isHover?: boolean, event10+?: HoverEvent) => void) | 是 | 鼠标进入或退出组件时触发该回调。
isHover:表示鼠标是否悬浮在组件上,鼠标进入时为true, 退出时为false。
event:设置阻塞事件冒泡属性。 | | onMouse(event: (event?: MouseEvent) => void) | 是 | 当前组件被鼠标按键点击时或者鼠标在组件上悬浮移动时,触发该回调,event返回值包含触发事件时的时间戳、鼠标按键、动作、鼠标位置在整个屏幕上的坐标和相对于当前组件的坐标。 | @@ -34,6 +34,12 @@ | target8+ | [EventTarget](ts-universal-events-click.md#eventtarget8对象说明) | 触发事件的元素对象显示区域。 | | source8+ | [SourceType](ts-gesture-settings.md#sourcetype枚举说明) | 事件输入设备。 | +## HoverEvent10+对象说明 + +| 名称 | 属性类型 | 描述 | +| --------- | ------------------------------- | -------------------- | +| stopPropagation | () => void | 阻塞事件冒泡。 | + ## 示例 ```ts @@ -52,7 +58,7 @@ struct MouseEventExample { Button(this.hoverText) .width(180).height(80) .backgroundColor(this.color) - .onHover((isHover: boolean) => { + .onHover((isHover: boolean, event: HoverEvent) => { // 通过onHover事件动态修改按钮在是否有鼠标悬浮时的文本内容与背景颜色 if (isHover) { this.hoverText = 'hover'; @@ -117,4 +123,4 @@ struct MouseEventExample { 鼠标点击时: -![mouse1](figures/mouse1.png) \ No newline at end of file +![mouse1](figures/mouse1.png)