Other

Floating Button

The configuration for the floating button is done through the useWidgetBtn attribute on the chat-component component, which includes two mandatory parameters. The specific configuration is as follows:

  1. pos: 'leftTop' | 'rightTop' | 'leftBottom' | 'rightBottom'; Used to control the relative position of the floating button with respect to the widget. Options include: top-left corner, top-right corner, bottom-left corner, bottom-right corner.

  2. left: '100px'; top: '40px'; Default position of the floating button on the screen.

  3. Parameters are separated by ';', as shown in the example below:

<chat-component useWidgetBtn={'pos:rightBottom;top:800px;left:500px'} />

Add event listeners to the widget

The widget supports event listeners, and when the corresponding events are triggered, the widget will proactively execute the callback functions associated with the listened events. Currently, there are three supported events:

  1. login: Triggered when the user logs in. Callback function does not take any parameters.

  2. logout: Triggered when the user logs out. Callback function does not take any parameters.

  3. unReadCount: Triggered when the number of unread messages changes. Callback function takes the parameter num, which represents the number of unread messages.

Method Name
Description
Parameters
Return Values

window.chatWidgetApi.on

Add event listeners to the widget

type: The type of events above, i.e., "login", "logout", etc. callback: Callback function

N/A

Last updated