# 添加到我的小程序

# qq.applyAddToMyApps

# qq.applyAddToMyApps(Object object)

申请用户将本小程序添加到下拉页面中“我的小程序”当中,手Q8.9.13及以上版本支持

QQ mac版本:支持

QQ windows版本:支持

# 参数

# Object object
属性 类型 默认值 必填 说明
success function 接口调用成功的回调函数
fail function 接口调用失败的回调函数
complete function 接口调用结束的回调函数(调用成功、失败都会执行)
# object.success 回调函数

参数

Object res

属性 类型 说明
confirm boolean true代表用户选择了同意
cancel boolean true代表用户选择了不同意

# 示例代码

qq.applyAddToMyApps({
  success(res) {
    if (res.confirm) {
      // 用户同意添加
    }
    if (res.cancel) {
      // 用户不同意添加
    }
    // 原则上,confirm和cancel是互斥的
  }
})
1
2
3
4
5
6
7
8
9
10
11

# qq.isAddedToMyApps

# qq.isAddedToMyApps(Object object)

查询用户是否已经将本小程序添加到下拉页面中“我的小程序”当中,手Q8.9.13及以上版本支持,建议使用qq.applyAddToMyApps之前先调用qq.isAddedToMyApps来作前置判断

QQ mac版本:支持

QQ windows版本:支持

# 参数

# Object object
属性 类型 默认值 必填 说明
success function 接口调用成功的回调函数
fail function 接口调用失败的回调函数
complete function 接口调用结束的回调函数(调用成功、失败都会执行)
# object.success 回调函数

参数

Object res

属性 类型 说明
isAdded boolean true代表用户已经添加,false则还没添加

# 示例代码

qq.isAddedToMyApps({
  success(res) {
    if (res.isAdded) {
      // 用户已经添加
    } else {
      // 用户还未添加
    }
  }
})
1
2
3
4
5
6
7
8
9