-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMinaAPI.xml
More file actions
436 lines (436 loc) · 34.7 KB
/
MinaAPI.xml
File metadata and controls
436 lines (436 loc) · 34.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
<templateSet group="MinaAPI">
<template name="wx.request" value="wx.request({ url: '$URL$', data: {}, header: { 'content-type': 'application/json' // 默认值 }, success: function(res) { console.log(res.data) $SUCCESS$ } })" description="发起网络请求" toReformat="false" toShortenFQNames="true">
<variable name="URL" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.uploadFile" value="wx.uploadFile({ url: '$URL$', //仅为示例,非真实的接口地址 filePath: '$FILE_PATH$', name: '$NAME$', formData:{}, success: function(res){ var data = res.data $SUCCESS$ } })" description="将本地资源上传到开发者服务器,客户端发起一个 HTTPS POST 请求,其中 content-type 为 multipart/form-data" toReformat="false" toShortenFQNames="true">
<variable name="URL" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="FILE_PATH" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.downloadFile" value="wx.downloadFile({ url: '$URL$', success: function(res) { // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容 if (res.statusCode === 200) { } } })" description="下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径" toReformat="false" toShortenFQNames="true">
<variable name="URL" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.connectSocket" value="wx.connectSocket({ url: 'wss://$URL$', data:{ x: '', y: '' }, header:{ 'content-type': 'application/json' }, protocols: ['protocol1'], method:"GET" })" description="创建一个 WebSocket 连接" toReformat="false" toShortenFQNames="true">
<variable name="URL" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.onSocketOpen" value="wx.onSocketOpen(function(res) { $SUCCESS$ })" description="监听WebSocket连接打开事件" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.onSocketError" value="wx.onSocketError(function(res){ $ERROR$ })" description="监听WebSocket错误" toReformat="false" toShortenFQNames="true">
<variable name="ERROR" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.sendSocketMessage" value="wx.sendSocketMessage({ data:'$DATA$' })" description="通过 WebSocket 连接发送数据,需要先 wx.connectSocket,并在 wx.onSocketOpen 回调之后才能发送" toReformat="false" toShortenFQNames="true">
<variable name="DATA" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.onSocketClose" value="wx.onSocketClose(function(res) { $SUCCESS$ })" description="监听WebSocket关闭" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="SocketTask.send" value="SocketTask.send($OBJECT$)" description="[1.7.0+]通过 WebSocket 连接发送数据" toReformat="false" toShortenFQNames="true">
<variable name="OBJECT" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="SocketTask.close" value="SocketTask.close($OBJECT$)" description="[1.7.0+]关闭 WebSocket 连接" toReformat="false" toShortenFQNames="true">
<variable name="OBJECT" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.chooseImage" value="wx.chooseImage({ count: 1, // 默认9 sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 success: function (res) { // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片 var tempFilePaths = res.tempFilePaths } })" description="从本地相册选择图片或使用相机拍照" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.previewImage" value="wx.previewImage({ current: '$CURRENT_IMG_URL$', // 当前显示图片的http链接 urls: [] // 需要预览的图片http链接列表 })" description="预览图片" toReformat="false" toShortenFQNames="true">
<variable name="CURRENT_IMG_URL" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.getImageInfo" value="wx.getImageInfo({ src: '$IMG_URL$', success: function (res) { $SUCCESS$ console.log(res.width) console.log(res.height) } })" description="获取图片信息" toReformat="false" toShortenFQNames="true">
<variable name="IMG_URL" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.saveImageToPhotosAlbum" value="wx.saveImageToPhotosAlbum({ success(res) { $SUCCESS$ } })" description="[1.2.0+]保存图片到系统相册。需要用户授权 scope.writePhotosAlbum" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.startRecord" value="wx.startRecord({ success: function(res) { var tempFilePath = res.tempFilePath $SUCCESS$ }, fail: function(res) { //录音失败 $FAIL$ } })" description="[1.6.0-不再维护]开始录音。当主动调用wx.stopRecord,或者录音超过1分钟时自动结束录音,返回录音文件的临时文件路径。当用户离开小程序时,此接口无法调用。需要用户授权 scope.record" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="FAIL" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.stopRecord" value="wx.stopRecord()" description="主动调用停止录音" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.getRecorderManager" value="const recorderManager = wx.getRecorderManager() recorderManager.onStart(() => { console.log('recorder start') }) recorderManager.onResume(() => { console.log('recorder resume') }) recorderManager.onPause(() => { console.log('recorder pause') }) recorderManager.onStop((res) => { console.log('recorder stop', res) const { tempFilePath } = res }) recorderManager.onFrameRecorded((res) => { const { frameBuffer } = res console.log('frameBuffer.byteLength', frameBuffer.byteLength) }) const options = { duration: 10000, sampleRate: 44100, numberOfChannels: 1, encodeBitRate: 192000, format: 'aac', frameSize: 50 } recorderManager.start(options)" description="[1.6.0+]获取全局唯一的录音管理器 recorderManager" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.playVoice" value="wx.playVoice({ filePath: $FILE_PATH$, complete: function(){ $COMPLETE$ } })" description="[1.6.0-不再维护]开始播放语音,同时只允许一个语音文件正在播放,如果前一个语音文件还没播放完,将中断前一个语音播放" toReformat="false" toShortenFQNames="true">
<variable name="FILE_PATH" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="COMPLETE" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.pauseVoice" value="wx.pauseVoice()" description="暂停正在播放的语音。再次调用wx.playVoice播放同一个文件时,会从暂停处开始播放。如果想从头开始播放,需要先调用 wx.stopVoice" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.stopVoice" value="wx.stopVoice()" description="结束播放语音" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.getBackgroundAudioPlayerState" value="wx.getBackgroundAudioPlayerState({ success: function(res) { var status = res.status var dataUrl = res.dataUrl var currentPosition = res.currentPosition var duration = res.duration var downloadPercent = res.downloadPercent } })" description="[1.2.0-不再维护]获取后台音乐播放状态" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.playBackgroundAudio" value="wx.playBackgroundAudio({ dataUrl: '$DATA_URL$', title: '$TITLE$', coverImgUrl: '$COVER_IMG_URL$' })" description="使用后台播放器播放音乐,对于微信客户端来说,只能同时有一个后台音乐在播放。当用户离开小程序后,音乐将暂停播放;当用户点击“显示在聊天顶部”时,音乐不会暂停播放;当用户在其他小程序占用了音乐播放器,原有小程序内的音乐将停止播放" toReformat="false" toShortenFQNames="true">
<variable name="DATA_URL" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="TITLE" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="COVER_IMG_URL" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.pauseBackgroundAudio" value="wx.pauseBackgroundAudio()" description="暂停播放音乐" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.seekBackgroundAudio" value="wx.seekBackgroundAudio({ position: $POSITION$ //音乐位置,单位:秒 })" description="控制音乐播放进度" toReformat="false" toShortenFQNames="true">
<variable name="POSITION" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.stopBackgroundAudio" value="wx.stopBackgroundAudio()" description="停止播放音乐" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.onBackgroundAudioPlay" value="wx.onBackgroundAudioPlay($CALLBACK$)" description="监听音乐播放" toReformat="false" toShortenFQNames="true">
<variable name="CALLBACK" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.onBackgroundAudioPause" value="wx.onBackgroundAudioPause($CALLBACK$)" description="监听音乐暂停" toReformat="false" toShortenFQNames="true">
<variable name="CALLBACK" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.onBackgroundAudioStop" value="wx.onBackgroundAudioStop($CALLBACK$)" description="监听音乐停止" toReformat="false" toShortenFQNames="true">
<variable name="CALLBACK" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.getBackgroundAudioManager" value="const backgroundAudioManager = wx.getBackgroundAudioManager() backgroundAudioManager.title = '$TITLE$' backgroundAudioManager.epname = '$EPNAME$' backgroundAudioManager.singer = '$SINGER$' backgroundAudioManager.coverImgUrl = '$AUDIO_IMG_URL$' backgroundAudioManager.src = '$AUDIO_SRC$'" description="[1.2.0+]获取全局唯一的背景音频管理器 backgroundAudioManager" toReformat="false" toShortenFQNames="true">
<variable name="TITLE" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="EPNAME" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="SINGER" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="AUDIO_IMG_URL" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="AUDIO_SRC" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.createAudioContext" value="wx.createAudioContext('$DOM_ID$')" description="[1.6.0-不再维护]创建并返回 audio 上下文 audioContext 对象。在自定义组件下,第二个参数传入组件实例this,以操作组件内 audio 组件" toReformat="false" toShortenFQNames="true">
<variable name="DOM_ID" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.createInnerAudioContext" value="const innerAudioContext = wx.createInnerAudioContext() innerAudioContext.autoplay = true innerAudioContext.src = '$AUDIO_SRC$' innerAudioContext.onPlay(() => { console.log('开始播放') }) innerAudioContext.onError((res) => { console.log(res.errMsg) console.log(res.errCode) })" description="[1.6.0+]创建并返回内部 audio 上下文 innerAudioContext 对象。本接口是 wx.createAudioContext 升级版" toReformat="false" toShortenFQNames="true">
<variable name="AUDIO_SRC" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.chooseVideo" value="wx.chooseVideo({ sourceType: ['album','camera'], maxDuration: 60, success: function(res) { var src = res.tempFilePath $SUCCESS$ } })" description="拍摄视频或从手机相册中选视频,返回视频的临时文件路径" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.saveVideoToPhotosAlbum" value="wx.saveVideoToPhotosAlbum({ success(res) { $SUCCESS$ } })" description="[1.2.0+]保存视频到系统相册。需要用户授权 scope.writePhotosAlbum" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.createVideoContext" value="wx.createVideoContext('$DOM_ID$')" description="创建并返回 video 上下文 videoContext 对象。在自定义组件下,第二个参数传入组件实例this,以操作组件内 video 组件" toReformat="false" toShortenFQNames="true">
<variable name="DOM_ID" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.createCameraContext" value="wx.createCameraContext(this)" description="[1.6.0+]创建并返回 camera 上下文 cameraContext 对象,cameraContext 与页面的 camera 组件绑定,一个页面只能有一个camera,通过它可以操作对应的 camera 组件。 在自定义组件下,第一个参数传入组件实例this,以操作组件内 camera 组件" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.createLivePlayerContext" value="wx.createLivePlayerContext($DOM_ID$, this)" description="[1.7.0+]操作对应的 live-player 组件。 创建并返回 live-player 上下文 LivePlayerContext 对象。在自定义组件下,第二个参数传入组件实例this,以操作组件内 live-player 组件" toReformat="false" toShortenFQNames="true">
<variable name="DOM_ID" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.createLivePusherContext" value="wx.createLivePusherContext()" description="[1.7.0+]创建并返回 live-pusher 上下文 LivePusherContext 对象,LivePusherContext 与页面的 live-pusher 组件绑定,一个页面只能有一个 live-pusher,通过它可以操作对应的 live-pusher 组件。 在自定义组件下,第一个参数传入组件实例this,以操作组件内 live-pusher 组件" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.saveFile" value="wx.saveFile({ tempFilePath: '$FILE_PATH$', success: function(res) { var savedFilePath = res.savedFilePath $SUCCESS$ } })" description="[1.7.0+]保存文件到本地。注意:saveFile 会把临时文件移动,因此调用成功后传入的 tempFilePath 将不可用" toReformat="false" toShortenFQNames="true">
<variable name="FILE_PATH" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.getFileInfo" value="wx.getFileInfo({ success(res) { $SUCCESS$ console.log(res.size) console.log(res.digest) } })" description="[1.4.0+]获取文件信息" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.getSavedFileList" value="wx.getSavedFileList({ success: function(res) { console.log(res.fileList) $SUCCESS$ } })" description="获取本地已保存的文件列表" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.getSavedFileInfo" value="wx.getSavedFileInfo({ filePath: 'wxfile://$FILE_PATH$', //仅做示例用,非真正的文件路径 success: function(res) { console.log(res.size) console.log(res.createTime) $SUCCESS$ } })" description="获取本地文件的文件信息。此接口只能用于获取已保存到本地的文件,若需要获取临时文件信息,请使用 wx.getFileInfo 接口" toReformat="false" toShortenFQNames="true">
<variable name="FILE_PATH" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.removeSavedFile" value="wx.removeSavedFile({ filePath: res.fileList[0].filePath, complete: function(res) { console.log(res) $COMPLETE$ } })" description="删除本地存储的文件" toReformat="false" toShortenFQNames="true">
<variable name="COMPLETE" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.openDocument" value="wx.openDocument({ filePath: $FILE_PATH$, success: function (res) { console.log('打开文档成功') $SUCCESS$ } })" description="新开页面打开文档,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx" toReformat="false" toShortenFQNames="true">
<variable name="FILE_PATH" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.setStorage" value="wx.setStorage({ key:'$KEY$', data: $VALUE$ })" description="[异步]将数据存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容" toReformat="false" toShortenFQNames="true">
<variable name="KEY" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="VALUE" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.setStorageSync" value="try { wx.setStorageSync('$KEY$', $VALUE$) } catch (e) { }" description="[同步]将 data 存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容" toReformat="false" toShortenFQNames="true">
<variable name="KEY" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="VALUE" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.getStorage" value="wx.getStorage({ key: '$KEY$', success: function(res) { console.log(res.data) $SUCCESS$ } })" description="[异步]从本地缓存中异步获取指定 key 对应的内容" toReformat="false" toShortenFQNames="true">
<variable name="KEY" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.getStorageSync" value="try { var value = wx.getStorageSync('$KEY$') if (value) { // Do something with return value } } catch (e) { // Do something when catch error }" description="[同步]从本地缓存中同步获取指定 key 对应的内容" toReformat="false" toShortenFQNames="true">
<variable name="KEY" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.getStorageInfo" value="wx.getStorageInfo({ success: function(res) { console.log(res.keys) console.log(res.currentSize) console.log(res.limitSize) $SUCCESS$ } })" description="[异步]获取当前storage的相关信息" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.getStorageInfoSync" value="try { var res = wx.getStorageInfoSync() console.log(res.keys) console.log(res.currentSize) console.log(res.limitSize) } catch (e) { // Do something when catch error }" description="[同步]获取当前storage的相关信息" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.removeStorage" value="wx.removeStorage({ key: '$KEY$', success: function(res) { console.log(res.data) $SUCCESS$ } })" description="[异步]从本地缓存中异步移除指定 key" toReformat="false" toShortenFQNames="true">
<variable name="KEY" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.removeStorageSync" value="try { wx.removeStorageSync('$KEY$') } catch (e) { // Do something when catch error }" description="[同步]从本地缓存中同步移除指定 key" toReformat="false" toShortenFQNames="true">
<variable name="KEY" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.clearStorage" value="wx.clearStorage()" description="[异步]清理本地数据缓存" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.clearStorageSync" value="wx.clearStorageSync()" description="[同步]清理本地数据缓存" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.getLocation" value="wx.getLocation({ type: 'wgs84', success: function(res) { var latitude = res.latitude var longitude = res.longitude var speed = res.speed var accuracy = res.accuracy $SUCCESS$ } })" description="获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用;当用户点击“显示在聊天顶部”时,此接口可继续调用" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.chooseLocation" value="wx.getLocation({ success: function(res) { var latitude = res.latitude //纬度 var longitude = res.longitude //经度 var name = res.name //位置名称 var address = res.address //详细地址 $SUCCESS$ } })" description="打开地图选择位置。需要用户授权 scope.userLocation" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.openLocation" value="wx.openLocation({ latitude: latitude, //纬度 longitude: longitude, //经度 scale: 18 //缩放比例 5~18 })" description="使用微信内置地图查看位置。 需要用户授权 scope.userLocation" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.createMapContext" value="wx.createMapContext('$DOM_ID$')" description="创建并返回 map 上下文 mapContext 对象。在自定义组件下,第二个参数传入组件实例this,以操作组件内 map 组件" toReformat="false" toShortenFQNames="true">
<variable name="DOM_ID" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.getSystemInfo" value="wx.getSystemInfo({ success: function(res) { console.log(res.model) console.log(res.pixelRatio) console.log(res.windowWidth) console.log(res.windowHeight) console.log(res.language) console.log(res.version) console.log(res.platform) $SUCCESS$ } })" description="[异步]获取系统信息" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.getSystemInfoSync" value="try { var res = wx.getSystemInfoSync() console.log(res.model) console.log(res.pixelRatio) console.log(res.windowWidth) console.log(res.windowHeight) console.log(res.language) console.log(res.version) console.log(res.platform) } catch (e) { // Do something when catch error }" description="[同步]获取系统信息同步接口" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.canIUse" value="wx.canIUse($String$)" description="判断小程序的API,回调,参数,组件等是否在当前版本可用" toReformat="false" toShortenFQNames="true">
<variable name="String" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.getNetworkType" value="wx.getNetworkType({ success: function(res) { // 返回网络类型, 有效值: // wifi/2g/3g/4g/unknown(Android下不常见的网络类型)/none(无网络) var networkType = res.networkType $SUCCESS$ } })" description="获取网络类型" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.onNetworkStatusChange" value="wx.onNetworkStatusChange(function(res) { console.log(res.isConnected) console.log(res.networkType) $SUCCESS$ })" description="[1.1.0+]监听网络状态变化" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.onAccelerometerChange" value="wx.onAccelerometerChange(function(res) { console.log(res.x) console.log(res.y) console.log(res.z) $SUCCESS$ })" description="监听加速度数据,频率:5次/秒,接口调用后会自动开始监听,可使用 wx.stopAccelerometer 停止监听" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.startAccelerometer" value="wx.startAccelerometer()" description="[1.1.0+]开始监听加速度数据" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.stopAccelerometer" value="wx.stopAccelerometer()" description="[1.1.0+]停止监听加速度数据" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.onCompassChange" value="wx.onCompassChange(function (res) { console.log(res.direction) $SUCCESS$ })" description="监听罗盘数据,频率:5次/秒,接口调用后会自动开始监听,可使用wx.stopCompass停止监听" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.startCompass" value="wx.startCompass()" description="[1.1.0]开始监听罗盘数据" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.stopCompass" value="wx.stopCompass()" description="[1.1.0]停止监听罗盘数据" toReformat="false" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.makePhoneCall" value="wx.makePhoneCall({ phoneNumber: '$PHONE_NUMBER$' })" description="拨打电话" toReformat="false" toShortenFQNames="true">
<variable name="PHONE_NUMBER" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.scanCode" value="wx.scanCode({ onlyFromCamera: false, // 只允许从相机扫码 success: (res) => { console.log(res) $SUCCESS$ } })" description="调起客户端扫码界面,扫码成功后返回对应的结果" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.setClipboardData" value="wx.setClipboardData({ data: '$DATA$', success: function(res) { $SUCCESS$ } })" description="[1.1.0]设置系统剪贴板的内容" toReformat="false" toShortenFQNames="true">
<variable name="DATA" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="wx.getClipboardData" value="wx.getClipboardData({ success: function(res){ $SUCCESS$ console.log(res.data) } })" description="[1.1.0]获取系统剪贴板的内容" toReformat="false" toShortenFQNames="true">
<variable name="SUCCESS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
</templateSet>