- swan.queryBookshelf
- 方法参数
- object 参数说明
- success 返回参数说明
- list 参数说明
- 代码示例
- 方法参数
swan.queryBookshelf
基础库 3.190.1 开始支持,低版本需做兼容处理。
解释:查询宿主书架的相关内容(需宿主支持书架入口)。
Web 态说明:Web 态不支持查询宿主书架的相关内容,调用会执行失败回调。
方法参数
Object object
object 参数说明
| 参数名 | 类型 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
| contentIds | Array.<string> | 是 | – | 要查询内容的 id,支持传多个,最多 100 条;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) |
| success | Function | 否 | – | 接口调用成功的回调函数 |
| fail | Function | 否 | – | 接口调用失败的回调函数 |
| complete | Function | 否 | – | 接口调用结束的回调函数(调用成功、失败都会执行) |
success 返回参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| list | Array.<object> | 查询的内容结果列表 |
list 参数说明
| 参数 | 类型 | 说明 |
|---|---|---|
| contentId | String | 内容的唯一标识 |
| status | Number | 状态:值为 0 时是不存在,为 1 时是存在 |
代码示例
- 在 js 文件中
swan.queryBookshelf({contentIds: ['test1', 'test2'],success(res) {swan.showModal({title: 'success',content: JSON.stringify(res)});},fail(err) {swan.showModal({title: 'fail',content: JSON.stringify(err)});}})


![晴川云Minecraft Wiki教程:初始资源[ ],晴川云](https://baike.qcidc.com/wp-content/uploads/2025/09/20250919082218446-u_2882861311_2720249173fm_253fmt_autoapp_120f_JPEG.jpeg)







暂无评论内容