# disConnectBluetooth ^7.6.0

断开蓝牙连接

# 请求参数

Prop Type Default Description
param Object mac: "xxxx"//蓝牙mac地址, 请求参数

# 接口调用示例


this.$bridge
    .disConnectBluetooth(params)
    .then(res => {    
    this.$alert(res)
    })
    .catch(err => {
    this.$toast(err)
    })
1
2
3
4
5
6
7
8
9

# 返回参数

  • 若是蓝牙意外断开,APP通知插件
// 设备状态推送,返回数据格式:
{ 
    messageType: "disConnectBluetooth",
    messageBody: { mac:"xxxx"} 
}

const globalEvent = weex.requireModule('globalEvent')
 
export default {
.....   
created() {
    // 监听设备状态推送
    globalEvent.addEventListener('receiveMessageFromApp', (response) => {
        // 业务逻辑
        let { messageType, messageBody } = response
        if (messageType == 'disConnectBluetooth'){
            console.log(messageBody)
        }
    })
}
.....
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Last Updated: 6/16/2021, 2:02:29 PM