欢迎光临
我们一直在努力

九八云百度小程序教程:swan.offAppHide

  • swan.offAppHide
    • 方法参数
    • 示例
      • 图片示例
      • 代码示例

    swan.offAppHide

    基础库 3.60.2 开始支持,低版本需做兼容处理。

    解释:取消监听小程序切后台事件。

    方法参数

    示例

    在开发者工具中打开

    在开发者工具中打开

    在 WEB IDE 中打开

    扫码体验

    代码示例

    请使用百度APP扫码

    图片示例

    代码示例

    • JS
    
     
    1. App({
    2. onLaunch() {
    3. swan.onAppHide(function(res) {
    4. console.log(res);
    5. swan.showModal({
    6. title: 'res',
    7. content: JSON.stringify(res),
    8. showCancel: false
    9. });
    10. });
    11. // 在App onLaunch后约3秒取消事件监听(仅做功能示例,开发者可根据业务逻辑选择取消监听时机)
    12. setTimeout(() => {
    13. swan.offAppHide();
    14. swan.showModal({
    15. title: '',
    16. content: '此后将不再触发swan.onAppHide回调'
    17. showCancel: false
    18. });
    19. }, 3000)
    20. }
    21. });

    赞(0) 打赏
    未经允许不得转载:九八云安全 » 九八云百度小程序教程:swan.offAppHide

    评论 抢沙发