1***@qq.com
1***@qq.com
  • 发布:2019-11-17 22:28
  • 更新:2019-12-12 11:19
  • 阅读:5800

[system] 请注意 showToast 与 hideToast 必须配对使用

分类:uni-app
2019-11-17 22:28 负责人:无 分享
已邀请:
1***@163.com

1***@163.com -

//开启适配,如果失败提示设备蓝牙不可用,同时开启蓝牙适配器状态监听。
startConnect: function () {
var that = this;
wx.showLoading({//这个是触发这个事件的时候要弹出来的一个提示
title: '开启蓝牙适配'
});
wx.openBluetoothAdapter({
success: function (res) {
console.log("初始化蓝牙适配器");
console.log(res);
that.getBluetoothAdapterState();
setTimeout(function () {
wx.hideLoading();//2秒后关闭这个提示,所以说showLoading与hideLoading要匹配,及showToast与hideToast 必须配对使用,要检查一下前后的提示框,相对应程序才能知道它在关闭那个提示
}, 2000)
},
fail: function (err) {
console.log(err);
wx.showToast({
title: '蓝牙初始化失败,请检测是否开启蓝牙',
icon: 'none',
duration: 3000
})
}
});

3***@qq.com

3***@qq.com

没有人知道吗?

  • 1***@163.com

    //开启适配,如果失败提示设备蓝牙不可用,同时开启蓝牙适配器状态监听。

    startConnect: function () {

    var that = this;

    wx.showLoading({//这个是触发这个事件的时候要弹出来的一个提示

    title: '开启蓝牙适配'

    });

    wx.openBluetoothAdapter({

    success: function (res) {

    console.log("初始化蓝牙适配器");

    console.log(res);

    that.getBluetoothAdapterState();

    setTimeout(function () {

    wx.hideLoading();//2秒后关闭这个提示,所以说showLoading与hideLoading要匹配,及showToast与hideToast 必须配对使用,要检查一下前后的提示框,相对应程序才能知道它在关闭那个提示

    }, 2000)

    },

    fail: function (err) {

    console.log(err);

    wx.showToast({

    title: '蓝牙初始化失败,请检测是否开启蓝牙',

    icon: 'none',

    duration: 3000

    })

    }

    });

    2019-12-12 11:19

该问题目前已经被锁定, 无法添加新回复