所有通过wx对象调用的接口的基础请求参数 见:https://mp.weixin.qq.com/wiki?action=doc&id=mp1421141115&t=0.08966560295638093#7

interface ScanQRCodeConfig {
    needResult?: number;
    scanType?: string[];
    cancel?(): void;
    complete?(res?: any): void;
    fail?(error?: any): void;
    success?(res: {
        resultStr: string;
    }): void;
}

层级 (查看完整内容)

属性

needResult?: number

默认为0,扫描结果由微信处理,1则直接返回扫描结果,

scanType?: string[]

["qrCode","barCode"], 可以指定扫二维码还是一维码,默认二者都有

方法

  • 用户点击取消时的回调函数,仅部分有用户取消操作的api才会用到

    返回 void

  • 接口调用完成时执行的回调函数,无论成功或失败都会执行

    参数

    • 可选res: any

    返回 void

  • 接口调用失败时执行的回调函数

    参数

    • 可选error: any

    返回 void

  • resultStr 是当 needResult 为 1 时,扫码返回的结果

    参数

    • res: {
          resultStr: string;
      }
      • resultStr: string

    返回 void