title: Taro.openCard(option)
sidebar_label: openCard
查看微信卡包中的卡券。只有通过 认证 的小程序或文化互动类目的小游戏才能使用。更多文档请参考 微信卡券接口文档。
支持情况:.default}) 
 .default}) 
 .default})
类型
(option: Option) => Promise<TaroGeneral.CallbackResult>
参数
| 参数 | 类型 | 
|---|---|
| option | Option | 
Option
| 参数 | 类型 | 必填 | 说明 | 
|---|---|---|---|
| cardList | RequestInfo[] | 是 | 需要打开的卡券列表 | 
| complete | (res: TaroGeneral.CallbackResult) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | 
| fail | (res: TaroGeneral.CallbackResult) => void | 否 | 接口调用失败的回调函数 | 
| success | (res: TaroGeneral.CallbackResult) => void | 否 | 接口调用成功的回调函数 | 
RequestInfo
需要打开的卡券列表
| 参数 | 类型 | 说明 | 
|---|---|---|
| cardId | string | 卡券 ID | 
| code | string | 由 Taro.addCard 的返回对象中的加密 code 通过解密后得到,解密请参照:code 解码接口 | 
示例代码
Taro.openCard({
cardList: [{
cardId: '',
code: ''
}, {
cardId: '',
code: ''
}],
success: function (res) { }
})
 
                         
                                

