# 目录

- [1 版本更新](#1-版本更新)
- [2 使用说明](#2-使用说明)
  - [2.1 sg-chat 集成说明](#21-sg-chat-集成说明)
    - [2.1.1 下载](#211-下载)
    - [2.1.2 使用](#212-使用)
    - [2.1.3 参数说明](#213-参数说明)
    - [2.1.4 事件说明](#214-事件说明)
    - [2.1.5 方法说明](#215-方法说明)

## 1 版本更新

##### 1.0.1 初版发布，数字人虚拟形象组件
##### 1.0.2 解决组件名称写错问题

## 2 使用说明：

### 2.1 sg-vhuman-vue2 集成说明

#### 2.1.1 下载

```
npm install sg-vhuman-vue2
```

#### 2.1.2 使用

```
  import { SgVhumanVue2 } from 'sg-vhuman-vue2'
  import 'sg-vhuman-vue2/sg-vhuman-vue2.css'
```

```
 <sg-vhuman-vue2
      ref="human"
      ice-url="/webrtcApi2/ice"
      offer-url="/webrtcApi2/offer"
      human-url="/webrtcApi2/human"
      background-color="#000000"
    />
```

#### 2.1.3 参数说明

| 名称            | 释义                   | 类型   | 是否必须 |
| :-------------- | :--------------------- | :----- | :------- |
| iceUrl          | 交互式连接建立协议地址 | String | 是       |
| offerUrl        | SDP Offer 提交接口地址 | String | 是       |
| humanUrl        | 对话输入接口地址       | String | 是       |
| backgroundColor | 背景颜色               | String | 否       |

#### 2.1.4 事件

| 名称                  | 说明         |
| :-------------------- | :----------- |
| on-connect-success    | 连接成功事件 |
| on-connect-failed     | 连接失败事件 |
| on-disconnect-success | 关闭成功事件 |
| on-disconnect-failed  | 关闭失败事件 |

#### 2.1.5 方法

| 名称        | 说明     |
| :---------- | :------- |
| sendMessage | 发送消息 |
| connect     | 连接方法 |
| disconnect  | 关闭方法 |
