> For the complete documentation index, see [llms.txt](https://polyv.gitbook.io/document/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://polyv.gitbook.io/document/docs/live/harmony/6-hu-dong.md).

# 6-互动

* [1.互动](#1互动)
* [2.互动页](#2互动页)
* [3.回调](#3回调)

#### 1.互动

互动管理器的对外核心类为`PLVInteractManager`，可以通过 SDK 对象的`interactManager`属性对其进行访问。

#### 2.互动页

互动页是一个 Web 组件，其对外核心类为`PLVInteractWeb`，只需要把该组件嵌入到布局中即可完成互动页的集成。

```ts
PLVInteractWeb({
  interactManager: this.interactManager, // 互动管理器
  interactCallback: this.interactCallback, // 互动回调
  controller: this.controller, // web组件控制器
  redpackManager: this.redpackManager // 红包管理器
})
```

详细使用代码可以参考 demo 项目的`PLVLIInteractWebView`类。

#### 3.回调

互动的业务事件消息通过`interactCallback`注册进行监听，包括：

* processWebViewVisibility：web组件可见性回调注册
* processOpenLinkEvent：互动内部打开链接回调注册
* processClickProductEvent：点击商品回调注册

以监听 web组件可见性消息为例，可以通过以下方式进行监听：

```ts
interactCallback.processWebViewVisibility = (show) => {
  // 处理逻辑
  this.viewController.isShow = show
}
```

详细使用代码可以参考 demo 项目的`PLVLIInteractWebView`类。
