swan.offError
兼容处理。 解释: 取消监听小程序错误事件。
方法参数
无
示例
在开发者工具中预览效果
扫码体验
请使用百度APP扫码
图片示例
代码示例
// app.jsApp({ onLaunch() { swan.onError(function(errMsg) { console.log(errMsg); swan.showModal({ title: '', content: JSON.stringify(errMsg) }); }); }, // 在App onShow后约3秒取消事件监听(仅做功能示例,开发者可根据业务逻辑选择取消监听时机) onShow() { setTimeout(function() { swan.offError(); swan.showModal({ title: '', content: '此后点击按钮触发报错,将不会触发swan.onError事件.' }); }, 3000); }});
