npm install kl-boss-iframe-outbound
# 或者
yarn add kl-boss-iframe-outbound
- 初始化
import Outbound from "kl-boss-iframe-outbound"
const phone = Outbound.create()
- call 拨打电话
import Outbound from "kl-boss-iframe-outbound"
const phone = Outbound.create()
phone.call({
phone: '1327279xxx3',
callType: 7
})
- hungUp 挂断电话
import Outbound from "kl-boss-iframe-outbound"
const phone = Outbound.create()
phone.hangUp()
- 通话状态回调监听
import { onMounted, onUnmounted } from 'vue'
import Outbound from "kl-boss-iframe-outbound"
const phone = Outbound.create()
const onMessage = (data: BossOutboundIfameBack) => {
console.log(data)
}
phone.onMessage(onMessage)
onUnmounted(() => {
// 注意销毁监听,防止内存泄漏
phone.offMessage(onMessage)
})