├── .gitignore ├── README.md ├── component.js ├── index.js ├── package.json └── page.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | test/unit/coverage 8 | test/e2e/reports 9 | selenium-debug.log 10 | 11 | # Editor directories and files 12 | .idea 13 | *.suo 14 | *.ntvs* 15 | *.njsproj 16 | *.sln 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # weChatMiniPrograms 2 | 微信小程序api汇总 3 | 在webStorm中可以做到代码提示,快速查看文档功能 4 | 5 | #安装方法 6 | npm install wechat-mini-programs-apis 7 | 8 | 目前已更新到小程序基础库1.6.0 9 | 10 | 小程序的组件虽然api模仿着vue来的,但是根本就没法用,刚刚试了一下,整个slot,要把人给整疯了 11 | 1.6.0的版本不推荐使用组件功能 12 | -------------------------------------------------------------------------------- /component.js: -------------------------------------------------------------------------------- 1 | 2 | class Component { 3 | constructor ({ 4 | options = {}, 5 | properties = {}, 6 | methods = {}, 7 | data = {}, 8 | created = function () {}, 9 | attached = function () {}, 10 | ready = function () {}, 11 | moved = function () {}, 12 | detached = function () {}, 13 | behaviors = []}) { 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by jayazhang on 2017-8-21. 3 | */ 4 | 5 | import './page' 6 | 7 | 8 | class wx { 9 | /* https://mp.weixin.qq.com/debug/wxadoc/dev/api/checkIsSoterEnrolledInDevice.html */ 10 | static checkIsSoterEnrolledInDevice ({ checkAuthMode, success, fail, complete }) { 11 | 12 | } 13 | // https://mp.weixin.qq.com/debug/wxadoc/dev/api/getRecorderManager.html 14 | static getRecorderManager () {} 15 | 16 | // https://mp.weixin.qq.com/debug/wxadoc/dev/api/createInnerAudioContext.html 17 | static createInnerAudioContext () {} 18 | 19 | /** 20 | * 21 | * @param {String} url (必须)开发者服务器接口地址 22 | * @param {String | Object} [data] (选填)请求的参数 23 | * @param {Object} [header] (选填)设置请求的 header , header 中不能设置 Referer 24 | * @param {String} [method] (选填)默认为 GET,有效值:OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT 25 | * @param {String} [dataType] (选填)默认为 json。如果设置了 dataType 为 json,则会尝试对响应的数据做一次 JSON.parse 26 | * @param {function (data, statusCode, head)} [success] 27 | * (选填)收到开发者服务成功返回的回调函数,res = {data: '开发者服务器返回的内容'} 28 | * @param {Function} [fail] (选填)接口调用失败的回调函数 29 | * @param {Function} [complete] (选填)接口调用结束的回调函数(调用成功、失败都会执行) 30 | * description https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-request.html 31 | */ 32 | static request ({ url, data, header, method, dataType, success, fail, complete }) {} 33 | 34 | /** 35 | * 将本地资源上传到开发者服务器 36 | * @param url 37 | * @param filePath 38 | * @param name 39 | * @param header 40 | * @param formData 41 | * @param success 42 | * @param fail 43 | * @param complete 44 | * 文档地址 45 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-file.html 46 | */ 47 | static uploadFile ({url, filePath, name, header, formData, success, fail, complete}) {} 48 | 49 | 50 | 51 | /** 52 | * 下载文件资源到本地 53 | * @param url 54 | * @param header 55 | * @param success 56 | * @param fail 57 | * @param complete 58 | * 文档地址 59 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-file.html#wxdownloadfileobject 60 | */ 61 | static downloadFile ({url, header, success, fail, complete}) {} 62 | 63 | /** 64 | * 创建一个 WebSocket 连接 65 | * @param url 66 | * @param data 67 | * @param header 68 | * @param method 69 | * @param protocols 70 | * @param success 71 | * @param fail 72 | * @param complete 73 | * 文档地址 74 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-socket.html#wxconnectsocketobject 75 | */ 76 | static connectSocket ({url, data, header, method, protocols, success, fail, complete}) {} 77 | 78 | /** 79 | * 监听WebSocket连接打开事件 80 | * @param cb 81 | * 文档地址 82 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-socket.html#wxonsocketopencallback 83 | */ 84 | static onSocketOpen (cb) {} 85 | 86 | /** 87 | * 监听WebSocket错误。 88 | * @param cb 89 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-socket.html#wxclosesocket 90 | */ 91 | static onSocketError (cb) {} 92 | 93 | /** 94 | * 通过 WebSocket 连接发送数据 95 | * @param data 96 | * @param success 97 | * @param fail 98 | * @param complete 99 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-socket.html#wxsendsocketmessageobject 100 | */ 101 | static sendSocketMessage ({ data, success, fail, complete }) {} 102 | 103 | /** 104 | * 监听WebSocket接受到服务器的消息事件 105 | * @param cb 106 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-socket.html#wxonsocketmessagecallback 107 | */ 108 | static onSocketMessage (cb) {} 109 | 110 | /** 111 | * 关闭WebSocket连接 112 | * @param code 113 | * @param reason 114 | * @param success 115 | * @param fail 116 | * @param complete 117 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-socket.html#wxclosesocket 118 | */ 119 | static closeSocket ({ code, reason, success, fail, complete }) {} 120 | 121 | /** 122 | * 监听WebSocket关闭。 123 | * @param cb 124 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-socket.html#wxonsocketclosecallback 125 | */ 126 | static onSocketClose (cb) {} 127 | 128 | /** 129 | * 从本地相册选择图片或使用相机拍照。 130 | * @param count 131 | * @param sizeType 132 | * @param sourceType 133 | * @param success 134 | * @param fail 135 | * @param complete 136 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-picture.html#wxchooseimageobject 137 | */ 138 | static chooseImage ({ count, sizeType, sourceType, success, fail, complete }) {} 139 | 140 | /** 141 | * 预览图片。 142 | * @param current 143 | * @param urls 144 | * @param success 145 | * @param fail 146 | * @param complete 147 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-picture.html#wxpreviewimageobject 148 | */ 149 | static previewImage ({ current, urls, success, fail, complete }) {} 150 | 151 | /** 152 | * 获取图片信息 153 | * @param src 154 | * @param success 155 | * @param fail 156 | * @param complete 157 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-picture.html#wxgetimageinfoobject 158 | */ 159 | static getImageInfo ({ src, success, fail, complete }) {} 160 | 161 | /** 162 | * 保存图片到系统相册,需要用户授权(scope.writePhotosAlbum) 163 | * @param filePath 164 | * @param success 165 | * @param fail 166 | * @param complete 167 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-picture.html#wxsaveimagetophotosalbumobject 168 | */ 169 | static saveImageToPhotosAlbum ({ filePath, success, fail, complete }) {} 170 | 171 | /** 172 | * 开始录音。当主动调用wx.stopRecord,或者录音超过1分钟时自动结束录音,返回录音文件的临时文件路径。当用户离开小程序时,此接口无法调用。 173 | * @param success 174 | * @param fail 175 | * @param complete 176 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-record.html#wxstartrecordobject 177 | */ 178 | static startRecord ({ success, fail, complete }) {} 179 | 180 | /** 181 | * 主动调用停止录音。 182 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-record.html#wxstoprecord 183 | */ 184 | static stopRecord () {} 185 | 186 | /** 187 | * 开始播放语音,同时只允许一个语音文件正在播放,如果前一个语音文件还没播放完,将中断前一个语音播放。 188 | * @param filePath 189 | * @param success 190 | * @param fail 191 | * @param complete 192 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-voice.html#wxplayvoiceobject 193 | */ 194 | static playVoice ({ filePath, success, fail, complete }) {} 195 | 196 | /** 197 | * 暂停正在播放的语音。再次调用wx.playVoice播放同一个文件时,会从暂停处开始播放。如果想从头开始播放,需要先调用 wx.stopVoice。 198 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-voice.html#wxpausevoice 199 | */ 200 | static pauseVoice () {} 201 | 202 | /** 203 | * 结束播放语音。 204 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-voice.html#wxstopvoice 205 | */ 206 | static stopVoice () {} 207 | 208 | /** 209 | * 获取后台音乐播放状态 210 | * @param success 211 | * @param fail 212 | * @param complete 213 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-background-audio.html#wxgetbackgroundaudioplayerstateobject 214 | */ 215 | static getBackgroundAudioPlayerState ({ success, fail, complete }) {} 216 | 217 | /** 218 | * 使用后台播放器播放音乐 219 | * @param dataUrl 220 | * @param title 221 | * @param coverImgUrl 222 | * @param success 223 | * @param fail 224 | * @param complete 225 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-background-audio.html#wxplaybackgroundaudioobject 226 | */ 227 | static playBackgroundAudio ({ dataUrl, title, coverImgUrl, success, fail, complete }) {} 228 | 229 | /** 230 | * 暂停播放音乐 231 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-background-audio.html#wxpausebackgroundaudio 232 | */ 233 | static pauseBackgroundAudio () {} 234 | 235 | /** 236 | * 控制音乐播放进度。 237 | * @param position 238 | * @param success 239 | * @param fail 240 | * @param complete 241 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-background-audio.html#wxseekbackgroundaudioobject 242 | */ 243 | static seekBackgroundAudio ({ position, success, fail, complete }) {} 244 | 245 | /** 246 | * 停止播放音乐。 247 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-background-audio.html#wxstopbackgroundaudio 248 | */ 249 | static stopBackgroundAudio () {} 250 | 251 | /** 252 | * 监听音乐播放。 253 | * @param cb 254 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-background-audio.html#wxonbackgroundaudioplaycallback 255 | */ 256 | static onBackgroundAudioPlay (cb) {} 257 | 258 | /** 259 | * 监听音乐暂停。 260 | * @param cb 261 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-background-audio.html#wxonbackgroundaudiopausecallback 262 | */ 263 | static onBackgroundAudioPause (cb) {} 264 | 265 | 266 | /** 267 | * 监听音乐停止。 268 | * @param cb 269 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-background-audio.html#wxonbackgroundaudiostopcallback 270 | */ 271 | static onBackgroundAudioStop (cb) {} 272 | 273 | /** 274 | * 获取全局唯一的背景音频管理器 backgroundAudioManager 275 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/getBackgroundAudioManager.html 276 | */ 277 | static getBackgroundAudioManager () {} 278 | 279 | /** 280 | * 创建并返回 audio 上下文 audioContext 对象 281 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-audio.html 282 | */ 283 | static createAudioContext (audioId) {} 284 | 285 | /** 286 | * 拍摄视频或从手机相册中选视频,返回视频的临时文件路径。 287 | * @param sourceType 288 | * @param maxDuration 289 | * @param camera 290 | * @param success 291 | * @param fail 292 | * @param complete 293 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-video.html#wxchoosevideoobject 294 | */ 295 | static chooseVideo ({ sourceType, maxDuration, camera, success, fail, complete }) {} 296 | 297 | /** 298 | * 保存视频到系统相册,需要用户授权(scope.writePhotosAlbum),详见 用户授权 299 | * @param filePath 300 | * @param success 301 | * @param fail 302 | * @param complete 303 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/media-video.html#wxsavevideotophotosalbumobject 304 | */ 305 | static saveVideoToPhotosAlbum ({ filePath, success, fail, complete}) {} 306 | 307 | /** 308 | * 创建并返回 video 上下文 videoContext 对象 309 | * @param videoId 310 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-video.html#wxcreatevideocontextvideoid 311 | */ 312 | static createVideoContext (videoId) {} 313 | 314 | /** 315 | * 保存文件到本地。 316 | * @param tempFilePath 317 | * @param success 318 | * @param fail 319 | * @param coomplete 320 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/file.html#wxsavefileobject 321 | */ 322 | static saveFile ({ tempFilePath, success, fail, coomplete}) {} 323 | 324 | /** 325 | * 获取文件信息 326 | * @param filePath 327 | * @param digestAlgorithm 328 | * @param success 329 | * @param fail 330 | * @param complete 331 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/getFileInfo.html 332 | */ 333 | static getFileInfo ({ filePath, digestAlgorithm, success, fail, complete }) {} 334 | 335 | /** 336 | * 获取本地已保存的文件列表 337 | * @param success 338 | * @param fail 339 | * @param complete 340 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/file.html#wxgetsavedfilelistobject 341 | */ 342 | static getSavedFileList ({ success, fail, complete }) {} 343 | 344 | /** 345 | * 获取本地文件的文件信息。此接口只能用于获取已保存到本地的文件,若需要获取临时文件信息,请使用 wx.getFileInfo 接口。 346 | * @param filePath 347 | * @param success 348 | * @param fail 349 | * @param complete 350 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/file.html#wxgetsavedfileinfoobject 351 | */ 352 | static getSavedFileInfo ({ filePath, success, fail, complete }) {} 353 | 354 | /** 355 | * 删除本地存储的文件 356 | * @param filePath 357 | * @param success 358 | * @param fail 359 | * @param complete 360 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/file.html#wxremovesavedfileobject 361 | */ 362 | static removeSavedFile ({ filePath, success, fail, complete }) {} 363 | 364 | /** 365 | * 新开页面打开文档,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx 366 | * @param filePath 367 | * @param fileType 368 | * @param success 369 | * @param fail 370 | * @param complete 371 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/file.html#wxopendocumentobject 372 | */ 373 | static openDocument ({ filePath, fileType, success, fail, complete }) {} 374 | 375 | /** 376 | * 将数据存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个异步接口。 377 | * @param key 378 | * @param data 379 | * @param success 380 | * @param fail 381 | * @param complete 382 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/data.html#wxsetstorageobject 383 | */ 384 | static setStorage ({ key, data, success, fail, complete }) {} 385 | 386 | /** 387 | * 将 data 存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个同步接口。 388 | * @param key 389 | * @param data 390 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/data.html#wxsetstoragesynckeydata 391 | */ 392 | static setStorageSync (key, data) {} 393 | 394 | /** 395 | * 从本地缓存中异步获取指定 key 对应的内容。 396 | * @param key 397 | * @param success 398 | * @param fail 399 | * @param complete 400 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/data.html#wxgetstorageobject 401 | */ 402 | static getStorage ({ key, success, fail, complete }) {} 403 | 404 | /** 405 | * 从本地缓存中同步获取指定 key 对应的内容。 406 | * @param key 407 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/data.html#wxgetstoragesynckey 408 | */ 409 | static getStorageSync (key) {} 410 | 411 | /** 412 | * 异步获取当前storage的相关信息 413 | * @param success 414 | * @param fail 415 | * @param complete 416 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/data.html#wxgetstorageinfoobject 417 | */ 418 | static getStorageInfo ({ success, fail, complete }) {} 419 | 420 | /** 421 | * 同步获取当前storage的相关信息 422 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/data.html#wxgetstorageinfosync 423 | */ 424 | static getStorageInfoSync () {} 425 | 426 | /** 427 | * 从本地缓存中异步移除指定 key 。 428 | * @param key 429 | * @param success 430 | * @param fail 431 | * @param complete 432 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/data.html#wxremovestorageobject 433 | */ 434 | static removeStorage ({ key, success, fail, complete }) {} 435 | 436 | /** 437 | * 从本地缓存中同步移除指定 key 。 438 | * @param key 439 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/data.html#wxremovestoragesynckey 440 | */ 441 | static removeStorageSync (key) {} 442 | 443 | /** 444 | * 清理本地数据缓存。 445 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/data.html#wxclearstorage 446 | */ 447 | static clearStorage () {} 448 | 449 | /** 450 | * 同步清理本地数据缓存 451 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/data.html#wxclearstoragesync 452 | */ 453 | static clearStorageSync () {} 454 | 455 | /** 456 | * 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用;当用户点击“显示在聊天顶部”时,此接口可继续调用。 457 | * @param type 458 | * @param success 459 | * @param fail 460 | * @param complete 461 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/location.html#wxgetlocationobject 462 | */ 463 | static getLocation ({ type, success, fail, complete }) {} 464 | 465 | /** 466 | * 打开地图选择位置 467 | * @param success 468 | * @param cancel 469 | * @param fail 470 | * @param complete 471 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/location.html#wxchooselocationobject 472 | */ 473 | static chooseLocation ({ success, cancel, fail, complete }) {} 474 | 475 | /** 476 | * 使用微信内置地图查看位置 477 | * @param latitude 478 | * @param longitude 479 | * @param scale 480 | * @param name 481 | * @param address 482 | * @param success 483 | * @param fail 484 | * @param complete 485 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/location.html#wxopenlocationobject 486 | */ 487 | static openLocation ({ latitude, longitude, scale, name, address, success, fail, complete }) {} 488 | 489 | /** 490 | * 创建并返回 map 上下文 mapContext 对象 491 | * @param mapId 492 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-map.html#wxcreatemapcontextmapid 493 | */ 494 | static createMapContext (mapId) {} 495 | 496 | /** 497 | * 获取系统信息。 498 | * @param success 499 | * @param fail 500 | * @param complete 501 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/systeminfo.html#wxgetsysteminfoobject 502 | */ 503 | static getSystemInfo ({ success, fail, complete }) {} 504 | 505 | /** 506 | * 获取系统信息同步接口 507 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/systeminfo.html#wxgetsysteminfosync 508 | */ 509 | static getSystemInfoSync () {} 510 | 511 | /** 512 | * 判断小程序的API,回调,参数,组件等是否在当前版本可用。 513 | * @param string 514 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-caniuse.html 515 | */ 516 | static canIUse (string) {} 517 | 518 | /** 519 | * 获取网络类型。 520 | * @param success 521 | * @param fail 522 | * @param complete 523 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/device.html#wxgetnetworktypeobject 524 | */ 525 | static getNetworkType ({ success, fail, complete }) {} 526 | 527 | /** 528 | * 监听网络状态变化 529 | * @param cb 530 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/device.html#wxonnetworkstatuschangecallback 531 | */ 532 | static onNetworkStatusChange (cb) {} 533 | 534 | /** 535 | * 监听加速度数据,频率:5次/秒,接口调用后会自动开始监听,可使用 wx.stopAccelerometer 停止监听。 536 | * @param cb 537 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/accelerometer.html#wxonaccelerometerchangecallback 538 | */ 539 | static onAccelerometerChange (cb) {} 540 | 541 | /** 542 | * 开始监听加速度数据 543 | * @param success 544 | * @param fail 545 | * @param complete 546 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/accelerometer.html#wxstartaccelerometerobject 547 | */ 548 | static startAccelerometer ({ success, fail, complete }) {} 549 | 550 | /** 551 | * 停止监听加速度数据。 552 | * @param success 553 | * @param fail 554 | * @param complete 555 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/accelerometer.html#wxstopaccelerometerobject 556 | */ 557 | static stopAccelerometer ({ success, fail, complete }) {} 558 | 559 | /** 560 | * 监听罗盘数据,频率:5次/秒,接口调用后会自动开始监听,可使用wx.stopCompass停止监听。 561 | * @param cb 562 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/compass.html#wxoncompasschangecallback 563 | */ 564 | static onCompassChange (cb) {} 565 | 566 | /** 567 | * 开始监听罗盘数据。 568 | * @param success 569 | * @param fail 570 | * @param complete 571 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/compass.html#wxstartcompassobject 572 | */ 573 | static startCompass ({ success, fail, complete }) {} 574 | 575 | /** 576 | * 停止监听罗盘数据。 577 | * @param success 578 | * @param fail 579 | * @param complete 580 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/compass.html#wxstopcompassobject 581 | */ 582 | static stopCompass ({ success, fail, complete }) {} 583 | 584 | /** 585 | * 打电话 586 | * @param phoneNumber 587 | * @param success 588 | * @param fail 589 | * @param complete 590 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/phonecall.html#wxmakephonecallobject 591 | */ 592 | static makePhoneCall ({ phoneNumber, success, fail, complete }) {} 593 | 594 | /** 595 | * 调起客户端扫码界面,扫码成功后返回对应的结果 596 | * @param onlyFromCamera 597 | * @param success 598 | * @param fail 599 | * @param complete 600 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/scancode.html#wxscancodeobject 601 | */ 602 | static scanCode ({ onlyFromCamera, success, fail, complete }) {} 603 | 604 | /** 605 | * 设置系统剪贴板的内容 606 | * @param data 607 | * @param success 608 | * @param fail 609 | * @param complete 610 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/clipboard.html#wxsetclipboarddataobject 611 | */ 612 | static setClipboardData ({ data, success, fail, complete }) {} 613 | 614 | /** 615 | * 获取系统剪贴板内容 616 | * @param success 617 | * @param fail 618 | * @param complete 619 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/clipboard.html#wxgetclipboarddataobject 620 | */ 621 | static getClipboardData ({ success, fail, complete }) {} 622 | 623 | /** 624 | * 初始化蓝牙适配器 625 | * @param success 626 | * @param fail 627 | * @param complete 628 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxopenbluetoothadapterobject 629 | */ 630 | static openBluetoothAdapter ({ success, fail, complete }) {} 631 | 632 | /** 633 | * 关闭蓝牙模块。调用该方法将断开所有已建立的链接并释放系统资源 634 | * @param success 635 | * @param fail 636 | * @param complete 637 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxclosebluetoothadapterobject 638 | */ 639 | static closeBluetoothAdapter ({ success, fail, complete }) {} 640 | 641 | /** 642 | * 获取本机蓝牙适配器状态 643 | * @param success 644 | * @param fail 645 | * @param complete 646 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxgetbluetoothadapterstateobject 647 | */ 648 | static getBluetoothAdapterState ({ success, fail, complete }) {} 649 | 650 | /** 651 | * 监听蓝牙适配器状态变化事件 652 | * @param cb 653 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxonbluetoothadapterstatechangecallback 654 | */ 655 | static onBluetoothAdapterStateChange (cb) {} 656 | 657 | /** 658 | * 开始搜寻附近的蓝牙外围设备。注意,该操作比较耗费系统资源,请在搜索并连接到设备后调用 stop 方法停止搜索。 659 | * @param services 660 | * @param allowDuplicatesKey 661 | * @param interval 662 | * @param success 663 | * @param fail 664 | * @param complete 665 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxstartbluetoothdevicesdiscoveryobject 666 | */ 667 | static startBluetoothDevicesDiscovery ({services, allowDuplicatesKey, interval, success, fail, complete}) {} 668 | 669 | /** 670 | * 停止搜寻附近的蓝牙外围设备。请在确保找到需要连接的设备后调用该方法停止搜索。 671 | * @param object 672 | * @param fail 673 | * @param complete 674 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxstopbluetoothdevicesdiscoveryobject 675 | */ 676 | static stopBluetoothDevicesDiscovery ({ object, fail, complete}) {} 677 | 678 | /** 679 | * 获取所有已发现的蓝牙设备,包括已经和本机处于连接状态的设备 680 | * @param object 681 | * @param fail 682 | * @param complete 683 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxgetbluetoothdevicesobject 684 | */ 685 | static getBluetoothDevices ({ object, fail, complete }) {} 686 | 687 | /** 688 | * 根据 uuid 获取处于已连接状态的设备 689 | * @param services 690 | * @param success 691 | * @param fail 692 | * @param complete 693 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxonbluetoothdevicefoundcallback 694 | */ 695 | static getConnectedBluetoothDevices ({services, success, fail, complete}) {} 696 | 697 | 698 | /** 699 | * 连接低功耗蓝牙设备 700 | * @param deviceId 701 | * @param success 702 | * @param fail 703 | * @param complete 704 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxcreatebleconnectionobject 705 | */ 706 | static createBLEConnection ({ deviceId, success, fail, complete }) {} 707 | 708 | /** 709 | * 断开与低功耗蓝牙设备的连接 710 | * @param deviceId 711 | * @param success 712 | * @param fail 713 | * @param complete 714 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxclosebleconnectionobject 715 | */ 716 | static closeBLEConnection ({ deviceId, success, fail, complete }) {} 717 | 718 | /** 719 | * 获取蓝牙设备所有 service(服务) 720 | * @param deviceId 721 | * @param success 722 | * @param fail 723 | * @param complete 724 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxgetbledeviceservicesobject 725 | */ 726 | static getBLEDeviceServices ({ deviceId, success, fail, complete }) {} 727 | 728 | /** 729 | * 获取蓝牙设备所有 characteristic(特征值) 730 | * @param deviceId 731 | * @param serviceId 732 | * @param success 733 | * @param fail 734 | * @param complete 735 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxgetbledevicecharacteristicsobject 736 | */ 737 | static getBLEDeviceCharacteristics ({ deviceId, serviceId, success, fail, complete }) {} 738 | 739 | /** 740 | * 读取低功耗蓝牙设备的特征值的二进制数据值。注意:必须设备的特征值支持read才可以成功调用,具体参照 characteristic 的 properties 属性 741 | * @param deviceId 742 | * @param serviceId 743 | * @param characteristicId 744 | * @param success 745 | * @param fail 746 | * @param complete 747 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxreadblecharacteristicvalueobject 748 | */ 749 | static readBLECharacteristicValue ({ deviceId, serviceId, characteristicId, success, fail, complete }) {} 750 | 751 | /** 752 | * 向低功耗蓝牙设备特征值中写入二进制数据。注意:必须设备的特征值支持write才可以成功调用,具体参照 characteristic 的 properties 属性 753 | * tips: 并行调用多次读写接口存在读写失败的可能性 754 | * @param deviceId 755 | * @param serviceId 756 | * @param characteristicId 757 | * @param value 758 | * @param success 759 | * @param fail 760 | * @param complete 761 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxwriteblecharacteristicvalueobject 762 | */ 763 | static writeBLECharacteristicValue ({ deviceId, serviceId, characteristicId, value, success, fail, complete }) {} 764 | 765 | /** 766 | * 启用低功耗蓝牙设备特征值变化时的 notify 功能。注意:必须设备的特征值支持notify才可以成功调用,具体参照 characteristic 的 properties 属性 767 | * 另外,必须先启用notify才能监听到设备 characteristicValueChange 事件 768 | * @param deviceId 769 | * @param serviceId 770 | * @param characteristicId 771 | * @param state 772 | * @param success 773 | * @param fail 774 | * @param complete 775 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxnotifyblecharacteristicvaluechangeobject 776 | */ 777 | static notifyBLECharacteristicValueChange ({ deviceId, serviceId, characteristicId, state, success, fail, complete }) {} 778 | 779 | /** 780 | * 监听低功耗蓝牙连接的错误事件,包括设备丢失,连接异常断开等等。 781 | * @param cb 782 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxonbleconnectionstatechangecallback 783 | */ 784 | static onBLEConnectionStateChange (cb) {} 785 | 786 | 787 | /** 788 | * 监听低功耗蓝牙设备的特征值变化。 789 | * @param cb 790 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxonblecharacteristicvaluechangecallback 791 | */ 792 | static onBLECharacteristicValueChange (cb) {} 793 | 794 | /** 795 | * 开始搜索附近的iBeacon设备 796 | * @param uuids 797 | * @param success 798 | * @param fail 799 | * @param complete 800 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/iBeacon.html#wxstartbeacondiscoveryobject 801 | */ 802 | static startBeaconDiscovery ({ uuids, success, fail, complete }) {} 803 | 804 | 805 | /** 806 | * 停止搜索附近的iBeacon设备 807 | * @param success 808 | * @param fail 809 | * @param complete 810 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/iBeacon.html#wxstopbeacondiscoveryobject 811 | */ 812 | static stopBeaconDiscovery ({ success, fail, complete }) {} 813 | 814 | /** 815 | * 获取所有已搜索到的iBeacon设备 816 | * @param success 817 | * @param fail 818 | * @param complete 819 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/iBeacon.html#wxgetbeaconsobject 820 | */ 821 | static getBeacons ({ success, fail, complete }) {} 822 | 823 | /** 824 | * 监听 iBeacon 设备的更新事件 825 | * @param cb 826 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/iBeacon.html#wxonbeaconupdatecallback 827 | */ 828 | static onBeaconUpdate (cb) {} 829 | 830 | /** 831 | * 监听 iBeacon 服务的状态变化 832 | * @param cb 833 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/iBeacon.html#wxonbeaconservicechangecallback 834 | */ 835 | static onBeaconServiceChange (cb) {} 836 | 837 | /** 838 | * 设置屏幕亮度。 839 | * @param value 840 | * @param success 841 | * @param fail 842 | * @param complete 843 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/device.html#wxsetscreenbrightnessobject 844 | */ 845 | static setScreenBrightness ({ value, success, fail, complete }) {} 846 | 847 | /** 848 | * 获取屏幕亮度。 849 | * @param success 850 | * @param fail 851 | * @param complete 852 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/device.html#wxgetscreenbrightnessobject 853 | */ 854 | static getScreenBrightness ({ success, fail, complete }) {} 855 | 856 | /** 857 | * 设置是否保持常亮状态。仅在当前小程序生效,离开小程序后设置失效。 858 | * @param keepScreenOn 859 | * @param success 860 | * @param fail 861 | * @param complete 862 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/setKeepScreenOn.html 863 | */ 864 | static setKeepScreenOn ({keepScreenOn, success, fail, complete}) {} 865 | 866 | /** 867 | * 监听用户主动截屏事件,用户使用系统截屏按键截屏时触发此事件 868 | * @param cb 869 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/onUserCaptureScreen.html 870 | */ 871 | static onUserCaptureScreen (cb) {} 872 | 873 | /** 874 | * 使手机发生较长时间的振动(400ms) 875 | * @param success 876 | * @param fail 877 | * @param complete 878 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/device.html#wxvibratelongobject 879 | */ 880 | static vibrateLong ({success, fail, complete}) {} 881 | 882 | /** 883 | * 使手机发生较短时间的振动(15ms) 884 | * @param success 885 | * @param fail 886 | * @param complete 887 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/device.html#wxvibrateshortobject 888 | */ 889 | static vibrateShort ({success, fail, complete}) {} 890 | 891 | /** 892 | * 调用后,用户可以选择将该表单以“新增联系人”或“添加到已有联系人”的方式,写入手机系统通讯录,完成手机通讯录联系人和联系方式的增加。 893 | * @param photoFilePath 894 | * @param nickName 895 | * @param lastName 896 | * @param middleName 897 | * @param firstName 898 | * @param remark 899 | * @param mobilePhoneNumber 900 | * @param weChatNumber 901 | * @param addressCountry 902 | * @param addressState 903 | * @param addressCity 904 | * @param addressStreet 905 | * @param addressPostalCode 906 | * @param organization 907 | * @param title 908 | * @param workFaxNumber 909 | * @param hostNumber 910 | * @param email 911 | * @param url 912 | * @param workAddressCountry 913 | * @param workAddressState 914 | * @param workAddressCity 915 | * @param workAddressStreet 916 | * @param workAddressPostalCode 917 | * @param homeFaxNumber 918 | * @param homePhoneNumber 919 | * @param homeAddressCountry 920 | * @param homeAddressState 921 | * @param homeAddressCity 922 | * @param homeAddressStreet 923 | * @param homeAddressPostalCode 924 | * @param success 925 | * @param fail 926 | * @param complete 927 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/phone-contact.html#wxaddphonecontactobject 928 | */ 929 | static addPhoneContact ({ photoFilePath, nickName, lastName, middleName, firstName, remark, mobilePhoneNumber, weChatNumber, addressCountry, addressState, addressCity, addressStreet, addressPostalCode, organization, title, workFaxNumber, hostNumber,email, url, workAddressCountry, workAddressState, workAddressCity, workAddressStreet, workAddressPostalCode, homeFaxNumber, homePhoneNumber, homeAddressCountry, homeAddressState, homeAddressCity, homeAddressStreet, homeAddressPostalCode, success, fail, complete }) {} 930 | 931 | /** 932 | * 显示消息提示框 933 | * @param title 934 | * @param icon 935 | * @param image 936 | * @param duration 937 | * @param mask 938 | * @param success 939 | * @param fail 940 | * @param complete 941 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-react.html#wxshowtoastobject 942 | */ 943 | static showToast ({ title, icon, image, duration, mask, success, fail, complete }) {} 944 | 945 | /** 946 | * 显示 loading 提示框, 需主动调用 wx.hideLoading 才能关闭提示框 947 | * @param title 948 | * @param mask 949 | * @param success 950 | * @param fail 951 | * @param complete 952 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-react.html#wxshowloadingobject 953 | */ 954 | static showLoading ({title, mask, success, fail, complete}) {} 955 | 956 | /** 957 | * 隐藏消息提示框 958 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-react.html#wxhidetoast 959 | */ 960 | static hideToast () {} 961 | 962 | /** 963 | * 隐藏 loading 提示框 964 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-react.html#wxhideloading 965 | */ 966 | static hideLoading () {} 967 | 968 | /** 969 | * 显示模态弹窗 970 | * @param title 971 | * @param content 972 | * @param showCancel 973 | * @param cancelText 974 | * @param cancelColor 975 | * @param confirmText 976 | * @param confirmColor 977 | * @param success 978 | * @param fail 979 | * @param complete 980 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-react.html#wxshowmodalobject 981 | */ 982 | static showModal ({ title, content, showCancel, cancelText, cancelColor, confirmText, confirmColor, success, fail, complete }) {} 983 | 984 | /** 985 | * ​显示操作菜单 986 | * @param itemList 987 | * @param itemColor 988 | * @param success 989 | * @param fail 990 | * @param complete 991 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-react.html#wxshowactionsheetobject 992 | */ 993 | static showActionSheet ({ itemList, itemColor, success, fail, complete }) {} 994 | 995 | /** 996 | * 动态设置当前页面的标题。 997 | * @param title 998 | * @param success 999 | * @param fail 1000 | * @param complete 1001 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/ui.html#wxsettopbartextobject 1002 | */ 1003 | static setNavigationBarTitle ({ title, success, fail, complete }) {} 1004 | 1005 | /** 1006 | * 在当前页面显示导航条加载动画。 1007 | */ 1008 | static showNavigationBarLoading () {} 1009 | 1010 | /** 1011 | *隐藏导航条加载动画。 1012 | */ 1013 | static hideNavigationBarLoading () {} 1014 | 1015 | /** 1016 | * 设置导航条颜色变化 1017 | * @param frontColor 1018 | * @param backgroundColor 1019 | * @param animation 1020 | * @param duration 1021 | * @param timingFunc 1022 | * @param success 1023 | * @param fail 1024 | * @param compete 1025 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/setNavigationBarColor.html 1026 | */ 1027 | static setNavigationBarColor ({ frontColor, backgroundColor, animation, duration, timingFunc, success, fail, compete}) {} 1028 | 1029 | /** 1030 | * 动态设置置顶栏文字内容,只有当前小程序被置顶时能生效,如果当前小程序没有被置顶,也能调用成功,但是不会立即生效,只有在用户将这个小程序置顶后才换上设置的文字内容。注意:调用成功后,需间隔 5s 才能再次调用此接口,如果在 5s 内再次调用此接口,会回调 fail,errMsg:"setTopBarText: fail invoke too frequently" 1031 | * @param text 1032 | * @param success 1033 | * @param fail 1034 | * @param complete 1035 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/ui.html#wxsettopbartextobject 1036 | */ 1037 | static setTopBarText ({ text, success, fail, complete}) {} 1038 | 1039 | /** 1040 | * 保留当前页面,跳转到应用内的某个页面,使用wx.navigateBack可以返回到原页面。 1041 | * @param url 1042 | * @param success 1043 | * @param fail 1044 | * @param complete 1045 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/ui-navigate.html#wxnavigatetoobject 1046 | */ 1047 | static navigateTo ({ url, success, fail, complete }) {} 1048 | 1049 | /** 1050 | * 关闭当前页面,跳转到应用内的某个页面。 1051 | * @param url 1052 | * @param success 1053 | * @param fail 1054 | * @param complete 1055 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/ui-navigate.html#wxredirecttoobject 1056 | */ 1057 | static redirectTo ({ url, success, fail, complete}) {} 1058 | 1059 | /** 1060 | * 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面 1061 | * @param url 1062 | * @param success 1063 | * @param fail 1064 | * @param complete 1065 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/ui-navigate.html#wxrelaunchobject 1066 | */ 1067 | static switchTab ({ url, success, fail, complete }) {} 1068 | 1069 | /** 1070 | * 关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages()) 获取当前的页面栈,决定需要返回几层。 1071 | * @param delta 1072 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/ui-navigate.html#wxrelaunchobject 1073 | */ 1074 | static navigateBack ({ delta }) {} 1075 | 1076 | /** 1077 | * 关闭所有页面,打开到应用内的某个页面。 1078 | * @param url 1079 | * @param success 1080 | * @param fail 1081 | * @param complete 1082 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/ui-navigate.html#wxrelaunchobject 1083 | */ 1084 | static reLaunch ({ url, success, fail, complete }) {} 1085 | 1086 | /** 1087 | * 创建一个动画实例animation。调用实例的方法来描述动画 1088 | * @param duration 1089 | * @param timingFunction 1090 | * @param delay 1091 | * @param transformOrigin 1092 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-animation.html#wxcreateanimationobject 1093 | */ 1094 | static createAnimation ({ duration, timingFunction, delay, transformOrigin }) {} 1095 | 1096 | /** 1097 | * 将页面滚动到目标位置。 1098 | * @param scrollTop 1099 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/scroll.html 1100 | */ 1101 | static pageScrollTo ({ scrollTop }) {} 1102 | 1103 | /** 1104 | * 返回一个SelectorQuery对象实例。可以在这个实例上使用select等方法选择节点,并使用boundingClientRect等方法选择需要查询的信息。 1105 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/wxml-nodes-info.html 1106 | */ 1107 | static createSelectorQuery () {} 1108 | 1109 | /** 1110 | * 创建wx 的canvas 1111 | * @param canvasId 1112 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/canvas/intro.html 1113 | */ 1114 | static createCanvasContext (canvasId) {} 1115 | 1116 | /** 1117 | * 不推荐使用 1118 | */ 1119 | static createContext () {} 1120 | 1121 | /** 1122 | * 不推荐使用 1123 | */ 1124 | static drawCanvas () {} 1125 | 1126 | /** 1127 | * 把当前画布指定区域的内容导出生成指定大小的图片,并返回文件路径。 1128 | * @param x 1129 | * @param y 1130 | * @param width 1131 | * @param height 1132 | * @param destWidth 1133 | * @param destHeight 1134 | * @param canvasId 1135 | * @param success 1136 | * @param fail 1137 | * @param complete 1138 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/canvas/temp-file.html 1139 | */ 1140 | static canvasToTempFilePath ({ x, y, width, height, destWidth, destHeight, canvasId, success, fail, complete}) {} 1141 | 1142 | /** 1143 | * 开始下拉刷新,调用后触发下拉刷新动画,效果与用户手动下拉刷新一致 1144 | * @param success 1145 | * @param fail 1146 | * @param complete 1147 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/pulldown.html#wxstartpulldownrefresh 1148 | */ 1149 | static startPullDownRefresh ({success, fail, complete}) {} 1150 | 1151 | /** 1152 | * 停止当前页面下拉刷新。 1153 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/pulldown.html#wxstoppulldownrefresh 1154 | */ 1155 | static stopPullDownRefresh () {} 1156 | 1157 | /** 1158 | * 获取第三方平台自定义的数据字段。 1159 | * @param success 1160 | * @param fail 1161 | * @param complete 1162 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/ext-api.html#wxgetextconfigobject 1163 | */ 1164 | static getExtConfig ({success, fail, complete}) {} 1165 | 1166 | /** 1167 | * 获取第三方平台自定义的数据字段的同步接口。 1168 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/ext-api.html#wxgetextconfigsync 1169 | */ 1170 | static getExtConfigSync () {} 1171 | 1172 | /** 1173 | * 调用接口获取登录凭证(code)进而换取用户登录态信息, 1174 | * 包括用户的唯一标识(openid) 及本次登录的 会话密钥(session_key)。 1175 | * 用户数据的加解密通讯需要依赖会话密钥完成。 1176 | * @param success 1177 | * @param fail 1178 | * @param complete 1179 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-login.html#wxloginobject 1180 | */ 1181 | static login ({ success, fail, complete }) {} 1182 | 1183 | /** 1184 | * 通过上述接口获得的用户登录态拥有一定的时效性。 1185 | * 用户越久未使用小程序,用户登录态越有可能失效。 1186 | * 反之如果用户一直在使用小程序,则用户登录态一直保持有效。 1187 | * 具体时效逻辑由微信维护,对开发者透明。 1188 | * 开发者只需要调用wx.checkSession接口检测当前用户登录态是否有效。 1189 | * 登录态过期后开发者可以再调用wx.login获取新的用户登录态。 1190 | * @param success 1191 | * @param fail 1192 | * @param complete 1193 | */ 1194 | static checkSession ({ success, fail, complete }) {} 1195 | 1196 | /** 1197 | * 部分接口需要获得同意后才能调用。 1198 | * 此类接口调用时,如果用户未授权过, 1199 | * 会弹窗询问用户,用户点击同意后方可调用接口。 1200 | * 如果用户点了拒绝,则短期内调用不会出现弹窗, 1201 | * 而是直接进入 fail 回调。用户可以在小程序设置界面中修改对该小程序的授权信息。 1202 | * 本接口用于提前向用户发起授权, 1203 | * 调用后会立刻弹窗询问用户是否同意小程序使用某项功能或获取用户的某些数据, 1204 | * 但不会实际调用接口。如果用户之前已经同意,则不会出现弹窗,直接返回成功。 1205 | * @param scope 1206 | * @param success 1207 | * @param fail 1208 | * @param complete 1209 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/authorize.html#wxauthorizeobject 1210 | */ 1211 | static authorize ({scope, success, fail, complete}) {} 1212 | 1213 | /** 1214 | * 获取用户信息,withCredentials 为 true 时需要先调用 wx.login 接口。 1215 | * @param withCredentials 1216 | * @param lang 1217 | * @param success 1218 | * @param fail 1219 | * @param complete 1220 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/open.html#wxgetuserinfoobject 1221 | */ 1222 | static getUserInfo ({ withCredentials, lang, success, fail, complete }) {} 1223 | 1224 | /** 1225 | * 发起微信支付。 1226 | * @param timeStamp 1227 | * @param nonceStr 1228 | * @param package1 1229 | * @param signType 1230 | * @param paySign 1231 | * @param success 1232 | * @param fail 1233 | * @param complete 1234 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-pay.html#wxrequestpaymentobject 1235 | */ 1236 | static requestPayment ({ timeStamp, nonceStr, package1, signType, paySign, success, fail, complete }) {} 1237 | 1238 | /** 1239 | * 显示当前页面的转发按钮 1240 | * @param withShareTicket 1241 | * @param success 1242 | * @param fail 1243 | * @param compete 1244 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/share.html#wxshowsharemenuobject 1245 | */ 1246 | static showShareMenu ({ withShareTicket, success, fail, compete }) {} 1247 | 1248 | /** 1249 | * 隐藏转发按钮 1250 | * @param success 1251 | * @param fail 1252 | * @param complete 1253 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/share.html#wxhidesharemenuobject 1254 | */ 1255 | static hideShareMenu ({ success, fail, complete }) {} 1256 | 1257 | /** 1258 | * 更新转发属性 1259 | * @param withShareTicket 1260 | * @param success 1261 | * @param fail 1262 | * @param complete 1263 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/share.html#wxupdatesharemenuobject 1264 | */ 1265 | static updateShareMenu ({ withShareTicket, success, fail, complete }) {} 1266 | 1267 | /** 1268 | * 获取转发详细信息 1269 | * @param shareTicket 1270 | * @param success 1271 | * @param fail 1272 | * @param complete 1273 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/share.html#wxgetshareinfoobject 1274 | */ 1275 | static getShareInfo ({ shareTicket, success, fail, complete }) {} 1276 | 1277 | /** 1278 | * 调起用户编辑收货地址原生界面,并在编辑完成后返回用户选择的地址。 1279 | * @param success 1280 | * @param fail 1281 | * @param complete 1282 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/address.html#wxchooseaddressobject 1283 | */ 1284 | static chooseAddress ({ success, fail, complete }) {} 1285 | 1286 | /** 1287 | * 批量添加卡券。 1288 | * @param cardList 1289 | * @param success 1290 | * @param fail 1291 | * @param complete 1292 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/card.html#wxaddcardobject 1293 | */ 1294 | static addCard ({ cardList, success, fail, complete }) {} 1295 | 1296 | /** 1297 | * 查看微信卡包中的卡券。 1298 | * @param cardList 1299 | * @param success 1300 | * @param fail 1301 | * @param complete 1302 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/card.html#wxopencardobject 1303 | */ 1304 | static openCard ({ cardList, success, fail, complete}) {} 1305 | 1306 | /** 1307 | * 调起客户端小程序设置界面,返回用户设置的操作结果 1308 | * @param success 1309 | * @param fail 1310 | * @param complete 1311 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/setting.html#wxopensettingobject 1312 | */ 1313 | static openSetting ({success, fail, complete}) {} 1314 | 1315 | /** 1316 | * 获取用户的当前设置 1317 | * @param success 1318 | * @param fail 1319 | * @param complete 1320 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/setting.html#wxgetsettingobject 1321 | */ 1322 | static getSetting ({success, fail, complete}) {} 1323 | 1324 | /** 1325 | * 获取用户过去三十天微信运动步数,需要先调用 wx.login 接口。 1326 | * @param success 1327 | * @param fail 1328 | * @param complete 1329 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/we-run.html#wxgetwerundataobject 1330 | */ 1331 | static getWeRunData ({success, fail, complete}) {} 1332 | 1333 | /** 1334 | * 打开同一公众号下关联的另一个小程序。 1335 | * @param appId 1336 | * @param path 1337 | * @param extraData 1338 | * @param envVersion 1339 | * @param success 1340 | * @param fail 1341 | * @param complete 1342 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/navigateToMiniProgram.html 1343 | */ 1344 | static navigateToMiniProgram ({ appId, path, extraData, envVersion, success, fail, complete }) {} 1345 | 1346 | /** 1347 | * 返回到上一个小程序,只有在当前小程序是被其他小程序打开时可以调用成功 1348 | * @param extraData 1349 | * @param success 1350 | * @param fail 1351 | * @param complete 1352 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/navigateBackMiniProgram.html 1353 | */ 1354 | static navigateBackMiniProgram ({ extraData, success, fail, complete }) {} 1355 | 1356 | /** 1357 | * 选择用户的发票抬头 1358 | * @param success 1359 | * @param fail 1360 | * @param complete 1361 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/chooseInvoiceTitle.html 1362 | */ 1363 | static chooseInvoiceTitle ({success, fail, complete}) {} 1364 | 1365 | 1366 | /** 1367 | * 获取本机支持的 SOTER 生物认证方式 1368 | * @param success 1369 | * @param fail 1370 | * @param compete 1371 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/checkIsSupportSoterAuthentication.html 1372 | */ 1373 | static checkIsSupportSoterAuthentication ({ success, fail, compete }) {} 1374 | 1375 | /** 1376 | * 开始 SOTER 生物认证 1377 | * @param requestAuthModes 1378 | * @param challenge 1379 | * @param authContent 1380 | * @param success 1381 | * @param fail 1382 | * @param complete 1383 | */ 1384 | static startSoterAuthentication ({requestAuthModes, challenge, authContent, success, fail, complete}) {} 1385 | 1386 | /** 1387 | * 将 ArrayBuffer 数据转成 Base64 字符串 1388 | * @param arrayBuffer 1389 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-util.html#wxarraybuffertobase64arraybuffer 1390 | */ 1391 | static arrayBufferToBase64 (arrayBuffer) {} 1392 | 1393 | /** 1394 | * 将 Base64 字符串转成 ArrayBuffer 数据 1395 | * @param base64 1396 | * https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-util.html#wxarraybuffertobase64arraybuffer 1397 | */ 1398 | static base64ToArrayBuffer (base64) {} 1399 | 1400 | /** 1401 | * 自定义分析数据上报接口。使用前,需要在小程序管理后台自定义分析中新建事件,配置好事件名与字段。 1402 | * @param eventName 事件名 1403 | * @param data 上报的自定义数据。key为配置中的字段名,value为上报的数据 1404 | */ 1405 | static reportAnalytics (eventName, data) {} 1406 | } 1407 | 1408 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wechat-mini-programs-apis", 3 | "version": "1.6.2", 4 | "description": "微信小程序api汇总", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/jayazhang/weChatMiniPrograms.git" 12 | }, 13 | "keywords": [ 14 | "微信小程序", 15 | "微信小程序api", 16 | "微信小程序开发文档" 17 | ], 18 | "author": "907010286@qq.com", 19 | "license": "ISC", 20 | "bugs": { 21 | "url": "https://github.com/jayazhang/weChatMiniPrograms/issues" 22 | }, 23 | "homepage": "https://github.com/jayazhang/weChatMiniPrograms#readme" 24 | } 25 | -------------------------------------------------------------------------------- /page.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by jayazhang on 2017-8-21. 3 | */ 4 | 5 | function getApp () {} 6 | 7 | function App () {} 8 | // 生命周期函数--监听小程序初始化 9 | // 当小程序初始化完成时,会触发 onLaunch(全局只触发一次) 10 | App.prototype.onLaunch = function () {} 11 | // 生命周期函数--监听小程序显示 12 | // 当小程序启动,或从后台进入前台显示,会触发 onShow 13 | App.prototype.onShow = function () {} 14 | // 生命周期函数--监听小程序隐藏 15 | // 当小程序从前台进入后台,会触发 onHide 16 | App.prototype.onHide = function () {} 17 | // 错误监听函数 18 | // 当小程序发生脚本错误,或者 api 调用失败时,会触发 onError 并带上错误信息 19 | App.prototype.onError = function () {} 20 | 21 | 22 | function Page () {} 23 | /** 24 | * 在 Page 中定义 onPullDownRefresh 处理函数,监听该页面用户下拉刷新事件。 25 | 26 | 需要在 config 的window选项中开启 enablePullDownRefresh。 27 | 当处理完数据刷新后,wx.stopPullDownRefresh可以停止当前页面的下拉刷新。 28 | 29 | https://mp.weixin.qq.com/debug/wxadoc/dev/api/pulldown.html#onpulldownrefresh 30 | */ 31 | Page.prototype.onPullDownRefresh = function () { 32 | 33 | } 34 | 35 | /** 36 | * 在 Page 中定义 onShareAppMessage 函数,设置该页面的转发信息。 37 | * 只有定义了此事件处理函数,右上角菜单才会显示 “转发” 按钮 38 | * 用户点击转发按钮的时候会调用 39 | * 此事件需要 return 一个 Object,用于自定义转发内容 40 | */ 41 | Page.prototype.onShareAppMessage = function () {} 42 | 43 | // 生命周期函数--监听页面加载 44 | Page.prototype.onLoad = function (query) {} 45 | 46 | // 生命周期函数--监听页面初次渲染完成 47 | Page.prototype.onReady = function () {} 48 | 49 | // 生命周期函数--监听页面显示 50 | Page.prototype.onShow = function () {} 51 | 52 | // 生命周期函数--监听页面隐藏 53 | Page.prototype.onHide = function () {} 54 | 55 | // 生命周期函数--监听页面卸载 56 | Page.prototype.onUnload = function () {} 57 | 58 | // 页面上拉触底事件的处理函数 59 | Page.prototype.onReachBottom = function () {} 60 | 61 | // 页面滚动触发事件的处理函数 62 | Page.prototype.onPageScroll = function () {} 63 | 64 | // setData 函数用于将数据从逻辑层发送到视图层(异步),同时改变对应的 this.data 的值(同步)。 65 | Page.prototype.setData = function () {} 66 | 67 | --------------------------------------------------------------------------------