├── .gitattributes
├── CHANGELOG.md
├── LICENSE
├── README.md
├── assets
└── image
│ └── logo.png
├── package.json
└── snippets
├── wxjs.json
├── wxjson.json
└── wxxml.json
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.js linguist-language=javascript
2 |
3 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ### 0.4.10 2018.10
2 | * 更新到官方最新API
3 |
4 | ### 0.4.9 2018.09
5 | * 更新到官方最新API
6 |
7 | ### 0.4.8 2018.09
8 | * 更新到官方最新API
9 |
10 | ### 0.4.5 2018.08
11 | * FixBug: App,Page Component对象的生命周期函数不能用ES6写法
12 |
13 | ### 0.4.1 2018.08
14 | * 增加了FileSystemManager API
15 |
16 | ### 0.3.9 2018.08
17 | * 模板格式更好了
18 | * 修复了几个索引的Bug
19 |
20 |
21 | ### 0.3.0 2018.08
22 | * 添加了json文件的模板
23 |
24 |
25 | ### 0.2.0 2018.08
26 | * 添加了主要组件的模板
27 |
28 |
29 | ### 0.1.0 2018.08
30 | * 添加了主要API的代码模板
31 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 ChandZhang
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # wechat-snippet-vscode
2 |
3 | A wechat snippet plugin for vscode.
4 |
5 | 由微信官方文档照搬下来的代码片段。
6 | 方便自己使用,同时也给需要者提供帮助。
7 |
8 | 官方文档: https://developers.weixin.qq.com/miniprogram/dev/api/
9 |
10 | ## 使用方法
11 | * JSON 片段:在{}中输入 page,pages,window,tabbar等属性关键字即可提示代码片段模板。
12 | * JavaScript 片段:输入 wx-page,wx-app,wx-request等wx-开头的关键字即可提示代码片段模板。
13 | * WXML 片段:直接输入组件名称,即可提示代码片段模板。如,输入 view,可自动生成 View 标签及其属性。
14 |
15 | ## 演示动画
16 |
17 | json片段:在{}中输入 page,pages,window,tabbar等属性关键字即可提示代码片段模板.
18 | 
19 |
20 | js片段:输入 wx-page,wx-app,wx-request等wx-开头的关键字即可提示代码片段模板.
21 | 
22 |
23 | wxml片段:直接输入组件名称,即可提示代码片段模板. 如,输入 view,可自动生成 view标签及其属性
24 | 
25 |
26 | ## 联系作者
27 | 如果有问题,请联系 zhangcd@iiowl.com
28 |
--------------------------------------------------------------------------------
/assets/image/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ChandZhang/wechat-snippet-vscode/48c27eaaec79366c7877f44db55ef8cd511011bb/assets/image/logo.png
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "wechat-snippet",
3 | "description": "微信小程序代码辅助,代码片段自动完成",
4 | "version": "0.4.10",
5 | "publisher": "ChandZhang",
6 | "engines": {
7 | "vscode": "^1.20.0"
8 | },
9 | "categories": [
10 | "Snippets"
11 | ],
12 | "keywords": [
13 | "miniapp",
14 | "小程序",
15 | "wx",
16 | "wechat",
17 | "wxapi"
18 | ],
19 | "contributes": {
20 | "languages": [{
21 | "id": "wxml",
22 | "extensions": [
23 | ".wxml"
24 | ]
25 | },
26 | {
27 | "id": "json",
28 | "extensions": [
29 | ".json"
30 | ]
31 | },
32 | {
33 | "id": "wxs",
34 | "extensions": [
35 | ".wxs"
36 | ]
37 | }
38 | ],
39 | "snippets": [{
40 | "language": "javascript",
41 | "path": "./snippets/wxjs.json"
42 | },
43 | {
44 | "language": "typescript",
45 | "path": "./snippets/wxjs.json"
46 | },
47 | {
48 | "language": "wxs",
49 | "path": "./snippets/wxjs.json"
50 | },
51 | {
52 | "language": "html",
53 | "path": "./snippets/wxxml.json"
54 | },
55 | {
56 | "language": "wxml",
57 | "path": "./snippets/wxxml.json"
58 | },
59 | {
60 | "language": "json",
61 | "path": "./snippets/wxjson.json"
62 | }
63 | ]
64 | },
65 | "repository": {
66 | "type": "git",
67 | "url": "https://github.com/Chand-zhang/wechat-snippet-vscode"
68 | },
69 | "bugs": {
70 | "email": "zhangcd@iiwol.com"
71 | },
72 | "icon": "assets/image/logo.png",
73 | "license": "MIT License"
74 | }
--------------------------------------------------------------------------------
/snippets/wxjs.json:
--------------------------------------------------------------------------------
1 | {
2 | "wxapp": {
3 | "prefix": "wx-app",
4 | "body": [
5 | "//app.js",
6 | "App({",
7 | "\t//onLaunch,onShow: options(path,query,scene,shareTicket,referrerInfo(appId,extraData))",
8 | "\tonLaunch: function(options){",
9 | "\t\t${1}",
10 | "\t},",
11 | "\tonShow: function(options){",
12 | "\r\n\t},",
13 | "\tonHide: function(){",
14 | "\r\n\t},",
15 | "\tonError: function(msg){",
16 | "\r\n\t},",
17 | "\t//options(path,query,isEntryPage)",
18 | "\tonPageNotFound: function(options){",
19 | "\r\n\t},",
20 | "\tglobalData: {",
21 | "\t\t${2}",
22 | "\t}",
23 | "});"
24 | ],
25 | "description": "App对象及其生命周期函数和回调函数"
26 | },
27 | "wxpage": {
28 | "prefix": "wx-page",
29 | "body": [
30 | "//Page Object",
31 | "Page({",
32 | "\tdata: {",
33 | "\t\t${1}",
34 | "\t},",
35 | "\t//options(Object)",
36 | "\tonLoad: function(options){",
37 | "\t\t${2}",
38 | "\t},",
39 | "\tonReady: function(){",
40 | "\t\t${3}",
41 | "\t},",
42 | "\tonShow: function(){",
43 | "\t\t${4}",
44 | "\t},",
45 | "\tonHide: function(){",
46 | "\r\n\t},",
47 | "\tonUnload: function(){",
48 | "\r\n\t},",
49 | "\tonPullDownRefresh: function(){",
50 | "\r\n\t},",
51 | "\tonReachBottom: function(){",
52 | "\r\n\t},",
53 | "\tonShareAppMessage: function(){",
54 | "\r\n\t},",
55 | "\tonPageScroll: function(){",
56 | "\r\n\t},",
57 | "\t//item(index,pagePath,text)",
58 | "\tonTabItemTap:function(item){",
59 | "\r\n\t}",
60 | "});"
61 | ],
62 | "description": "Page对象及其生命周期函数和回调函数"
63 | },
64 | "wxComponent": {
65 | "prefix": "wx-Component",
66 | "body": [
67 | "//Component Object",
68 | "Component({",
69 | "\tproperties: {",
70 | "\t\t${1:myProperty}:{",
71 | "\t\t\ttype:${2:String},",
72 | "\t\t\tvalue:${3:''},",
73 | "\t\t\tobserver: function(){${4}}",
74 | "\t\t},",
75 | "\r\n\t},",
76 | "\tdata: {",
77 | "\r\n\t},",
78 | "\tmethods: {",
79 | "\t\t${5}",
80 | "\t},",
81 | "\tcreated: function(){",
82 | "\r\n\t},",
83 | "\tattached: function(){",
84 | "\r\n\t},",
85 | "\tready: function(){",
86 | "\r\n\t},",
87 | "\tmoved: function(){",
88 | "\r\n\t},",
89 | "\tdetached: function(){",
90 | "\r\n\t},",
91 | "});"
92 | ],
93 | "description": "Component对象及其生命周期函数和回调函数"
94 | },
95 | "getCurrentPages": {
96 | "prefix": "getCurrentPages",
97 | "body": [
98 | "${1:var curPages = } getCurrentPages();",
99 | "${2}"
100 | ],
101 | "description": "获取当前页面栈"
102 | },
103 | "getApp": {
104 | "prefix": "getApp",
105 | "body": [
106 | "${1:var appInst = } getApp();",
107 | "${2}"
108 | ],
109 | "description": "获取小程序实例"
110 | },
111 | "wx.request": {
112 | "prefix": "wx-request",
113 | "body": [
114 | "${1:var reqTask = }wx.request({",
115 | "\turl: '${2}',",
116 | "\tdata: {${3}},",
117 | "\theader: {${4:'content-type':'application/json'}},",
118 | "\tmethod: '${5:GET}',",
119 | "\tdataType: '${6:json}',",
120 | "\tresponseType: '${7:text}',",
121 | "\tsuccess: (result)=>{",
122 | "\t\t${8}",
123 | "\t},",
124 | "\tfail: ()=>{},",
125 | "\tcomplete: ()=>{}",
126 | "});"
127 | ],
128 | "description": "发起网络请求"
129 | },
130 | "reqTask.abort": {
131 | "prefix": "reqTask-abort",
132 | "body": [
133 | "reqTask.abort();"
134 | ],
135 | "description": "中断请求任务。"
136 | },
137 |
138 | "wx.uploadFile": {
139 | "prefix": "wx-uploadFile",
140 | "body": [
141 | "${1:var upTask = }wx.uploadFile({",
142 | "\turl: '${2}',",
143 | "\tfilePath: ${3},",
144 | "\tname: ${4},",
145 | "\tformData: {${5}},",
146 | "\tsuccess: (result)=>{",
147 | "\t\t${6}",
148 | "\t},",
149 | "\tfail: ()=>{},",
150 | "\tcomplete: ()=>{}",
151 | "});"
152 | ],
153 | "description": "将本地资源上传到开发者服务器,客户端发起一个 HTTPS POST 请求,其中 content-type 为 multipart/form-data。"
154 | },
155 | "upTask.onProgressUpdate": {
156 | "prefix": "upTask-onProgressUpdate",
157 | "body": [
158 | "upTask.onProgressUpdate((result)=>{",
159 | "\t\t${1}",
160 | "\t});"
161 | ],
162 | "description": "监听上传进度变化事件。"
163 | },
164 | "upTask.abort": {
165 | "prefix": "upTask-abort",
166 | "body": [
167 | "upTask.abort();"
168 | ],
169 | "description": "中断上传任务。"
170 | },
171 | "wx.downloadFile": {
172 | "prefix": "wx-downloadFile",
173 | "body": [
174 | "${1:var downTask = }wx.downloadFile({",
175 | "\turl: '${2}',",
176 | "\tsuccess: (result)=>{",
177 | "\t\t${3}",
178 | "\t},",
179 | "\tfail: ()=>{},",
180 | "\tcomplete: ()=>{}",
181 | "});"
182 | ],
183 | "description": "下载文件资源到本地,客户端直接发起一个HTTP GET请求,返回文件的本地临时路径。"
184 | },
185 | "downTask.onProgressUpdate": {
186 | "prefix": "downTask-onProgressUpdate",
187 | "body": [
188 | "downTask.onProgressUpdate((result)=>{",
189 | "\t\t${1}",
190 | "\t});"
191 | ],
192 | "description": "监听下载进度变化事件。"
193 | },
194 | "downTask.abort": {
195 | "prefix": "downTask-abort",
196 | "body": [
197 | "downTask.abort();"
198 | ],
199 | "description": "中断下载任务。"
200 | },
201 | "wx.connectSocket": {
202 | "prefix": "wx-connectSocket",
203 | "body": [
204 | "${1:var sockTask = }wx.connectSocket({",
205 | "\turl: '${2}',",
206 | "\theader: {${3:'content-type':'application/json'}},",
207 | "\tmethod: '${4:GET}',",
208 | "\tprotocols: [${5}],",
209 | "\tsuccess: ()=>{",
210 | "\t\t${6}",
211 | "\t},",
212 | "\tfail: ()=>{},",
213 | "\tcomplete: ()=>{}",
214 | "});"
215 | ],
216 | "description": "创建一个WebSocket连接。"
217 | },
218 | "wx.onSocketOpen": {
219 | "prefix": "wx-onSocketOpen",
220 | "body": ["wx.onSocketOpen(${1:result} => {",
221 | "\t${2}",
222 | "});"
223 | ],
224 | "description": "监听WebSocket连接打开事件。"
225 | },
226 | "wx.onSocketError": {
227 | "prefix": "wx-onSocketError",
228 | "body": ["wx.onSocketError(${1:result} => {",
229 | "\t${2}",
230 | "});"
231 | ],
232 | "description": "监听WebSocket错误。"
233 | },
234 | "wx.sendSocketMessage": {
235 | "prefix": "wx-sendSocketMessage",
236 | "body": [
237 | "wx.sendSocketMessage({",
238 | "\tdata: ${1},",
239 | "\tsuccess: (result)=>{",
240 | "\t\t${2}",
241 | "\t},",
242 | "\tfail: ()=>{},",
243 | "\tcomplete: ()=>{}",
244 | "});"
245 | ],
246 | "description": "通过WebSocket连接发送数据,需要先wx.connectSocket,并在wx.onSocketOpen回调之后才能发送。"
247 | },
248 | "wx.onSocketMessage": {
249 | "prefix": "wx-onSocketMessage",
250 | "body": ["wx.onSocketMessage((${1:result})=>{${2}});"],
251 | "description": "监听WebSocket接受到服务器的消息事件。"
252 | },
253 | "wx.closeSocket": {
254 | "prefix": "wx-closeSocket",
255 | "body": [
256 | "wx.closeSocket({",
257 | "\tcode: ${1:1000},",
258 | "\treason: '${2}',",
259 | "\tsuccess: (result)=>{",
260 | "\t\t${3}",
261 | "\t},",
262 | "\tfail: ()=>{},",
263 | "\tcomplete: ()=>{}",
264 | "});"
265 | ],
266 | "description": "关闭WebSocket连接。"
267 | },
268 | "wx.onSocketClose": {
269 | "prefix": "wx-onSocketClose",
270 | "body": ["wx.onSocketClose((${1:result})=>{",
271 | "\t${2}",
272 | "});"
273 | ],
274 | "description": "监听WebSocket关闭。"
275 | },
276 | "sockTask.send": {
277 | "prefix": "sockTask-send",
278 | "body": [
279 | "sockTask.send({",
280 | "\tdata: ${1},",
281 | "\tsuccess: (result)=>{",
282 | "\t\t${2}",
283 | "\t},",
284 | "\tfail: ()=>{},",
285 | "\tcomplete: ()=>{}",
286 | "});"
287 | ],
288 | "description": "通过WebSocket连接发送数据。"
289 | },
290 | "sockTask.close": {
291 | "prefix": "sockTask-close",
292 | "body": [
293 | "sockTask.close({",
294 | "\tcode: ${1},",
295 | "\treason: ${2},",
296 | "\tsuccess: (result)=>{",
297 | "\t\t${3}",
298 | "\t},",
299 | "\tfail: ()=>{},",
300 | "\tcomplete: ()=>{}",
301 | "});"
302 | ],
303 | "description": "关闭WebSocket连接。"
304 | },
305 | "sockTask.onOpen": {
306 | "prefix": "sockTask-onOpen",
307 | "body": [
308 | "sockTask.onOpen(${1:result} => {",
309 | "\t${2}",
310 | "});"
311 | ],
312 | "description": "监听WebSocket连接打开事件。"
313 | },
314 | "sockTask.onClose": {
315 | "prefix": "sockTask-onClose",
316 | "body": [
317 | "sockTask.onClose(${1:result} => {",
318 | "\t${2}",
319 | "});"
320 | ],
321 | "description": "监听 WebSocket 连接关闭事件。"
322 | },
323 | "sockTask.onError": {
324 | "prefix": "sockTask-onError",
325 | "body": [
326 | "sockTask.onError(${1:result} => {",
327 | "\t${2}",
328 | "});"
329 | ],
330 | "description": "监听 WebSocket 错误。"
331 | },
332 | "sockTask.onMessage": {
333 | "prefix": "sockTask-onMessage",
334 | "body": [
335 | "sockTask.onMessage(${1:result} => {",
336 | "\t${2}",
337 | "});"
338 | ],
339 | "description": "监听WebSocket接受到服务器的消息事件。"
340 | },
341 | "wx.chooseImage": {
342 | "prefix": "wx-chooseImage",
343 | "body": [
344 | "wx.chooseImage({",
345 | "\tcount: ${1:9},",
346 | "\tsizeType: ${2:['original','compressed']},",
347 | "\tsourceType: ${3:['album','camera']},",
348 | "\tsuccess: (result)=>{",
349 | "\t\t${4}",
350 | "\t},",
351 | "\tfail: ()=>{},",
352 | "\tcomplete: ()=>{}",
353 | "});"
354 | ],
355 | "description": "从本地相册选择图片或使用相机拍照。"
356 | },
357 | "wx.previewImage": {
358 | "prefix": "wx-previewImage",
359 | "body": [
360 | "wx.previewImage({",
361 | "\tcurrent: '${1}',",
362 | "\turls: [${2}],",
363 | "\tsuccess: (result)=>{",
364 | "\t\t${3}",
365 | "\t},",
366 | "\tfail: ()=>{},",
367 | "\tcomplete: ()=>{}",
368 | "});"
369 | ],
370 | "description": "预览图片。"
371 | },
372 | "wx.getImageInfo": {
373 | "prefix": "wx-getImageInfo",
374 | "body": [
375 | "wx.getImageInfo({",
376 | "\tsrc: ${1},",
377 | "\tsuccess: (result)=>{",
378 | "\t\t${2}",
379 | "\t},",
380 | "\tfail: ()=>{},",
381 | "\tcomplete: ()=>{}",
382 | "});"
383 | ],
384 | "description": "获取图片信息,倘若为网络图片,需先配置download域名才能生效。"
385 | },
386 | "wx.saveImageToPhotosAlbum": {
387 | "prefix": "wx-saveImageToPhotosAlbum",
388 | "body": [
389 | "wx.saveImageToPhotosAlbum({",
390 | "\tfilePath: ${1},",
391 | "\tsuccess: (result)=>{",
392 | "\t\t${2}",
393 | "\t},",
394 | "\tfail: ()=>{},",
395 | "\tcomplete: ()=>{}",
396 | "});"
397 | ],
398 | "description": "保存图片到系统相册。需要用户授权 scope.writePhotosAlbum"
399 | },
400 | "wx.startRecord": {
401 | "prefix": "wx-startRecord",
402 | "body": ["wx.startRecord({",
403 | "\tsuccess: (result)=>{",
404 | "\t\t${1}",
405 | "\t},",
406 | "\tfail: ()=>{},",
407 | "\tcomplete: ()=>{}",
408 | "});"
409 | ],
410 | "description": "开始录音。需要用户授权 scope.record。1.6.0 起不再维护"
411 | },
412 | "wx.stopRecord": {
413 | "prefix": "wx-stopRecord",
414 | "body": ["wx.stopRecord();"],
415 | "description": "停止录音。1.6.0 起不再维护"
416 | },
417 | "wx.getRecorderManager": {
418 | "prefix": "wx-getRecorderManager",
419 | "body": ["${1:var recordManager = }wx.getRecorderManager();"],
420 | "description": "获取全局唯一的录音管理器recorderManager。"
421 | },
422 | "recordManager.start": {
423 | "prefix": "recordManager-start",
424 | "body": [
425 | "recordManager.start({",
426 | "\tduration: ${1},",
427 | "\tsampleRate: ${2:44100},",
428 | "\tnumberOfChannels: ${3:2},",
429 | "\tformat: ${4:'aac'}",
430 | "});"
431 | ],
432 | "description": "开始录音"
433 | },
434 | "recordManager.pause": {
435 | "prefix": "recordManager-pause",
436 | "body": ["recordManager.pause();"],
437 | "description": "暂停录音"
438 | },
439 | "recordManager.resume": {
440 | "prefix": "recordManager-resume",
441 | "body": ["recordManager.resume();"],
442 | "description": "恢复录音"
443 | },
444 | "recordManager.stop": {
445 | "prefix": "recordManager-stop",
446 | "body": ["recordManager.stop();"],
447 | "description": "停止录音"
448 | },
449 | "recordManager.onStart": {
450 | "prefix": "recordManager-onStart",
451 | "body": ["recordManager.onStart((${1})=>{",
452 | "\t${2}",
453 | "});"
454 | ],
455 | "description": "录音开始事件"
456 | },
457 | "recordManager.onPause": {
458 | "prefix": "recordManager-onPause",
459 | "body": ["recordManager.onPause((${1})=>{",
460 | "\t${2}",
461 | "});"
462 | ],
463 | "description": "录音暂停事件"
464 | },
465 | "recordManager.onStop": {
466 | "prefix": "recordManager-onStop",
467 | "body": ["recordManager.onStop((${1:result})=>{",
468 | "\t${2}",
469 | "});"
470 | ],
471 | "description": "录音停止事件,会回调文件地址"
472 | },
473 | "recordManager.onFrameRecorded": {
474 | "prefix": "recordManager-onFrameRecorded",
475 | "body": ["recordManager.onFrameRecorded((${1:result})=>{",
476 | "\t${2}",
477 | "});"
478 | ],
479 | "description": "已录制完指定帧大小的文件,会回调录音分片结果数据"
480 | },
481 | "recordManager.onError": {
482 | "prefix": "recordManager-onError",
483 | "body": ["recordManager.onError((${1:errMsg})=>{",
484 | "\t${2}",
485 | "});"
486 | ],
487 | "description": "录音错误事件, 会回调错误信息"
488 | },
489 | "wx.playVoice": {
490 | "prefix": "wx-playVoice",
491 | "body": ["wx.playVoice({",
492 | "\tfilePath: '${1}',",
493 | "\tduration: ${2:60},",
494 | "\tsuccess: (result)=>{",
495 | "\t\t${3}",
496 | "\t},",
497 | "\tfail: ()=>{},",
498 | "\tcomplete: ()=>{}",
499 | "});"
500 | ],
501 | "description": "开始播放语音,同时只允许一个语音文件正在播放,如果前一个语音文件还没播放完,将中断前一个语音播放。1.6.0 起不再维护"
502 | },
503 | "wx.pauseVoice": {
504 | "prefix": "wx-pauseVoice",
505 | "body": ["wx.pauseVoice();"],
506 | "description": "暂停正在播放的语音。1.6.0 起不再维护"
507 | },
508 | "wx.stopVoice": {
509 | "prefix": "wx-stopVoice",
510 | "body": ["wx.stopVoice();"],
511 | "description": "结束播放语音。1.6.0 起不再维护"
512 | },
513 | "wx.getBackgroundAudioPlayerState": {
514 | "prefix": "wx-getBackgroundAudioPlayerState",
515 | "body": ["wx.getBackgroundAudioPlayerState({",
516 | "\tsuccess: (result)=>{",
517 | "\t\t${1}",
518 | "\t},",
519 | "\tfail: ()=>{},",
520 | "\tcomplete: ()=>{}",
521 | "});"
522 | ],
523 | "description": "获取后台音乐播放状态。1.2.0 起不再维护"
524 | },
525 | "wx.playBackgroundAudio": {
526 | "prefix": "wx-playBackgroundAudio",
527 | "body": ["wx.playBackgroundAudio({",
528 | "\tdataUrl: '${1}',",
529 | "\ttitle: '${2}',",
530 | "\tcoverImgUrl: '${3}',",
531 | "\tsuccess: (result)=>{",
532 | "\t\t${4}",
533 | "\t},",
534 | "\tfail: ()=>{},",
535 | "\tcomplete: ()=>{}",
536 | "});"
537 | ],
538 | "description": "使用后台播放器播放音乐,对于微信客户端来说,只能同时有一个后台音乐在播放。1.2.0 起不再维护"
539 | },
540 | "wx.pauseBackgroundAudio": {
541 | "prefix": "wx-pauseBackgroundAudio",
542 | "body": ["wx.playBackgroundAudio();"],
543 | "description": "暂停播放音乐。1.2.0 起不再维护"
544 | },
545 | "wx.seekBackgroundAudio": {
546 | "prefix": "wx-seekBackgroundAudio",
547 | "body": ["wx.seekBackgroundAudio({",
548 | "\tposition: '${1}',",
549 | "\tsuccess: (result)=>{",
550 | "\t\t${2}",
551 | "\t},",
552 | "\tfail: ()=>{},",
553 | "\tcomplete: ()=>{}",
554 | "});"
555 | ],
556 | "description": "控制音乐播放进度(秒)。1.2.0 起不再维护"
557 | },
558 | "wx.stopBackgroundAudio": {
559 | "prefix": "wx-stopBackgroundAudio",
560 | "body": ["wx.stopBackgroundAudio();"],
561 | "description": "停止播放音乐。1.2.0 起不再维护"
562 | },
563 | "wx.onBackgroundAudioPlay": {
564 | "prefix": "wx-onBackgroundAudioPlay",
565 | "body": ["wx.onBackgroundAudioPlay((${1:result})=>{${2}});"],
566 | "description": "监听音乐播放。1.2.0 起不再维护"
567 | },
568 | "wx.onBackgroundAudioPause": {
569 | "prefix": "wx-onBackgroundAudioPause",
570 | "body": ["wx.onBackgroundAudioPause((${1:result})=>{${2}});"],
571 | "description": "监听音乐暂停。1.2.0 起不再维护"
572 | },
573 | "wx.onBackgroundAudioStop": {
574 | "prefix": "wx-onBackgroundAudioStop",
575 | "body": ["wx.onBackgroundAudioStop((${1:result})=>{${2}});"],
576 | "description": "监听音乐停止。1.2.0 起不再维护"
577 | },
578 | "wx.getBackgroundAudioManager": {
579 | "prefix": "wx-getBackgroundAudioManager",
580 | "body": [
581 | "// properties(Read only)(duration,currentTime,paused,buffered)",
582 | "// properties(src(m4a, aac, mp3, wav),startTime,title,epname,singer,coverImgUrl,webUrl,protocol)",
583 | "${1:var backAudioManager = }wx.getBackgroundAudioManager();"
584 | ],
585 | "description": "获取全局唯一的背景音频管理器 backgroundAudioManager。"
586 | },
587 | "backAudioManager.src": {
588 | "prefix": "backAudioManager-src",
589 | "body": ["backAudioManager.src = ${1};"],
590 | "description": "音频的数据源,默认为空字符串,当设置了新的 src 时,会自动开始播放 ,目前支持的格式有 m4a, aac, mp3, wav。"
591 | },
592 | "backAudioManager.play": {
593 | "prefix": "backAudioManager-play",
594 | "body": ["backAudioManager.play();"],
595 | "description": "播放"
596 | },
597 | "backAudioManager.pause": {
598 | "prefix": "backAudioManager-pause",
599 | "body": ["backAudioManager.pause();"],
600 | "description": "暂停"
601 | },
602 | "backAudioManager.stop": {
603 | "prefix": "backAudioManager-stop",
604 | "body": ["backAudioManager.stop();"],
605 | "description": "停止"
606 | },
607 | "backAudioManager.seek": {
608 | "prefix": "backAudioManager-seek",
609 | "body": ["backAudioManager.seek(${1});"],
610 | "description": "跳转到指定位置,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度。"
611 | },
612 | "backAudioManager.onCanplay": {
613 | "prefix": "backAudioManager-onCanplay",
614 | "body": ["backAudioManager.onCanplay(${1:()=>{",
615 | "\t\t${2}",
616 | "\t}});"
617 | ],
618 | "description": "背景音频进入可以播放状态,但不保证后面可以流畅播放"
619 | },
620 | "backAudioManager.onPlay": {
621 | "prefix": "backAudioManager-onPlay",
622 | "body": ["backAudioManager.onPlay(()=>{",
623 | "\t${1}",
624 | "});"
625 | ],
626 | "description": "背景音频播放事件"
627 | },
628 | "backAudioManager.onPause": {
629 | "prefix": "backAudioManager-onPause",
630 | "body": ["backAudioManager.onPause(()=>{",
631 | "\t${1}",
632 | "});"
633 | ],
634 | "description": "背景音频暂停事件"
635 | },
636 | "backAudioManager.onStop": {
637 | "prefix": "backAudioManager-onStop",
638 | "body": ["backAudioManager.onStop(()=>{",
639 | "\t${1}",
640 | "});"
641 | ],
642 | "description": "背景音频停止事件"
643 | },
644 | "backAudioManager.onEnded": {
645 | "prefix": "backAudioManager-onEnded",
646 | "body": ["backAudioManager.onEnded(()=>{",
647 | "\t${1}",
648 | "});"
649 | ],
650 | "description": "背景音频自然播放结束事件"
651 | },
652 | "backAudioManager.onTimeUpdate": {
653 | "prefix": "backAudioManager-onTimeUpdate",
654 | "body": ["backAudioManager.onTimeUpdate((${1})=>{",
655 | "\t${2}",
656 | "});"
657 | ],
658 | "description": "背景音频播放进度更新事件"
659 | },
660 | "backAudioManager.onPrev": {
661 | "prefix": "backAudioManager-onPrev",
662 | "body": ["backAudioManager.onPrev((${1})=>{",
663 | "\t${2}",
664 | "});"
665 | ],
666 | "description": "用户在系统音乐播放面板点击上一曲事件(iOS only)"
667 | },
668 | "backAudioManager.onNext": {
669 | "prefix": "backAudioManager-onNext",
670 | "body": ["backAudioManager.onNext((${1})=>{",
671 | "\t${2}",
672 | "});"
673 | ],
674 | "description": "用户在系统音乐播放面板点击下一曲事件(iOS only)"
675 | },
676 | "backAudioManager.onError": {
677 | "prefix": "backAudioManager-onError",
678 | "body": ["backAudioManager.onError((${1:errMsg})=>{",
679 | "\t${2}",
680 | "});"
681 | ],
682 | "description": "背景音频播放错误事件"
683 | },
684 | "backAudioManager.onWaiting": {
685 | "prefix": "backAudioManager-onWaiting",
686 | "body": ["backAudioManager.onWaiting((${1})=>{",
687 | "\t${2}",
688 | "});"
689 | ],
690 | "description": "音频加载中事件,当音频因为数据不足,需要停下来加载时会触发"
691 | },
692 | "wx.createAudioContext": {
693 | "prefix": "wx-createAudioContext",
694 | "body": [
695 | "${1:var audioContext = }wx.createAudioContext(${2}, this);"
696 | ],
697 | "description": "创建并返回audio上下文audioContext对象。在自定义组件下,第二个参数传入组件实例this,以操作组件内组件。1.6.0 起不再维护"
698 | },
699 | "audioContext.setSrc": {
700 | "prefix": "audioContext-setSrc",
701 | "body": ["audioContext.setSrc('${1}');"],
702 | "description": "设置音频的地址。1.6.0 起不再维护"
703 | },
704 | "audioContext.play": {
705 | "prefix": "audioContext-play",
706 | "body": ["audioContext.play();"],
707 | "description": "播放。1.6.0 起不再维护"
708 | },
709 | "audioContext.pause": {
710 | "prefix": "audioContext-pause",
711 | "body": ["audioContext.pause();"],
712 | "description": "暂停。1.6.0 起不再维护"
713 | },
714 | "audioContext.seek": {
715 | "prefix": "audioContext-seek",
716 | "body": ["audioContext.seek(${1});"],
717 | "description": "跳转到指定位置,单位 s。1.6.0 起不再维护"
718 | },
719 | "wx.createInnerAudioContext": {
720 | "prefix": "wx-createInnerAudioContext",
721 | "body": [
722 | "// properties(Read only)(duration,currentTime,paused,buffered,volume)",
723 | "// properties(src,startTime,autoplay,loop,obeyMuteSwitch)",
724 | "${1:var innerAudioContext = }wx.createInnerAudioContext();"
725 | ],
726 | "description": "创建并返回内部 audio 上下文 innerAudioContext 对象。本接口是 wx.createAudioContext 升级版。1.6.0 开始支持"
727 | },
728 | "innerAudioContext.play": {
729 | "prefix": "innerAudioContext-play",
730 | "body": ["innerAudioContext.play();"],
731 | "description": "播放"
732 | },
733 | "innerAudioContext.pause": {
734 | "prefix": "innerAudioContext-pause",
735 | "body": ["innerAudioContext.pause();"],
736 | "description": "暂停"
737 | },
738 | "innerAudioContext.stop": {
739 | "prefix": "innerAudioContext-stop",
740 | "body": ["innerAudioContext.stop();"],
741 | "description": "停止"
742 | },
743 | "innerAudioContext.seek": {
744 | "prefix": "innerAudioContext-seek",
745 | "body": ["innerAudioContext.seek(${1});"],
746 | "description": "跳转到指定位置,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度"
747 | },
748 | "innerAudioContext.destroy": {
749 | "prefix": "innerAudioContext-destroy",
750 | "body": ["innerAudioContext.destroy();"],
751 | "description": "销毁当前实例"
752 | },
753 | "innerAudioContext.onCanplay": {
754 | "prefix": "innerAudioContext-onCanplay",
755 | "body": ["innerAudioContext.onCanplay(()=>{${1}});"],
756 | "description": "音频进入可以播放状态,但不保证后面可以流畅播放"
757 | },
758 | "innerAudioContext.onPlay": {
759 | "prefix": "innerAudioContext-onPlay",
760 | "body": ["innerAudioContext.onPlay((${1})=>{",
761 | "\t${2}",
762 | "});"
763 | ],
764 | "description": "音频播放事件"
765 | },
766 | "innerAudioContext.onPause": {
767 | "prefix": "innerAudioContext-onPause",
768 | "body": ["innerAudioContext.onPause((${1})=>{",
769 | "\t${2}",
770 | "});"
771 | ],
772 | "description": "音频暂停播放事件"
773 | },
774 | "innerAudioContext.onStop": {
775 | "prefix": "innerAudioContext-onStop",
776 | "body": ["innerAudioContext.onStop((${1})=>{",
777 | "\t${2}",
778 | "});"
779 | ],
780 | "description": "音频停止播放事件"
781 | },
782 | "innerAudioContext.onEnded": {
783 | "prefix": "innerAudioContext-onEnded",
784 | "body": ["innerAudioContext.onEnded((${1})=>{",
785 | "\t${2}",
786 | "});"
787 | ],
788 | "description": "音频自然播放结束事件"
789 | },
790 | "innerAudioContext.onTimeUpdate": {
791 | "prefix": "innerAudioContext-onTimeUpdate",
792 | "body": ["innerAudioContext.onTimeUpdate((${1})=>{",
793 | "\t${2}",
794 | "});"
795 | ],
796 | "description": "音频播放进度更新事件"
797 | },
798 | "innerAudioContext.onError": {
799 | "prefix": "innerAudioContext-onError",
800 | "body": ["innerAudioContext.onError((${1:errMsg})=>{",
801 | "\t${2}",
802 | "});"
803 | ],
804 | "description": "音频播放错误事件"
805 | },
806 | "innerAudioContext.onWaiting": {
807 | "prefix": "innerAudioContext-onWaiting",
808 | "body": ["innerAudioContext.onWaiting((${1})=>{",
809 | "\t${2}",
810 | "});"
811 | ],
812 | "description": "音频加载中事件,当音频因为数据不足,需要停下来加载时会触发"
813 | },
814 | "innerAudioContext.onSeeking": {
815 | "prefix": "innerAudioContext-onSeeking",
816 | "body": ["innerAudioContext.onSeeking((${1})=>{",
817 | "\t${2}",
818 | "});"
819 | ],
820 | "description": "音频进行seek操作事件"
821 | },
822 | "innerAudioContext.onSeeked": {
823 | "prefix": "innerAudioContext-onSeeked",
824 | "body": ["innerAudioContext.onSeeked((${1})=>{",
825 | "\t${2}",
826 | "});"
827 | ],
828 | "description": "音频完成seek操作事件"
829 | },
830 |
831 | "innerAudioContext.offCanplay": {
832 | "prefix": "innerAudioContext-offCanplay",
833 | "body": ["innerAudioContext.offCanplay((${1})=>{",
834 | "\t${2}",
835 | "});"
836 | ],
837 | "description": "取消监听onCanplay事件"
838 | },
839 | "innerAudioContext.offPlay": {
840 | "prefix": "innerAudioContext-offPlay",
841 | "body": ["innerAudioContext.offPlay((${1})=>{",
842 | "\t${2}",
843 | "});"
844 | ],
845 | "description": "取消监听onPlay事件"
846 | },
847 | "innerAudioContext.offStop": {
848 | "prefix": "innerAudioContext-offStop",
849 | "body": ["innerAudioContext.offStop((${1})=>{",
850 | "\t${2}",
851 | "});"
852 | ],
853 | "description": "取消监听onStop事件"
854 | },
855 | "innerAudioContext.offEnded": {
856 | "prefix": "innerAudioContext-offEnded",
857 | "body": ["innerAudioContext.offEnded((${1})=>{",
858 | "\t${2}",
859 | "});"
860 | ],
861 | "description": "取消监听onEnded事件"
862 | },
863 | "innerAudioContext.offTimeUpdate": {
864 | "prefix": "innerAudioContext-offTimeUpdate",
865 | "body": ["innerAudioContext.offTimeUpdate((${1})=>{",
866 | "\t${2}",
867 | "});"
868 | ],
869 | "description": "取消监听onTimeUpdate事件"
870 | },
871 | "innerAudioContext.offError": {
872 | "prefix": "innerAudioContext-offError",
873 | "body": ["innerAudioContext.offError((${1})=>{",
874 | "\t${2}",
875 | "});"
876 | ],
877 | "description": "取消监听onError事件"
878 | },
879 | "innerAudioContext.offWaiting": {
880 | "prefix": "innerAudioContext-offWaiting",
881 | "body": ["innerAudioContext.offWaiting((${1})=>{",
882 | "\t${2}",
883 | "});"
884 | ],
885 | "description": "取消监听onWaiting事件"
886 | },
887 | "innerAudioContext.offSeeking": {
888 | "prefix": "innerAudioContext-offSeeking",
889 | "body": ["innerAudioContext.offSeeking((${1})=>{",
890 | "\t${2}",
891 | "});"
892 | ],
893 | "description": "取消监听onSeeking事件"
894 | },
895 | "innerAudioContext.offSeeked": {
896 | "prefix": "innerAudioContext-offSeeked",
897 | "body": ["innerAudioContext.offSeeked((${1})=>{",
898 | "\t${2}",
899 | "});"
900 | ],
901 | "description": "取消监听onSeeked事件"
902 | },
903 | "wx.getAvailableAudioSources": {
904 | "prefix": "wx-getAvailableAudioSources",
905 | "body": ["wx.getAvailableAudioSources({",
906 | "\tsuccess: (result)=>{",
907 | "\t\t${1}",
908 | "\t},",
909 | "\tfail: ()=>{},",
910 | "\tcomplete: ()=>{}",
911 | "});"
912 | ],
913 | "description": "获取当前支持的音频输入源"
914 | },
915 |
916 | "wx.chooseVideo": {
917 | "prefix": "wx-chooseVideo",
918 | "body": [
919 | "wx.chooseVideo({",
920 | "\tsourceType:['album', 'camera'],",
921 | "\tcompressed: ${1:true},",
922 | "\tmaxDuration:${2:15},",
923 | "\tsuccess: (result)=>{",
924 | "\t\t${3}",
925 | "\t},",
926 | "\tfail: ()=>{},",
927 | "\tcomplete: ()=>{}",
928 | "});"
929 | ],
930 | "description": "拍摄视频或从手机相册中选视频,返回视频的临时文件路径。"
931 | },
932 | "wx.saveVideoToPhotosAlbum": {
933 | "prefix": "wx-saveVideoToPhotosAlbum",
934 | "body": [
935 | "wx.saveVideoToPhotosAlbum({",
936 | "\tfilePath: '${1}',",
937 | "\tsuccess: (result)=>{",
938 | "\t\t${2}",
939 | "\t},",
940 | "\tfail: ()=>{},",
941 | "\tcomplete: ()=>{}",
942 | "});"
943 | ],
944 | "description": "保存视频到系统相册。需要用户授权 scope.writePhotosAlbum"
945 | },
946 |
947 |
948 | "wx.createVideoContext": {
949 | "prefix": "wx-createVideoContext",
950 | "body": [
951 | "${1:var videoContext = }wx.createVideoContext('${2:video}'${3:, this});"
952 | ],
953 | "description": "创建并返回 video 上下文 videoContext 对象。在自定义组件下,第二个参数传入组件实例this,以操作组件内 组件"
954 | },
955 | "videoContext.play": {
956 | "prefix": "videoContext-play",
957 | "body": ["videoContext.play();"],
958 | "description": "播放"
959 | },
960 | "videoContext.pause": {
961 | "prefix": "videoContext-pause",
962 | "body": ["videoContext.pause();"],
963 | "description": "暂停"
964 | },
965 | "videoContext.stop": {
966 | "prefix": "videoContext-stop",
967 | "body": ["videoContext.stop();"],
968 | "description": "停止"
969 | },
970 | "videoContext.seek": {
971 | "prefix": "videoContext-seek",
972 | "body": ["videoContext.seek(${1});"],
973 | "description": "跳转到指定位置,单位 s"
974 | },
975 | "videoContext.sendDanmu": {
976 | "prefix": "videoContext-sendDanmu",
977 | "body": [
978 | "videoContext.sendDanmu({",
979 | "\ttext: ${1},",
980 | "\tcolor: ${2}",
981 | "});"
982 | ],
983 | "description": "发送弹幕,包含两个属性 text, color。"
984 | },
985 | "videoContext.playbackRate": {
986 | "prefix": "videoContext-playbackRate",
987 | "body": ["videoContext.playbackRate(${1});"],
988 | "description": "设置倍速播放,支持的倍率有 0.5/0.8/1.0/1.25/1.5"
989 | },
990 | "videoContext.requestFullScreen": {
991 | "prefix": "videoContext-requestFullScreen",
992 | "body": [
993 | "videoContext.requestFullScreen({",
994 | "\tdirection: ${1:0}",
995 | "});"
996 | ],
997 | "description": "进入全屏,可传入{direction}参数, 有效值为 0, 90,-90"
998 | },
999 | "videoContext.exitFullScreen": {
1000 | "prefix": "videoContext-exitFullScreen",
1001 | "body": ["videoContext.exitFullScreen();"],
1002 | "description": "退出全屏"
1003 | },
1004 | "videoContext.showStatusBar": {
1005 | "prefix": "videoContext-showStatusBar",
1006 | "body": ["videoContext.showStatusBar();"],
1007 | "description": "显示状态栏,仅在iOS全屏下有效"
1008 | },
1009 | "videoContext.hideStatusBar": {
1010 | "prefix": "videoContext-hideStatusBar",
1011 | "body": ["videoContext.hideStatusBar();"],
1012 | "description": "隐藏状态栏,仅在iOS全屏下有效"
1013 | },
1014 | "wx.createCameraContext": {
1015 | "prefix": "wx-createCameraContext",
1016 | "body": [
1017 | "${1:var cameraContext = }wx.createCameraContext(${2:this});"
1018 | ],
1019 | "description": "创建并返回 camera 上下文 cameraContext 对象,cameraContext 与页面的 camera 组件绑定,一个页面只能有一个camera,通过它可以操作对应的 组件。1.6.0 开始支持"
1020 | },
1021 | "cameraContext.takePhoto": {
1022 | "prefix": "cameraContext-takePhoto",
1023 | "body": [
1024 | "cameraContext.takePhoto({",
1025 | "\tquality: ${1:normal},",
1026 | "\tsuccess: (result)=>{",
1027 | "\t\t${2}",
1028 | "\t},",
1029 | "\tfail: ()=>{},",
1030 | "\tcomplete: ()=>{}",
1031 | "});"
1032 | ],
1033 | "description": "拍照,可指定质量(high, normal, low,默认normal),成功则返回图片"
1034 | },
1035 | "cameraContext.startRecord": {
1036 | "prefix": "cameraContext-startRecord",
1037 | "body": [
1038 | "cameraContext.startRecord({",
1039 | "\tsuccess: (result)=>{",
1040 | "\t\t${1}",
1041 | "\t},",
1042 | "\tfail: ()=>{},",
1043 | "\tcomplete: ()=>{}",
1044 | "\ttimeoutCallback: (result)=>{",
1045 | "\t\t${2}",
1046 | "\t},",
1047 | "});"
1048 | ],
1049 | "description": "开始录像"
1050 | },
1051 | "cameraContext.stopRecord": {
1052 | "prefix": "cameraContext-stopRecord",
1053 | "body": [
1054 | "cameraContext.stopRecord({",
1055 | "\tsuccess: (result)=>{",
1056 | "\t\t${1}",
1057 | "\t},",
1058 | "\tfail: ()=>{},",
1059 | "\tcomplete: ()=>{}",
1060 | "});"
1061 | ],
1062 | "description": "结束录像,成功则返回封面与视频"
1063 | },
1064 |
1065 |
1066 | "wx.createLivePlayerContext": {
1067 | "prefix": "wx-createLivePlayerContext",
1068 | "body": [
1069 | "${1:var livePlayerContext = }wx.createLivePlayerContext('${2:live-player}'${3:, this})"
1070 | ],
1071 | "description": "操作对应的 组件。 创建并返回 live-player 上下文 LivePlayerContext 对象。在自定义组件下,第二个参数传入组件实例this,以操作组件内 组件。"
1072 | },
1073 | "livePlayerContext.play": {
1074 | "prefix": "livePlayerContext-play",
1075 | "body": ["livePlayerContext.play({",
1076 | "\tsuccess: (result)=>{",
1077 | "\t\t${1}",
1078 | "\t},",
1079 | "\tfail: ()=>{},",
1080 | "\tcomplete: ()=>{}",
1081 | "});"
1082 | ],
1083 | "description": "播放"
1084 | },
1085 | "livePlayerContext.stop": {
1086 | "prefix": "livePlayerContext-stop",
1087 | "body": ["livePlayerContext.stop({",
1088 | "\tsuccess: (result)=>{",
1089 | "\t\t${1}",
1090 | "\t},",
1091 | "\tfail: ()=>{},",
1092 | "\tcomplete: ()=>{}",
1093 | "});"
1094 | ],
1095 | "description": "停止"
1096 | },
1097 | "livePlayerContext.mute": {
1098 | "prefix": "livePlayerContext-mute",
1099 | "body": ["livePlayerContext.mute({",
1100 | "\tsuccess: (result)=>{",
1101 | "\t\t${1}",
1102 | "\t},",
1103 | "\tfail: ()=>{},",
1104 | "\tcomplete: ()=>{}",
1105 | "});"
1106 | ],
1107 | "description": "静音"
1108 | },
1109 | "livePlayerContext.pause": {
1110 | "prefix": "livePlayerContext-pause",
1111 | "body": ["livePlayerContext.pause({",
1112 | "\tsuccess: (result)=>{",
1113 | "\t\t${1}",
1114 | "\t},",
1115 | "\tfail: ()=>{},",
1116 | "\tcomplete: ()=>{}",
1117 | "});"
1118 | ],
1119 | "description": "暂停"
1120 | },
1121 | "livePlayerContext.resume": {
1122 | "prefix": "livePlayerContext-resume",
1123 | "body": ["livePlayerContext.resume({",
1124 | "\tsuccess: (result)=>{",
1125 | "\t\t${1}",
1126 | "\t},",
1127 | "\tfail: ()=>{},",
1128 | "\tcomplete: ()=>{}",
1129 | "});"
1130 | ],
1131 | "description": "恢复"
1132 | },
1133 | "livePlayerContext.requestFullScreen": {
1134 | "prefix": "livePlayerContext-requestFullScreen",
1135 | "body": [
1136 | "livePlayerContext.requestFullScreen({",
1137 | "\tdirection: ${1:0},",
1138 | "\tsuccess: (result)=>{",
1139 | "\t\t${2}",
1140 | "\t},",
1141 | "\tfail: ()=>{},",
1142 | "\tcomplete: ()=>{}",
1143 | "});"
1144 | ],
1145 | "description": "进入全屏"
1146 | },
1147 | "livePlayerContext.exitFullScreen": {
1148 | "prefix": "livePlayerContext-exitFullScreen",
1149 | "body": [
1150 | "livePlayerContext.exitFullScreen({",
1151 | "\tsuccess: (result)=>{",
1152 | "\t\t${1}",
1153 | "\t},",
1154 | "\tfail: ()=>{},",
1155 | "\tcomplete: ()=>{}",
1156 | "});"
1157 | ],
1158 | "description": "退出全屏"
1159 | },
1160 | "wx.createLivePusherContext": {
1161 | "prefix": "wx-createLivePusherContext",
1162 | "body": [
1163 | "${1:var livePusherContext = }wx.createLivePusherContext('${2:live-pusher}'${3:, this})"
1164 | ],
1165 | "description": "创建并返回 live-pusher 上下文 LivePusherContext 对象,LivePusherContext 与页面的 组件绑定,一个页面只能有一个 live-pusher,通过它可以操作对应的 组件。 在自定义组件下,第一个参数传入组件实例this,以操作组件内 组件。"
1166 | },
1167 | "livePusherContext.play": {
1168 | "prefix": "livePusherContext-play",
1169 | "body": ["livePusherContext.play({",
1170 | "\tsuccess: (result)=>{",
1171 | "\t\t${1}",
1172 | "\t},",
1173 | "\tfail: ()=>{},",
1174 | "\tcomplete: ()=>{}",
1175 | "});"
1176 | ],
1177 | "description": "播放推流"
1178 | },
1179 | "livePusherContext.stop": {
1180 | "prefix": "livePusherContext-stop",
1181 | "body": ["livePusherContext.stop({",
1182 | "\tsuccess: (result)=>{",
1183 | "\t\t${1}",
1184 | "\t},",
1185 | "\tfail: ()=>{},",
1186 | "\tcomplete: ()=>{}",
1187 | "});"
1188 | ],
1189 | "description": "停止推流"
1190 | },
1191 | "livePusherContext.pause": {
1192 | "prefix": "livePusherContext-pause",
1193 | "body": ["livePusherContext.pause({",
1194 | "\tsuccess: (result)=>{",
1195 | "\t\t${1}",
1196 | "\t},",
1197 | "\tfail: ()=>{},",
1198 | "\tcomplete: ()=>{}",
1199 | "});"
1200 | ],
1201 | "description": "暂停推流"
1202 | },
1203 | "livePusherContext.resume": {
1204 | "prefix": "livePusherContext-resume",
1205 | "body": ["livePusherContext.resume({",
1206 | "\tsuccess: (result)=>{",
1207 | "\t\t${1}",
1208 | "\t},",
1209 | "\tfail: ()=>{},",
1210 | "\tcomplete: ()=>{}",
1211 | "});"
1212 | ],
1213 | "description": "恢复推流"
1214 | },
1215 | "livePusherContext.switchCamera": {
1216 | "prefix": "livePusherContext-switchCamera",
1217 | "body": [
1218 | "livePusherContext.switchCamera({",
1219 | "\tsuccess: (result)=>{",
1220 | "\t\t${1}",
1221 | "\t},",
1222 | "\tfail: ()=>{},",
1223 | "\tcomplete: ()=>{}",
1224 | "});"
1225 | ],
1226 | "description": "切换前后摄像头"
1227 | },
1228 | "livePusherContext.snapshot": {
1229 | "prefix": "livePusherContext-snapshot",
1230 | "body": [
1231 | "livePusherContext.snapshot({",
1232 | "\tsuccess: (result)=>{",
1233 | "\t\t${1}",
1234 | "\t},",
1235 | "\tfail: ()=>{},",
1236 | "\tcomplete: ()=>{}",
1237 | "});"
1238 | ],
1239 | "description": "快照"
1240 | },
1241 | "livePusherContext.toggleTorch": {
1242 | "prefix": "livePusherContext-toggleTorch",
1243 | "body": [
1244 | "livePusherContext.toggleTorch({",
1245 | "\tsuccess: (result)=>{",
1246 | "\t\t${1}",
1247 | "\t},",
1248 | "\tfail: ()=>{},",
1249 | "\tcomplete: ()=>{}",
1250 | "});"
1251 | ],
1252 | "description": "切换闪光灯"
1253 | },
1254 | "wx.loadFontFace": {
1255 | "prefix": "wx-loadFontFace",
1256 | "body": [
1257 | "wx.loadFontFace({",
1258 | "\tfamily: '${1}',",
1259 | "\tsource: '${2}',",
1260 | "\tdesc: {",
1261 | "\t\tstyle: '${3:normal}',",
1262 | "\t\tweight: '${4:normal}',",
1263 | "\t\tvariant: '${5:normal}'",
1264 | "\t},",
1265 | "\tsuccess: (result)=>{",
1266 | "\t\t${6}",
1267 | "\t},",
1268 | "\tfail: ()=>{},",
1269 | "\tcomplete: ()=>{}",
1270 | "});"
1271 | ],
1272 | "description": "动态加载网络字体"
1273 | },
1274 | "wx.saveFile": {
1275 | "prefix": "wx-saveFile",
1276 | "body": [
1277 | "wx.saveFile({",
1278 | "\ttempFilePath: '${1}',",
1279 | "\tsuccess: (result)=>{",
1280 | "\t\t${2}",
1281 | "\t},",
1282 | "\tfail: ()=>{},",
1283 | "\tcomplete: ()=>{}",
1284 | "});"
1285 | ],
1286 | "description": "保存文件到本地。注意:saveFile会把临时文件移动,因此调用成功后传入的 tempFilePath 将不可用"
1287 | },
1288 | "wx.getSavedFileList": {
1289 | "prefix": "wx-getSavedFileList",
1290 | "body": [
1291 | "wx.getSavedFileList({",
1292 | "\tsuccess: (result)=>{",
1293 | "\t\t${1}",
1294 | "\t},",
1295 | "\tfail: ()=>{},",
1296 | "\tcomplete: ()=>{}",
1297 | "});"
1298 | ],
1299 | "description": "获取本地已保存的文件列表"
1300 | },
1301 | "wx.getSavedFileInfo": {
1302 | "prefix": "wx-getSavedFileInfo",
1303 | "body": [
1304 | "wx.getSavedFileInfo({",
1305 | "\tfilePath: '${1}',",
1306 | "\tsuccess: (result)=>{",
1307 | "\t\t${2}",
1308 | "\t},",
1309 | "\tfail: ()=>{},",
1310 | "\tcomplete: ()=>{}",
1311 | "});"
1312 | ],
1313 | "description": "获取本地文件的文件信息。此接口只能用于获取已保存到本地的文件,若需要获取临时文件信息,请使用 wx.getFileInfo 接口"
1314 | },
1315 | "wx.removeSavedFile": {
1316 | "prefix": "wx-removeSavedFile",
1317 | "body": [
1318 | "wx.removeSavedFile({",
1319 | "\tfilePath: ${1},",
1320 | "\tsuccess: (result)=>{",
1321 | "\t\t${2}",
1322 | "\t},",
1323 | "\tfail: ()=>{},",
1324 | "\tcomplete: ()=>{}",
1325 | "});"
1326 | ],
1327 | "description": "删除本地存储的文件"
1328 | },
1329 | "wx.openDocument": {
1330 | "prefix": "wx-openDocument",
1331 | "body": [
1332 | "wx.openDocument({",
1333 | "\tfilePath: ${1},",
1334 | "\tfileType: ${2:'docx'},",
1335 | "\tsuccess: (result)=>{",
1336 | "\t\t${3}",
1337 | "\t},",
1338 | "\tfail: ()=>{},",
1339 | "\tcomplete: ()=>{}",
1340 | "});"
1341 | ],
1342 | "description": "新开页面打开文档,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx"
1343 | },
1344 | "wx.setStorage": {
1345 | "prefix": "wx-setStorage",
1346 | "body": [
1347 | "wx.setStorage({",
1348 | "\tkey: '${1:key}',",
1349 | "\tdata: ${2:data},",
1350 | "\tsuccess: (result)=>{",
1351 | "\t\t${3}",
1352 | "\t},",
1353 | "\tfail: ()=>{},",
1354 | "\tcomplete: ()=>{}",
1355 | "});"
1356 | ],
1357 | "description": "将数据存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个异步接口。"
1358 | },
1359 | "wx.setStorageSync": {
1360 | "prefix": "wx-setStorageSync",
1361 | "body": ["wx.setStorageSync(${1:key}, ${2:data});"],
1362 | "description": "将 data 存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个同步接口。"
1363 | },
1364 | "wx.getStorage": {
1365 | "prefix": "wx-getStorage",
1366 | "body": [
1367 | "wx.getStorage({",
1368 | "\tkey: '${1:key}',",
1369 | "\tsuccess: (result)=>{",
1370 | "\t\t${2}",
1371 | "\t},",
1372 | "\tfail: ()=>{},",
1373 | "\tcomplete: ()=>{}",
1374 | "});"
1375 | ],
1376 | "description": "从本地缓存中异步获取指定 key 对应的内容。"
1377 | },
1378 | "wx.getStorageSync": {
1379 | "prefix": "wx-getStorageSync",
1380 | "body": ["wx.getStorageSync(${1:key});"],
1381 | "description": "从本地缓存中同步获取指定 key 对应的内容。"
1382 | },
1383 | "wx.getStorageInfo": {
1384 | "prefix": "wx-getStorageInfo",
1385 | "body": ["wx.getStorageInfo({",
1386 | "\tsuccess: (result)=>{",
1387 | "\t\t${1}",
1388 | "\t},",
1389 | "\tfail: ()=>{},",
1390 | "\tcomplete: ()=>{}",
1391 | "});"
1392 | ],
1393 | "description": "异步获取当前storage的相关信息"
1394 | },
1395 | "wx.getStorageInfoSync": {
1396 | "prefix": "wx-getStorageInfoSync",
1397 | "body": ["${1:let storageInfo = }wx.getStorageInfoSync();"],
1398 | "description": "同步获取当前storage的相关信息"
1399 | },
1400 | "wx.removeStorage": {
1401 | "prefix": "wx-removeStorage",
1402 | "body": ["wx.removeStorage({",
1403 | "\tkey: '${1:key},'",
1404 | "\tsuccess: (result)=>{",
1405 | "\t\t${2}",
1406 | "\t},",
1407 | "\tfail: ()=>{},",
1408 | "\tcomplete: ()=>{}",
1409 | "});"
1410 | ],
1411 | "description": "从本地缓存中异步移除指定 key。"
1412 | },
1413 | "wx.removeStorageSync": {
1414 | "prefix": "wx-removeStorageSync",
1415 | "body": ["wx.removeStorageSync(${1:key});"],
1416 | "description": "从本地缓存中同步移除指定 key。"
1417 | },
1418 | "wx.clearStorage": {
1419 | "prefix": "wx-clearStorage",
1420 | "body": ["wx.clearStorage();"],
1421 | "description": "异步清除本地数据缓存"
1422 | },
1423 | "wx.clearStorageSync": {
1424 | "prefix": "wx-clearStorageSync",
1425 | "body": ["wx.clearStorageSync();"],
1426 | "description": "同步清除本地数据缓存"
1427 | },
1428 | "wx.getLocation": {
1429 | "prefix": "wx-getLocation",
1430 | "body": [
1431 | "wx.getLocation({",
1432 | "\ttype: '${1:wgs84}',",
1433 | "\taltitude: ${2:false},",
1434 | "\tsuccess: (result)=>{",
1435 | "\t\t${3}",
1436 | "\t},",
1437 | "\tfail: ()=>{},",
1438 | "\tcomplete: ()=>{}",
1439 | "});"
1440 | ],
1441 | "description": "获取当前的地理位置、速度。"
1442 | },
1443 | "wx.chooseLocation": {
1444 | "prefix": "wx-chooseLocation",
1445 | "body": ["wx.chooseLocation({",
1446 | "\tsuccess: (result)=>{",
1447 | "\t\t${1}",
1448 | "\t},",
1449 | "\tfail: ()=>{},",
1450 | "\tcomplete: ()=>{}",
1451 | "});"
1452 | ],
1453 | "description": "打开地图选择位置。需要用户授权 scope.userLocation"
1454 | },
1455 | "wx.openLocation": {
1456 | "prefix": "wx-openLocation",
1457 | "body": [
1458 | "wx.openLocation({",
1459 | "\tlatitude: ${1:0},",
1460 | "\tlongitude: ${2:0},",
1461 | "\tscale: ${3:18},",
1462 | "\tname: '${4}',",
1463 | "\taddress: '${5}',",
1464 | "\tsuccess: (result)=>{",
1465 | "\t\t${6}",
1466 | "\t},",
1467 | "\tfail: ()=>{},",
1468 | "\tcomplete: ()=>{}",
1469 | "});"
1470 | ],
1471 | "description": "使用微信内置地图查看位置。 需要用户授权 scope.userLocation"
1472 | },
1473 | "wx.createMapContext": {
1474 | "prefix": "wx-createMapContext",
1475 | "body": [
1476 | "${1:var mapContext = }wx.createMapContext('${2:map}'${3:, this});"
1477 | ],
1478 | "description": "创建并返回 map 上下文 mapContext 对象。在自定义组件下,第二个参数传入组件实例this,以操作组件内 组件"
1479 | },
1480 | "mapContext.getCenterLocation": {
1481 | "prefix": "mapContext-getCenterLocation",
1482 | "body": [
1483 | "mapContext.getCenterLocation({",
1484 | "\tsuccess: (result)=>{",
1485 | "\t\t${1}",
1486 | "\t},",
1487 | "\tfail: ()=>{},",
1488 | "\tcomplete: ()=>{}",
1489 | "});"
1490 | ],
1491 | "description": "获取当前地图中心的经纬度,返回的是 gcj02 坐标系,可以用于 wx.openLocation"
1492 | },
1493 | "mapContext.moveToLocation": {
1494 | "prefix": "mapContext-moveToLocation",
1495 | "body": ["mapContext.moveToLocation();"],
1496 | "description": "将地图中心移动到当前定位点,需要配合map组件的show-location使用"
1497 | },
1498 | "mapContext.translateMarker": {
1499 | "prefix": "mapContext-translateMarker",
1500 | "body": [
1501 | "mapContext.translateMarker({",
1502 | "\tmarkerId: ${1},",
1503 | "\tdestination: {",
1504 | "\t\tlatitude: ${2},",
1505 | "\t\tlongitude: ${3}",
1506 | "\t},",
1507 | "\tautoRotate: ${4:false},",
1508 | "\trotate: ${5},",
1509 | "\tduration: ${6:1000},",
1510 | "\tanimationEnd: ()=>{},",
1511 | "\tfail: ()=>{}",
1512 | "});"
1513 | ],
1514 | "description": "平移marker,带动画"
1515 | },
1516 | "mapContext.includePoints": {
1517 | "prefix": "mapContext-includePoints",
1518 | "body": [
1519 | "mapContext.includePoints({",
1520 | "\tpoints: [",
1521 | "\t\t{",
1522 | "\t\t\tlatitude: ${1:latitude},",
1523 | "\t\t\tlongitude: ${2:longitude}",
1524 | "\t\t}",
1525 | "\t],",
1526 | "\tpadding:[$3]",
1527 | "});"
1528 | ],
1529 | "description": "缩放视野展示所有经纬度"
1530 | },
1531 | "mapContext.getRegion": {
1532 | "prefix": "mapContext-getRegion",
1533 | "body": [
1534 | "mapContext.getRegion({",
1535 | "\tsuccess: (result)=>{",
1536 | "\t\t${1}",
1537 | "\t},",
1538 | "\tfail: ()=>{},",
1539 | "\tcomplete: ()=>{}",
1540 | "});"
1541 | ],
1542 | "description": "获取当前地图的视野范围"
1543 | },
1544 | "mapContext.getScale": {
1545 | "prefix": "mapContext-getScale",
1546 | "body": [
1547 | "mapContext.getScale({",
1548 | "\tsuccess: (result)=>{",
1549 | "\t\t${1}",
1550 | "\t},",
1551 | "\tfail: ()=>{},",
1552 | "\tcomplete: ()=>{}",
1553 | "});"
1554 | ],
1555 | "description": "获取当前地图的缩放级别"
1556 | },
1557 | "wx.getSystemInfo": {
1558 | "prefix": "wx-getSystemInfo",
1559 | "body": ["wx.getSystemInfo({",
1560 | "\tsuccess: (result)=>{",
1561 | "\t\t${1}",
1562 | "\t},",
1563 | "\tfail: ()=>{},",
1564 | "\tcomplete: ()=>{}",
1565 | "});"
1566 | ],
1567 | "description": "异步获取系统信息。"
1568 | },
1569 | "wx.getSystemInfoSync": {
1570 | "prefix": "wx-getSystemInfoSync",
1571 | "body": ["${var systemInfo = }wx.getSystemInfoSync();"],
1572 | "description": "获取系统信息同步接口"
1573 | },
1574 | "wx.canIUse": {
1575 | "prefix": "wx-canIUse",
1576 | "body": ["wx.canIUse(${1});"],
1577 | "description": "判断小程序的API,回调,参数,组件等是否在当前版本可用。"
1578 | },
1579 | "wx.onMemoryWarning": {
1580 | "prefix": "wx-onMemoryWarning",
1581 | "body": [
1582 | "wx.onMemoryWarning((result) => {",
1583 | "\t${1}",
1584 | "});"
1585 | ],
1586 | "description": "监听内存不足的告警事件,Android下有告警等级划分,只有LOW和CRITICAL会回调开发者;iOS无等级划分"
1587 | },
1588 | "wx.getNetworkType": {
1589 | "prefix": "wx-getNetworkType",
1590 | "body": [
1591 | "wx.getNetworkType({",
1592 | "\tsuccess: (result)=>{",
1593 | "\t\t${1}",
1594 | "\t},",
1595 | "\tfail: ()=>{},",
1596 | "\tcomplete: ()=>{}",
1597 | "});"
1598 | ],
1599 | "description": "获取网络类型"
1600 | },
1601 | "wx.onNetworkStatusChange": {
1602 | "prefix": "wx-onNetworkStatusChange",
1603 | "body": [
1604 | "wx.onNetworkStatusChange((result) => {",
1605 | "\t${1}",
1606 | "});"
1607 | ],
1608 | "description": "监听网络状态变化。"
1609 | },
1610 | "wx.onAccelerometerChange": {
1611 | "prefix": "wx-onAccelerometerChange",
1612 | "body": [
1613 | "wx.onAccelerometerChange((result) => {",
1614 | "\t${1}",
1615 | "});"
1616 | ],
1617 | "description": "监听加速度数据,频率:5次/秒,接口调用后会自动开始监听,可使用 wx.stopAccelerometer 停止监听。"
1618 | },
1619 | "wx.startAccelerometer": {
1620 | "prefix": "wx-startAccelerometer",
1621 | "body": [
1622 | "wx.startAccelerometer({",
1623 | "\tinterval: '${1:normal}',",
1624 | "\tsuccess: (result)=>{",
1625 | "\t\t${2}",
1626 | "\t},",
1627 | "\tfail: ()=>{},",
1628 | "\tcomplete: ()=>{}",
1629 | "});"
1630 | ],
1631 | "description": "开始监听加速度数据。"
1632 | },
1633 | "wx.stopAccelerometer": {
1634 | "prefix": "wx-stopAccelerometer",
1635 | "body": [
1636 | "wx.stopAccelerometer({",
1637 | "\tsuccess: (result)=>{",
1638 | "\t\t${1}",
1639 | "\t},",
1640 | "\tfail: ()=>{},",
1641 | "\tcomplete: ()=>{}",
1642 | "});"
1643 | ],
1644 | "description": "停止监听加速度数据。"
1645 | },
1646 | "wx.onCompassChange": {
1647 | "prefix": "wx-onCompassChange",
1648 | "body": [
1649 | "wx.onCompassChange((result) => {",
1650 | "\t${1}",
1651 | "});"
1652 | ],
1653 | "description": "监听罗盘数据,频率:5次/秒,接口调用后会自动开始监听,可使用wx.stopCompass停止监听。"
1654 | },
1655 | "wx.startCompass": {
1656 | "prefix": "wx-startCompass",
1657 | "body": [
1658 | "wx.startCompass({",
1659 | "\tsuccess: (result)=>{",
1660 | "\t\t${1}",
1661 | "\t},",
1662 | "\tfail: ()=>{},",
1663 | "\tcomplete: ()=>{}",
1664 | "});"
1665 | ],
1666 | "description": "开始监听罗盘数据。"
1667 | },
1668 | "wx.stopCompass": {
1669 | "prefix": "wx-stopCompass",
1670 | "body": [
1671 | "wx.stopCompass({",
1672 | "\tsuccess: (result)=>{",
1673 | "\t\t${1}",
1674 | "\t},",
1675 | "\tfail: ()=>{},",
1676 | "\tcomplete: ()=>{}",
1677 | "});"
1678 | ],
1679 | "description": "停止监听罗盘数据。"
1680 | },
1681 | "wx.makePhoneCall": {
1682 | "prefix": "wx-makePhoneCall",
1683 | "body": [
1684 | "wx.makePhoneCall({",
1685 | "\tphoneNumber: ${1},",
1686 | "\tsuccess: (result)=>{",
1687 | "\t\t${2}",
1688 | "\t},",
1689 | "\tfail: ()=>{},",
1690 | "\tcomplete: ()=>{}",
1691 | "});"
1692 | ],
1693 | "description": "拨打电话"
1694 | },
1695 | "wx.scanCode": {
1696 | "prefix": "wx-scanCode",
1697 | "body": [
1698 | "wx.scanCode({",
1699 | "\tonlyFromCamera: ${1:false},",
1700 | "\tscanType: ['${2:qrCode}','${3:barCode}','${4:datamatrix}','${5:pdf417}'],",
1701 | "\tsuccess: (result)=>{",
1702 | "\t\t${6}",
1703 | "\t},",
1704 | "\tfail: ()=>{},",
1705 | "\tcomplete: ()=>{}",
1706 | "});"
1707 | ],
1708 | "description": "调起客户端扫码界面,扫码成功后返回对应的结果"
1709 | },
1710 | "wx.setClipboardData": {
1711 | "prefix": "wx-setClipboardData",
1712 | "body": [
1713 | "wx.setClipboardData({",
1714 | "\tdata: ${1},",
1715 | "\tsuccess: (result)=>{",
1716 | "\t\t${2}",
1717 | "\t},",
1718 | "\tfail: ()=>{},",
1719 | "\tcomplete: ()=>{}",
1720 | "});"
1721 | ],
1722 | "description": "设置系统剪贴板的内容"
1723 | },
1724 | "wx.getClipboardData": {
1725 | "prefix": "wx-getClipboardData",
1726 | "body": [
1727 | "wx.getClipboardData({",
1728 | "\tsuccess: (result)=>{",
1729 | "\t\t${2}",
1730 | "\t},",
1731 | "\tfail: ()=>{},",
1732 | "\tcomplete: ()=>{}",
1733 | "});"
1734 | ],
1735 | "description": "获取系统剪贴板内容"
1736 | },
1737 | "wx.openBluetoothAdapter": {
1738 | "prefix": "wx-openBluetoothAdapter",
1739 | "body": [
1740 | "wx.openBluetoothAdapter({",
1741 | "\tsuccess: (result)=>{",
1742 | "\t\t${1}",
1743 | "\t,",
1744 | "\tfail: ()=>{},",
1745 | "\tcomplete: ()=>{}",
1746 | "});"
1747 | ],
1748 | "description": "初始化小程序蓝牙模块,生效周期为调用wx.openBluetoothAdapter至调用wx.closeBluetoothAdapter或小程序被销毁为止。"
1749 | },
1750 | "wx.closeBluetoothAdapter": {
1751 | "prefix": "wx-closeBluetoothAdapter",
1752 | "body": [
1753 | "wx.closeBluetoothAdapter({",
1754 | "\tsuccess: (result)=>{",
1755 | "\t\t${1}",
1756 | "\t},",
1757 | "\tfail: ()=>{},",
1758 | "\tcomplete: ()=>{}",
1759 | "});"
1760 | ],
1761 | "description": "关闭蓝牙模块,使其进入未初始化状态。调用该方法将断开所有已建立的链接并释放系统资源。"
1762 | },
1763 | "wx.getBluetoothAdapterState": {
1764 | "prefix": "wx-getBluetoothAdapterState",
1765 | "body": [
1766 | "wx.getBluetoothAdapterState({",
1767 | "\tsuccess: (result)=>{",
1768 | "\t\t${1}",
1769 | "\t},",
1770 | "\tfail: ()=>{},",
1771 | "\tcomplete: ()=>{}",
1772 | "});"
1773 | ],
1774 | "description": "获取本机蓝牙适配器状态"
1775 | },
1776 | "wx.onBluetoothAdapterStateChange": {
1777 | "prefix": "wx-onBluetoothAdapterStateChange",
1778 | "body": [
1779 | "wx.onBluetoothAdapterStateChange((result) => {",
1780 | "\t${1}",
1781 | "});"
1782 | ],
1783 | "description": "监听蓝牙适配器状态变化事件"
1784 | },
1785 | "wx.startBluetoothDevicesDiscovery": {
1786 | "prefix": "wx-startBluetoothDevicesDiscovery",
1787 | "body": [
1788 | "wx.startBluetoothDevicesDiscovery({",
1789 | "\tservices:[${1}]",
1790 | "\tallowDuplicatesKey:${2:false}",
1791 | "\tinterval:${3:0}",
1792 | "\tsuccess: (result)=>{",
1793 | "\t\t${4}",
1794 | "\t},",
1795 | "\tfail: ()=>{},",
1796 | "\tcomplete: ()=>{}",
1797 | "});"
1798 | ],
1799 | "description": "开始搜寻附近的蓝牙外围设备。注意,该操作比较耗费系统资源,请在搜索并连接到设备后调用 stop 方法停止搜索。"
1800 | },
1801 | "wx.stopBluetoothDevicesDiscovery": {
1802 | "prefix": "wx-stopBluetoothDevicesDiscovery",
1803 | "body": [
1804 | "wx.stopBluetoothDevicesDiscovery({",
1805 | "\tsuccess: (result)=>{",
1806 | "\t\t${1}",
1807 | "\t},",
1808 | "\tfail: ()=>{},",
1809 | "\tcomplete: ()=>{}",
1810 | "});"
1811 | ],
1812 | "description": "停止搜寻附近的蓝牙外围设备。若已经找到需要的蓝牙设备并不需要继续搜索时,建议调用该接口停止蓝牙搜索。"
1813 | },
1814 | "wx.getBluetoothDevices": {
1815 | "prefix": "wx-getBluetoothDevices",
1816 | "body": [
1817 | "wx.getBluetoothDevices({",
1818 | "\tsuccess: (result)=>{",
1819 | "\t\t${1}",
1820 | "\t},",
1821 | "\tfail: ()=>{},",
1822 | "\tcomplete: ()=>{}",
1823 | "});"
1824 | ],
1825 | "description": "获取在小程序蓝牙模块生效期间所有已发现的蓝牙设备,包括已经和本机处于连接状态的设备。"
1826 | },
1827 | "wx.onBluetoothDeviceFound": {
1828 | "prefix": "wx-onBluetoothDeviceFound",
1829 | "body": [
1830 | "wx.onBluetoothDeviceFound((result) => {",
1831 | "\t${1}",
1832 | "});"
1833 | ],
1834 | "description": "监听寻找到新设备的事件"
1835 | },
1836 | "wx.getConnectedBluetoothDevices": {
1837 | "prefix": "wx-getConnectedBluetoothDevices",
1838 | "body": [
1839 | "wx.getConnectedBluetoothDevices({",
1840 | "\tservices: [${1}],",
1841 | "\tsuccess: (result)=>{",
1842 | "\t\t${2}",
1843 | "\t},",
1844 | "\tfail: ()=>{},",
1845 | "\tcomplete: ()=>{}",
1846 | "});"
1847 | ],
1848 | "description": "根据 uuid 获取处于已连接状态的设备"
1849 | },
1850 | "wx.createBLEConnection": {
1851 | "prefix": "wx-createBLEConnection",
1852 | "body": [
1853 | "wx.createBLEConnection({",
1854 | "\tdeviceId: ${1},",
1855 | "\tsuccess: (result)=>{",
1856 | "\t\t${2}",
1857 | "\t},",
1858 | "\tfail: ()=>{},",
1859 | "\tcomplete: ()=>{}",
1860 | "});"
1861 | ],
1862 | "description": "连接低功耗蓝牙设备。"
1863 | },
1864 | "wx.closeBLEConnection": {
1865 | "prefix": "wx-closeBLEConnection",
1866 | "body": [
1867 | "wx.closeBLEConnection({",
1868 | "\tdeviceId: ${1},",
1869 | "\tsuccess: (result)=>{",
1870 | "\t\t${2}",
1871 | "\t},",
1872 | "\tfail: ()=>{},",
1873 | "\tcomplete: ()=>{}",
1874 | "});"
1875 | ],
1876 | "description": "断开与低功耗蓝牙设备的连接"
1877 | },
1878 | "wx.onBLEConnectionStateChange": {
1879 | "prefix": "wx-onBLEConnectionStateChange",
1880 | "body": [
1881 | "wx.onBLEConnectionStateChange((result) => {",
1882 | "\t${1}",
1883 | "});"
1884 | ],
1885 | "description": "监听低功耗蓝牙连接状态的改变事件,包括开发者主动连接或断开连接,设备丢失,连接异常断开等等"
1886 | },
1887 | "wx.getBLEDeviceServices": {
1888 | "prefix": "wx-getBLEDeviceServices",
1889 | "body": [
1890 | "wx.getBLEDeviceServices({",
1891 | "\tdeviceId: ${1},",
1892 | "\tsuccess: (result)=>{",
1893 | "\t\t${2}",
1894 | "\t},",
1895 | "\tfail: ()=>{},",
1896 | "\tcomplete: ()=>{}",
1897 | "});"
1898 | ],
1899 | "description": "获取蓝牙设备所有 service(服务)"
1900 | },
1901 | "wx.getBLEDeviceCharacteristics": {
1902 | "prefix": "wx-getBLEDeviceCharacteristics",
1903 | "body": [
1904 | "wx.getBLEDeviceCharacteristics({",
1905 | "\tdeviceId: ${1},",
1906 | "\tservices: ${2},",
1907 | "\tsuccess: (result)=>{",
1908 | "\t\t${3}",
1909 | "\t},",
1910 | "\tfail: ()=>{},",
1911 | "\tcomplete: ()=>{}",
1912 | "});"
1913 | ],
1914 | "description": "获取蓝牙设备某个服务中的所有 characteristic(特征值)"
1915 | },
1916 | "wx.readBLECharacteristicValue": {
1917 | "prefix": "wx-readBLECharacteristicValue",
1918 | "body": [
1919 | "wx.readBLECharacteristicValue({",
1920 | "\tdeviceId: ${1},",
1921 | "\tservices: ${2},",
1922 | "\tcharacteristicId: ${3},",
1923 | "\tsuccess: (result)=>{",
1924 | "\t\t${4}",
1925 | "\t},",
1926 | "\tfail: ()=>{},",
1927 | "\tcomplete: ()=>{}",
1928 | "});"
1929 | ],
1930 | "description": "读取低功耗蓝牙设备的特征值的二进制数据值。注意:必须设备的特征值支持read才可以成功调用,具体参照 characteristic 的 properties 属性"
1931 | },
1932 | "wx.writeBLECharacteristicValue": {
1933 | "prefix": "wx-writeBLECharacteristicValue",
1934 | "body": [
1935 | "wx.writeBLECharacteristicValue({",
1936 | "\tdeviceId: ${1},",
1937 | "\tservices: ${2},",
1938 | "\tcharacteristicId: ${3},",
1939 | "\tvalue: ${4:},",
1940 | "\tsuccess: (result)=>{",
1941 | "\t\t${5}",
1942 | "\t},",
1943 | "\tfail: ()=>{},",
1944 | "\tcomplete: ()=>{}",
1945 | "});"
1946 | ],
1947 | "description": "向低功耗蓝牙设备特征值中写入二进制数据。注意:必须设备的特征值支持write才可以成功调用,具体参照 characteristic 的 properties 属性"
1948 | },
1949 | "wx.notifyBLECharacteristicValueChange": {
1950 | "prefix": "wx-notifyBLECharacteristicValueChange",
1951 | "body": [
1952 | "wx.notifyBLECharacteristicValueChange({",
1953 | "\tdeviceId: ${1},",
1954 | "\tservices: ${2},",
1955 | "\tcharacteristicId: ${3},",
1956 | "\tstate: ${4:true},",
1957 | "\tvalue: ${5:},",
1958 | "\tsuccess: (result)=>{",
1959 | "\t\t${6}",
1960 | "\t},",
1961 | "\tfail: ()=>{},",
1962 | "\tcomplete: ()=>{}",
1963 | "});"
1964 | ],
1965 | "description": "启用低功耗蓝牙设备特征值变化时的 notify 功能,订阅特征值。注意:必须设备的特征值支持notify或者indicate才可以成功调用,具体参照 characteristic 的 properties 属性"
1966 | },
1967 | "wx.onBLECharacteristicValueChange": {
1968 | "prefix": "wx-onBLECharacteristicValueChange",
1969 | "body": [
1970 | "wx.onBLECharacteristicValueChange((result) => {",
1971 | "\t${1}",
1972 | "});"
1973 | ],
1974 | "description": "监听低功耗蓝牙设备的特征值变化。必须先启用notify接口才能接收到设备推送的notification。"
1975 | },
1976 | "wx.startBeaconDiscovery": {
1977 | "prefix": "wx-startBeaconDiscovery",
1978 | "body": [
1979 | "wx.startBeaconDiscovery({",
1980 | "\tuuids: [${1}],",
1981 | "\tsuccess: (result)=>{",
1982 | "\t\t${2}",
1983 | "\t},",
1984 | "\tfail: ()=>{},",
1985 | "\tcomplete: ()=>{}",
1986 | "});"
1987 | ],
1988 | "description": "开始搜索附近的iBeacon设备"
1989 | },
1990 | "wx.stopBeaconDiscovery": {
1991 | "prefix": "wx-stopBeaconDiscovery",
1992 | "body": ["wx.stopBeaconDiscovery({",
1993 | "\tsuccess: (result)=>{",
1994 | "\t\t${1}",
1995 | "\t},",
1996 | "\tfail: ()=>{},",
1997 | "\tcomplete: ()=>{}",
1998 | "});"
1999 | ],
2000 | "description": "停止搜索附近的iBeacon设备"
2001 | },
2002 | "wx.getBeacons": {
2003 | "prefix": "wx-getBeacons",
2004 | "body": ["wx.getBeacons({",
2005 | "\tsuccess: (result)=>{",
2006 | "\t\t${1}",
2007 | "\t},",
2008 | "\tfail: ()=>{},",
2009 | "\tcomplete: ()=>{}",
2010 | "});"
2011 | ],
2012 | "description": "获取所有已搜索到的iBeacon设备"
2013 | },
2014 | "wx.onBeaconUpdate": {
2015 | "prefix": "wx-onBeaconUpdate",
2016 | "body": [
2017 | "wx.onBeaconUpdate((result) => {",
2018 | "\t${1}",
2019 | "});"
2020 | ],
2021 | "description": "监听 iBeacon 设备的更新事件"
2022 | },
2023 | "wx.onBeaconServiceChange": {
2024 | "prefix": "wx-onBeaconServiceChange",
2025 | "body": ["wx.onBeaconServiceChange((result) => {",
2026 | "\t${1}",
2027 | "});"
2028 | ],
2029 | "description": "监听 iBeacon 服务的状态变化"
2030 | },
2031 | "wx.setScreenBrightness": {
2032 | "prefix": "wx-setScreenBrightness",
2033 | "body": ["wx.setScreenBrightness({",
2034 | "\tvalue: ${1},",
2035 | "\tsuccess: (result)=>{",
2036 | "\t\t${2}",
2037 | "\t},",
2038 | "\tfail: ()=>{},",
2039 | "\tcomplete: ()=>{}",
2040 | "});"
2041 | ],
2042 | "description": "设置屏幕亮度"
2043 | },
2044 | "wx.getScreenBrightness": {
2045 | "prefix": "wx-getScreenBrightness",
2046 | "body": [
2047 | "wx.getScreenBrightness({",
2048 | "\tsuccess: (result)=>{",
2049 | "\t\t${1}",
2050 | "\t},",
2051 | "\tfail: ()=>{},",
2052 | "\tcomplete: ()=>{}",
2053 | "});"
2054 | ],
2055 | "description": "获取屏幕亮度。"
2056 | },
2057 | "wx.vibrateLong": {
2058 | "prefix": "wx-vibrateLong",
2059 | "body": [
2060 | "wx.vibrateLong({",
2061 | "\tsuccess: (result)=>{",
2062 | "\t\t${1}",
2063 | "\t},",
2064 | "\tfail: ()=>{},",
2065 | "\tcomplete: ()=>{}",
2066 | "});"
2067 | ],
2068 | "description": "使手机发生较长时间的振动(400ms)"
2069 | },
2070 | "wx.vibrateShort": {
2071 | "prefix": "wx-vibrateShort",
2072 | "body": ["wx.vibrateShort({",
2073 | "\tsuccess: (result)=>{",
2074 | "\t\t${1}",
2075 | "\t},",
2076 | "\tfail: ()=>{},",
2077 | "\tcomplete: ()=>{}",
2078 | "});"
2079 | ],
2080 | "description": "使手机发生较短时间的振动(15ms)"
2081 | },
2082 | "wx.setKeepScreenOn": {
2083 | "prefix": "wx-setKeepScreenOn",
2084 | "body": ["wx.setKeepScreenOn({",
2085 | "\tkeepScreenOn: ${1:true},",
2086 | "\tsuccess: (result)=>{",
2087 | "\t\t${2}",
2088 | "\t},",
2089 | "\tfail: ()=>{},",
2090 | "\tcomplete: ()=>{}",
2091 | "});"
2092 | ],
2093 | "description": "设置是否保持常亮状态。仅在当前小程序生效,离开小程序后设置失效。"
2094 | },
2095 | "wx.onUserCaptureScreen": {
2096 | "prefix": "wx-onUserCaptureScreen",
2097 | "body": ["wx.onUserCaptureScreen((result)=>{",
2098 | "\t${1}",
2099 | "});"
2100 | ],
2101 | "description": "监听用户主动截屏事件,用户使用系统截屏按键截屏时触发此事件"
2102 | },
2103 | "wx.addPhoneContact": {
2104 | "prefix": "wx-addPhoneContact",
2105 | "body": [
2106 | "wx.addPhoneContact({",
2107 | "\tphotoFilePath: ${1},",
2108 | "\tnickName: ${2},",
2109 | "\tlastName: ${3},",
2110 | "\tmiddleName: ${4},",
2111 | "\tfirstName: ${5},",
2112 | "\tmobilePhoneNumber: ${6},",
2113 | "\tweChatNumber: ${7},",
2114 | "\temail: ${8},",
2115 | "\tsuccess: (result)=>{",
2116 | "\t\t${9}",
2117 | "\t},",
2118 | "\tfail: ()=>{},",
2119 | "\tcomplete: ()=>{}",
2120 | "});"
2121 | ],
2122 | "description": "调用后,用户可以选择将该表单以“新增联系人”或“添加到已有联系人”的方式,写入手机系统通讯录,完成手机通讯录联系人和联系方式的增加。此API参数非常多,请参考文档。"
2123 | },
2124 | "wx.getHCEState": {
2125 | "prefix": "wx-getHCEState",
2126 | "body": ["wx.getHCEState({",
2127 | "\tsuccess: (result)=>{",
2128 | "\t\t${1}",
2129 | "\t},",
2130 | "\tfail: ()=>{},",
2131 | "\tcomplete: ()=>{}",
2132 | "});"
2133 | ],
2134 | "description": "判断当前设备是否支持 HCE 能力"
2135 | },
2136 | "wx.startHCE": {
2137 | "prefix": "wx-startHCE",
2138 | "body": [
2139 | "wx.startHCE({",
2140 | "\taid_list: [${1}],",
2141 | "\tsuccess: (result)=>{",
2142 | "\t\t${2}",
2143 | "\t},",
2144 | "\tfail: ()=>{},",
2145 | "\tcomplete: ()=>{}",
2146 | "});"
2147 | ],
2148 | "description": "初始化NFC模块"
2149 | },
2150 | "wx.stopHCE": {
2151 | "prefix": "wx-stopHCE",
2152 | "body": ["wx.stopHCE({",
2153 | "\tsuccess: (result)=>{",
2154 | "\t\t${1}",
2155 | "\t},",
2156 | "\tfail: ()=>{},",
2157 | "\tcomplete: ()=>{}",
2158 | "});"
2159 | ],
2160 | "description": "关闭 NFC 模块。仅在安卓系统下有效。"
2161 | },
2162 | "wx.onHCEMessage": {
2163 | "prefix": "wx-onHCEMessage",
2164 | "body": ["wx.onHCEMessage((result) => {",
2165 | "\t${1}",
2166 | "});"
2167 | ],
2168 | "description": "监听 NFC 设备的消息回调,并在回调中处理。"
2169 | },
2170 | "wx.sendHCEMessage": {
2171 | "prefix": "wx-sendHCEMessage",
2172 | "body": [
2173 | "wx.sendHCEMessage({",
2174 | "\tdata: ${1:},",
2175 | "\tsuccess: (result)=>{",
2176 | "\t\t${2}",
2177 | "\t},",
2178 | "\tfail: ()=>{},",
2179 | "\tcomplete: ()=>{}",
2180 | "});"
2181 | ],
2182 | "description": "发送 NFC 消息。仅在安卓系统下有效。"
2183 | },
2184 | "wx.startWifi": {
2185 | "prefix": "wx-startWifi",
2186 | "body": ["wx.startWifi({",
2187 | "\tsuccess: (result)=>{",
2188 | "\t\t${1}",
2189 | "\t},",
2190 | "\tfail: ()=>{},",
2191 | "\tcomplete: ()=>{}",
2192 | "});"
2193 | ],
2194 | "description": "初始化Wi-Fi模块。"
2195 | },
2196 | "wx.stopWifi": {
2197 | "prefix": "wx-stopWifi",
2198 | "body": ["wx.stopWifi({",
2199 | "\tsuccess: (result)=>{",
2200 | "\t\t${1}",
2201 | "\t},",
2202 | "\tfail: ()=>{},",
2203 | "\tcomplete: ()=>{}",
2204 | "});"
2205 | ],
2206 | "description": "关闭Wi-Fi模块。"
2207 | },
2208 | "wx.connectWifi": {
2209 | "prefix": "wx-connectWifi",
2210 | "body": [
2211 | "wx.connectWifi({",
2212 | "\tSSID: ${1},",
2213 | "\tBSSID: ${2},",
2214 | "\tpassword: ${3},",
2215 | "\tsuccess: (result)=>{",
2216 | "\t\t${4}",
2217 | "\t},",
2218 | "\tfail: ()=>{},",
2219 | "\tcomplete: ()=>{}",
2220 | "});"
2221 | ],
2222 | "description": "连接Wi-Fi。若已知Wi-Fi信息,可以直接利用该接口连接。"
2223 | },
2224 | "wx.getWifiList": {
2225 | "prefix": "wx-getWifiList",
2226 | "body": ["wx.getWifiList({",
2227 | "\tsuccess: (result)=>{",
2228 | "\t\t${1}",
2229 | "\t},",
2230 | "\tfail: ()=>{},",
2231 | "\tcomplete: ()=>{}",
2232 | "});"
2233 | ],
2234 | "description": "请求获取Wi-Fi列表,在onGetWifiList注册的回调中返回wifiList数据。"
2235 | },
2236 | "wx.onGetWifiList": {
2237 | "prefix": "wx-onGetWifiList",
2238 | "body": ["wx.onGetWifiList((result) => {",
2239 | "\t${1}",
2240 | "});"
2241 | ],
2242 | "description": "监听在获取到Wi-Fi列表数据时的事件,在回调中将返回wifiList。"
2243 | },
2244 | "wx.setWifiList": {
2245 | "prefix": "wx-setWifiList",
2246 | "body": [
2247 | "wx.setWifiList({",
2248 | "\twifiList: [",
2249 | "\t\t{",
2250 | "\t\t\tSSID: ${1},",
2251 | "\t\t\tBSSID: ${2},",
2252 | "\t\t\tpassword: ${3}",
2253 | "\t\t}",
2254 | "\t],",
2255 | "\tsuccess: (result)=>{",
2256 | "\t\t${4}",
2257 | "\t},",
2258 | "\tfail: ()=>{},",
2259 | "\tcomplete: ()=>{}",
2260 | "});"
2261 | ],
2262 | "description": "iOS特有接口,在 onGetWifiList 回调后,利用接口设置 wifiList 中 AP 的相关信息。"
2263 | },
2264 | "wx.onWifiConnected": {
2265 | "prefix": "wx-onWifiConnected",
2266 | "body": ["wx.onWifiConnected((result) => {",
2267 | "\t${1}",
2268 | "});"
2269 | ],
2270 | "description": "监听连接上Wi-Fi的事件。"
2271 | },
2272 | "wx.getConnectedWifi": {
2273 | "prefix": "wx-getConnectedWifi",
2274 | "body": [
2275 | "wx.getConnectedWifi({",
2276 | "\tsuccess: (result)=>{",
2277 | "\t\t${1}",
2278 | "\t},",
2279 | "\tfail: ()=>{},",
2280 | "\tcomplete: ()=>{}",
2281 | "});"
2282 | ],
2283 | "description": "获取已连接中的Wi-Fi信息"
2284 | },
2285 | "wx.showToast": {
2286 | "prefix": "wx-showToast",
2287 | "body": [
2288 | "wx.showToast({",
2289 | "\ttitle: '${1}',",
2290 | "\ticon: '${2:none}',",
2291 | "\timage: '${3}',",
2292 | "\tduration: ${4:1500},",
2293 | "\tmask: ${5:false},",
2294 | "\tsuccess: (result)=>{",
2295 | "\t\t${6}",
2296 | "\t},",
2297 | "\tfail: ()=>{},",
2298 | "\tcomplete: ()=>{}",
2299 | "});"
2300 | ],
2301 | "description": "显示消息提示框"
2302 | },
2303 | "wx.showLoading": {
2304 | "prefix": "wx-showLoading",
2305 | "body": [
2306 | "wx.showLoading({",
2307 | "\ttitle: ${1},",
2308 | "\tmask: ${2:true},",
2309 | "\tsuccess: (result)=>{",
2310 | "\t\t${3}",
2311 | "\t},",
2312 | "\tfail: ()=>{},",
2313 | "\tcomplete: ()=>{}",
2314 | "});"
2315 | ],
2316 | "description": "显示loading提示框, 需主动调用wx.hideLoading才能关闭提示框"
2317 | },
2318 | "wx.hideToast": {
2319 | "prefix": "wx-hideToast",
2320 | "body": ["wx.hideToast();"],
2321 | "description": "隐藏消息提示框"
2322 | },
2323 | "wx.hideLoading": {
2324 | "prefix": "wx-hideLoading",
2325 | "body": ["wx.hideLoading();"],
2326 | "description": "隐藏loading提示框"
2327 | },
2328 | "wx.showModal": {
2329 | "prefix": "wx-showModal",
2330 | "body": [
2331 | "wx.showModal({",
2332 | "\ttitle: '${1}',",
2333 | "\tcontent: '${2}',",
2334 | "\tshowCancel: ${3:true},",
2335 | "\tcancelText: '${4:取消}',",
2336 | "\tcancelColor: '${5:#000000}',",
2337 | "\tconfirmText: '${6:确定}',",
2338 | "\tconfirmColor: '${7:#3CC51F}',",
2339 | "\tsuccess: (result) => {",
2340 | "\t\t${8:if(result.confirm){",
2341 | "\t\t\t${9}",
2342 | "\t\t}}",
2343 | "\t},",
2344 | "\tfail: ()=>{},",
2345 | "\tcomplete: ()=>{}",
2346 | "});"
2347 | ],
2348 | "description": "显示模态弹窗"
2349 | },
2350 | "wx.showActionSheet": {
2351 | "prefix": "wx-showActionSheet",
2352 | "body": [
2353 | "wx.showActionSheet({",
2354 | "\titemList: [${1}],",
2355 | "\titemColor: '${2:#000000}',",
2356 | "\tsuccess: (result)=>{",
2357 | "\t\t${3}",
2358 | "\t},",
2359 | "\tfail: ()=>{},",
2360 | "\tcomplete: ()=>{}",
2361 | "});"
2362 | ],
2363 | "description": "显示操作菜单"
2364 | },
2365 | "wx.onWindowResize": {
2366 | "prefix": "wx-onWindowResize",
2367 | "body": [
2368 | "wx.onWindowResize((result)=>{",
2369 | "\t\t${1}",
2370 | "\t});"
2371 | ],
2372 | "description": "监听窗口尺寸变化事件"
2373 | },
2374 | "wx.offWindowResize": {
2375 | "prefix": "wx-offWindowResize",
2376 | "body": [
2377 | "wx.offWindowResize((result)=>{",
2378 | "\t\t${1}",
2379 | "\t});"
2380 | ],
2381 | "description": "取消监听窗口尺寸变化事件"
2382 | },
2383 | "wx.setTopBarText": {
2384 | "prefix": "wx-setTopBarText",
2385 | "body": ["wx.setTopBarText({",
2386 | "\ttext: '${1}',",
2387 | "\tsuccess: (result)=>{",
2388 | "\t\t${2}",
2389 | "\t},",
2390 | "\tfail: ()=>{},",
2391 | "\tcomplete: ()=>{}",
2392 | "});"
2393 | ],
2394 | "description": "动态设置置顶栏文字内容,只有当前小程序被置顶时能生效,如果当前小程序没有被置顶,也能调用成功,但是不会立即生效,只有在用户将这个小程序置顶后才换上设置的文字内容。"
2395 | },
2396 | "wx.setNavigationBarTitle": {
2397 | "prefix": "wx-setNavigationBarTitle",
2398 | "body": ["wx.setNavigationBarTitle({",
2399 | "\ttitle: '${1}',",
2400 | "\tsuccess: (result)=>{",
2401 | "\t\t${2}",
2402 | "\t},",
2403 | "\tfail: ()=>{},",
2404 | "\tcomplete: ()=>{}",
2405 | "});"
2406 | ],
2407 | "description": "动态设置当前页面的标题。"
2408 | },
2409 | "wx.showNavigationBarLoading": {
2410 | "prefix": "wx-showNavigationBarLoading",
2411 | "body": ["wx.showNavigationBarLoading();"],
2412 | "description": "在当前页面显示导航条加载动画。"
2413 | },
2414 | "wx.hideNavigationBarLoading": {
2415 | "prefix": "wx-hideNavigationBarLoading",
2416 | "body": ["wx.hideNavigationBarLoading();"],
2417 | "description": "隐藏导航条加载动画。"
2418 | },
2419 | "wx.setNavigationBarColor": {
2420 | "prefix": "wx-setNavigationBarColor",
2421 | "body": [
2422 | "wx.setNavigationBarColor({",
2423 | "\tfrontColor: '${1:#ffffff}',",
2424 | "\tbackgroundColor: '${2:#000000}',",
2425 | "\tanimation: {",
2426 | "\t\tduration: ${3:0},",
2427 | "\t\ttimingFunc: '${4:linear}'",
2428 | "\t},",
2429 | "\tsuccess: (result)=>{",
2430 | "\t\t${5}",
2431 | "\t},",
2432 | "\tfail: ()=>{},",
2433 | "\tcomplete: ()=>{}",
2434 | "});"
2435 | ],
2436 | "description": "设置导航栏颜色"
2437 | },
2438 | "wx.setTabBarBadge": {
2439 | "prefix": "wx-setTabBarBadge",
2440 | "body": [
2441 | "wx.setTabBarBadge({",
2442 | "\tindex: ${1},",
2443 | "\ttext: '${2}',",
2444 | "\tsuccess: (result)=>{",
2445 | "\t\t${3}",
2446 | "\t},",
2447 | "\tfail: ()=>{},",
2448 | "\tcomplete: ()=>{}",
2449 | "});"
2450 | ],
2451 | "description": "为tabBar某一项的右上角添加文本"
2452 | },
2453 | "wx.removeTabBarBadge": {
2454 | "prefix": "wx-removeTabBarBadge",
2455 | "body": ["wx.removeTabBarBadge({",
2456 | "\tindex: ${1},",
2457 | "\tsuccess: (result)=>{",
2458 | "\t\t${2}",
2459 | "\t},",
2460 | "\tfail: ()=>{},",
2461 | "\tcomplete: ()=>{}",
2462 | "});"
2463 | ],
2464 | "description": "移除tabBar某一项右上角的文本"
2465 | },
2466 | "wx.showTabBarRedDot": {
2467 | "prefix": "wx-showTabBarRedDot",
2468 | "body": ["wx.showTabBarRedDot({",
2469 | "\tindex: ${1},",
2470 | "\tsuccess: (result)=>{",
2471 | "\t\t${2}",
2472 | "\t},",
2473 | "\tfail: ()=>{},",
2474 | "\tcomplete: ()=>{}",
2475 | "});"
2476 | ],
2477 | "description": "显示tabBar某一项的右上角的红点"
2478 | },
2479 | "wx.hideTabBarRedDot": {
2480 | "prefix": "wx-hideTabBarRedDot",
2481 | "body": ["wx.hideTabBarRedDot({",
2482 | "\tindex: ${1},",
2483 | "\tsuccess: (result)=>{",
2484 | "\t\t${2}",
2485 | "\t},",
2486 | "\tfail: ()=>{},",
2487 | "\tcomplete: ()=>{}",
2488 | "});"
2489 | ],
2490 | "description": "隐藏tabBar某一项的右上角的红点"
2491 | },
2492 | "wx.setTabBarStyle": {
2493 | "prefix": "wx-setTabBarStyle",
2494 | "body": [
2495 | "wx.setTabBarStyle({",
2496 | "\tcolor: '${1:#000000}',",
2497 | "\tselectedColor: '${2:#1AAD16}',",
2498 | "\tbackgroundColor: '${3:#e3e3e3}',",
2499 | "\tborderStyle: '${4:black}',",
2500 | "\tsuccess: (result)=>{",
2501 | "\t\t${2}",
2502 | "\t},",
2503 | "\tfail: ()=>{},",
2504 | "\tcomplete: ()=>{}",
2505 | "});"
2506 | ],
2507 | "description": "动态设置tabBar的整体样式"
2508 | },
2509 | "wx.setTabBarItem": {
2510 | "prefix": "wx-setTabBarItem",
2511 | "body": [
2512 | "wx.setTabBarItem({",
2513 | "\tindex: ${1},",
2514 | "\ttext: ${2},",
2515 | "\ticonPath: ${3},",
2516 | "\tselectedIconPath: ${4},",
2517 | "\tsuccess: (result)=>{",
2518 | "\t\t${5}",
2519 | "\t},",
2520 | "\tfail: ()=>{},",
2521 | "\tcomplete: ()=>{}",
2522 | "});"
2523 | ],
2524 | "description": "动态设置tabBar某一项的内容"
2525 | },
2526 | "wx.showTabBar": {
2527 | "prefix": "wx-showTabBar",
2528 | "body": ["wx.showTabBar({",
2529 | "\tanimation: ${1:false},",
2530 | "\tsuccess: (result)=>{",
2531 | "\t\t${2}",
2532 | "\t},",
2533 | "\tfail: ()=>{},",
2534 | "\tcomplete: ()=>{}",
2535 | "});"
2536 | ],
2537 | "description": "显示 tabBar"
2538 | },
2539 | "wx.hideTabBar": {
2540 | "prefix": "wx-hideTabBar",
2541 | "body": ["wx.hideTabBar({",
2542 | "\tanimation: ${1:false},",
2543 | "\tsuccess: (result)=>{",
2544 | "\t\t${2}",
2545 | "\t},",
2546 | "\tfail: ()=>{},",
2547 | "\tcomplete: ()=>{}",
2548 | "});"
2549 | ],
2550 | "description": "隐藏 tabBar"
2551 | },
2552 | "wx.setBackgroundColor": {
2553 | "prefix": "wx-setBackgroundColor",
2554 | "body": ["wx.setBackgroundColor({",
2555 | "\tbackgroundColor: '${1}',",
2556 | "\tbackgroundColorTop: '${2}',",
2557 | "\tbackgroundColorBottom: '${3}'",
2558 | "});"
2559 | ],
2560 | "description": "动态设置窗口的背景色"
2561 | },
2562 | "wx.setBackgroundTextStyle": {
2563 | "prefix": "wx-setBackgroundTextStyle",
2564 | "body": [
2565 | "wx.setBackgroundTextStyle({",
2566 | "\ttextStyle: '${1:dark}'",
2567 | "});"
2568 | ],
2569 | "description": "动态设置下拉背景字体、loading图的样式"
2570 | },
2571 | "wx.navigateTo": {
2572 | "prefix": "wx-navigateTo",
2573 | "body": ["wx.navigateTo({",
2574 | "\turl: '${1}',",
2575 | "\tsuccess: (result)=>{",
2576 | "\t\t${2}",
2577 | "\t},",
2578 | "\tfail: ()=>{},",
2579 | "\tcomplete: ()=>{}",
2580 | "});"
2581 | ],
2582 | "description": "保留当前页面,跳转到应用内的某个页面,使用wx.navigateBack可以返回到原页面。目前页面路径最多只能十层。"
2583 | },
2584 | "wx.redirectTo": {
2585 | "prefix": "wx-redirectTo",
2586 | "body": ["wx.redirectTo({",
2587 | "\turl: '${1}',",
2588 | "\tsuccess: (result)=>{",
2589 | "\t\t${2}",
2590 | "\t},",
2591 | "\tfail: ()=>{},",
2592 | "\tcomplete: ()=>{}",
2593 | "});"
2594 | ],
2595 | "description": "关闭当前页面,跳转到应用内的某个页面。"
2596 | },
2597 | "wx.reLaunch": {
2598 | "prefix": "wx-reLaunch",
2599 | "body": ["wx.reLaunch({",
2600 | "\turl: '${1}',",
2601 | "\tsuccess: (result)=>{",
2602 | "\t\t${2}",
2603 | "\t},",
2604 | "\tfail: ()=>{},",
2605 | "\tcomplete: ()=>{}",
2606 | "});"
2607 | ],
2608 | "description": "关闭所有页面,打开到应用内的某个页面。"
2609 | },
2610 | "wx.switchTab": {
2611 | "prefix": "wx-switchTab",
2612 | "body": ["wx.switchTab({",
2613 | "\turl: '${1}',",
2614 | "\tsuccess: (result)=>{",
2615 | "\t\t${2}",
2616 | "\t},",
2617 | "\tfail: ()=>{},",
2618 | "\tcomplete: ()=>{}",
2619 | "});"
2620 | ],
2621 | "description": "跳转到tabBar页面,并关闭其他所有非tabBar页面"
2622 | },
2623 | "wx.navigateBack": {
2624 | "prefix": "wx-navigateBack",
2625 | "body": ["wx.navigateBack({",
2626 | "\tdelta: ${1:1}",
2627 | "});"
2628 | ],
2629 | "description": "关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages()) 获取当前的页面栈,决定需要返回几层。"
2630 | },
2631 | "wx.createAnimation": {
2632 | "prefix": "wx-createAnimation",
2633 | "body": [
2634 | "${1:let animation = }wx.createAnimation({",
2635 | "\tduration: ${2:400},",
2636 | "\ttimingFunction: '${3:linear}',",
2637 | "\tdelay: ${4:0},",
2638 | "\ttransformOrigin: '${5:50% 50% 0}'",
2639 | "});"
2640 | ],
2641 | "description": "创建一个动画实例animation。调用实例的方法来描述动画。"
2642 | },
2643 |
2644 | "animation.opacity": {
2645 | "prefix": "animation-opacity",
2646 | "body": ["animation.opacity(${1});"],
2647 | "description": "透明度,参数范围 0~1"
2648 | },
2649 | "animation.backgroundColor": {
2650 | "prefix": "animation-backgroundColor",
2651 | "body": ["animation.backgroundColor(${1});"],
2652 | "description": "颜色值"
2653 | },
2654 | "animation.width": {
2655 | "prefix": "animation-width",
2656 | "body": ["animation.width(${1});"],
2657 | "description": "宽度"
2658 | },
2659 | "animation.height": {
2660 | "prefix": "animation-height",
2661 | "body": ["animation.height(${1});"],
2662 | "description": "长度"
2663 | },
2664 | "animation.top": {
2665 | "prefix": "animation-top",
2666 | "body": ["animation.top(${1});"],
2667 | "description": "顶部距离"
2668 | },
2669 | "animation.left": {
2670 | "prefix": "animation-left",
2671 | "body": ["animation.height(${1});"],
2672 | "description": "左侧距离"
2673 | },
2674 | "animation.bottom": {
2675 | "prefix": "animation-bottom",
2676 | "body": ["animation.bottom(${1});"],
2677 | "description": "底部距离"
2678 | },
2679 | "animation.right": {
2680 | "prefix": "animation-right",
2681 | "body": ["animation.right(${1});"],
2682 | "description": "右侧距离"
2683 | },
2684 | "animation.rotate": {
2685 | "prefix": "animation-rotate",
2686 | "body": ["animation.rotate(${1});"],
2687 | "description": "绕原点旋转"
2688 | },
2689 | "animation.rotateX": {
2690 | "prefix": "animation-rotateX",
2691 | "body": ["animation.rotateX(${1});"],
2692 | "description": "绕x轴旋转"
2693 | },
2694 | "animation.rotateY": {
2695 | "prefix": "animation-rotateY",
2696 | "body": ["animation.rotateY(${1});"],
2697 | "description": "绕y轴旋转"
2698 | },
2699 | "animation.rotateZ": {
2700 | "prefix": "animation-rotateZ",
2701 | "body": ["animation.rotateZ(${1});"],
2702 | "description": "绕z轴旋转"
2703 | },
2704 | "animation.rotate3d": {
2705 | "prefix": "animation-rotate3d",
2706 | "body": ["animation.rotate3d(${1},${2},${3},${4});"],
2707 | "description": "3d旋转"
2708 | },
2709 | "animation.scale": {
2710 | "prefix": "animation-scale",
2711 | "body": ["animation.scale(${1}${2:,});"],
2712 | "description": "x轴[y轴]缩放。一个参数时,表示在X轴、Y轴两个相同;两个参数时表示在X轴,在Y轴不同"
2713 | },
2714 | "animation.scaleX": {
2715 | "prefix": "animation-scaleX",
2716 | "body": ["animation.scaleX(${1});"],
2717 | "description": "x轴缩放"
2718 | },
2719 | "animation.scaleY": {
2720 | "prefix": "animation-scaleY",
2721 | "body": ["animation.scaleY(${1});"],
2722 | "description": "y轴缩放"
2723 | },
2724 | "animation.scaleZ": {
2725 | "prefix": "animation-scaleZ",
2726 | "body": ["animation.scaleZ(${1});"],
2727 | "description": "z轴缩放"
2728 | },
2729 | "animation.scale3d": {
2730 | "prefix": "animation-scale3d",
2731 | "body": ["animation.scale3d(${1},${2},${3});"],
2732 | "description": "3d缩放"
2733 | },
2734 | "animation.translate": {
2735 | "prefix": "animation-translate",
2736 | "body": ["animation.translate(${1}${2:,});"],
2737 | "description": "x轴[y轴]偏移。一个参数时,表示在X轴;两个参数时表示在X轴,在Y轴"
2738 | },
2739 | "animation.translateX": {
2740 | "prefix": "animation-translateX",
2741 | "body": ["animation.translateX(${1});"],
2742 | "description": "x轴偏移"
2743 | },
2744 | "animation.translateY": {
2745 | "prefix": "animation-translateY",
2746 | "body": ["animation.translateY(${1});"],
2747 | "description": "y轴偏移"
2748 | },
2749 | "animation.translateZ": {
2750 | "prefix": "animation-translateZ",
2751 | "body": ["animation.translateZ(${1});"],
2752 | "description": "z轴偏移"
2753 | },
2754 | "animation.translate3d": {
2755 | "prefix": "animation-translate3d",
2756 | "body": ["animation.translate3d(${1},${2},${3});"],
2757 | "description": "3d偏移"
2758 | },
2759 | "animation.skew": {
2760 | "prefix": "animation-skew",
2761 | "body": ["animation.skew(${1}${2:,});"],
2762 | "description": "x轴[y轴]倾斜。一个参数时,表示在X轴;两个参数时表示在X轴,在Y轴"
2763 | },
2764 | "animation.skewX": {
2765 | "prefix": "animation-skewX",
2766 | "body": ["animation.skewX(${1});"],
2767 | "description": "x轴倾斜"
2768 | },
2769 | "animation.skewY": {
2770 | "prefix": "animation-skewY",
2771 | "body": ["animation.skewY(${1});"],
2772 | "description": "y轴倾斜"
2773 | },
2774 | "animation.matrix": {
2775 | "prefix": "animation-matrix",
2776 | "body": ["animation.matrix(${1},${2},${3},${4},${5},${6});"],
2777 | "description": "平面矩阵变换"
2778 | },
2779 | "animation.matrix3d": {
2780 | "prefix": "animation-matrix3d",
2781 | "body": ["animation.matrix3d(${1},${2},${3},${4},${5},${6},${7},${8},${9},${10},${11},${12},${13},${14},${15},${16});"],
2782 | "description": "立体矩阵变换"
2783 | },
2784 | "wx.pageScrollTo": {
2785 | "prefix": "wx-pageScrollTo",
2786 | "body": [
2787 | "wx.pageScrollTo({",
2788 | "\tscrollTop: ${1:0},",
2789 | "\tduration: ${2:300}",
2790 | "});"
2791 | ],
2792 | "description": "将页面滚动到目标位置。"
2793 | },
2794 | "wx.startPullDownRefresh": {
2795 | "prefix": "wx-startPullDownRefresh",
2796 | "body": ["wx.startPullDownRefresh({",
2797 | "\tsuccess: (result)=>{",
2798 | "\t\t${1}",
2799 | "\t},",
2800 | "\tfail: ()=>{},",
2801 | "\tcomplete: ()=>{}",
2802 | "});"
2803 | ],
2804 | "description": "开始下拉刷新,调用后触发下拉刷新动画,效果与用户手动下拉刷新一致"
2805 | },
2806 | "wx.stopPullDownRefresh": {
2807 | "prefix": "wx-stopPullDownRefresh",
2808 | "body": ["wx.stopPullDownRefresh"],
2809 | "description": "停止当前页面下拉刷新。"
2810 | },
2811 | "wx.getExtConfig": {
2812 | "prefix": "wx-getExtConfig",
2813 | "body": ["wx.getExtConfig({",
2814 | "\tsuccess: (result)=>{",
2815 | "\t\t${1}",
2816 | "\t},",
2817 | "\tfail: ()=>{},",
2818 | "\tcomplete: ()=>{}",
2819 | "});"
2820 | ],
2821 | "description": "获取第三方平台自定义的数据字段"
2822 | },
2823 | "wx.getExtConfigSync": {
2824 | "prefix": "wx-getExtConfigSync",
2825 | "body": ["${1:let extConfig = }wx.getExtConfigSync();"],
2826 | "description": "同步获取第三方平台自定义的数据字段"
2827 | },
2828 | "wx.login": {
2829 | "prefix": "wx-login",
2830 | "body": ["wx.login({",
2831 | "\ttimeout:${1:10000},",
2832 | "\tsuccess: (result)=>{",
2833 | "\t\t${2}",
2834 | "\t},",
2835 | "\tfail: ()=>{},",
2836 | "\tcomplete: ()=>{}",
2837 | "});"
2838 | ],
2839 | "description": "调用接口wx.login() 获取临时登录凭证(code)"
2840 | },
2841 | "wx.checkSession": {
2842 | "prefix": "wx-checkSession",
2843 | "body": [
2844 | "wx.checkSession({",
2845 | "\tsuccess: (result)=>{",
2846 | "\t\t${1}",
2847 | "\t},",
2848 | "\tfail: ()=>{},",
2849 | "\tcomplete: ()=>{}",
2850 | "});"
2851 | ],
2852 | "description": "校验用户当前session_key是否有效。"
2853 | },
2854 | "wx.authorize": {
2855 | "prefix": "wx-authorize",
2856 | "body": [
2857 | "wx.authorize({",
2858 | "\tscope: '${1}',",
2859 | "\tsuccess: (result)=>{",
2860 | "\t\t${2}",
2861 | "\t},",
2862 | "\tfail: ()=>{},",
2863 | "\tcomplete: ()=>{}",
2864 | "});"
2865 | ],
2866 | "description": "提前向用户发起授权请求。调用后会立刻弹窗询问用户是否同意授权小程序使用某项功能或获取用户的某些数据,但不会实际调用对应接口。如果用户之前已经同意授权,则不会出现弹窗,直接返回成功。"
2867 | },
2868 | "wx.getUserInfo": {
2869 | "prefix": "wx-getUserInfo",
2870 | "body": [
2871 | "wx.getUserInfo({",
2872 | "\twithCredentials: '${1:false}',",
2873 | "\tlang: '${2:zh_CN}',",
2874 | "\ttimeout:${3:10000},",
2875 | "\tsuccess: (result)=>{",
2876 | "\t\t${4}",
2877 | "\t},",
2878 | "\tfail: ()=>{},",
2879 | "\tcomplete: ()=>{}",
2880 | "});"
2881 | ],
2882 | "description": "当用户未授权过,调用该接口将直接报错;当用户授权过,可以使用该接口获取用户信息"
2883 | },
2884 | "wx.faceVerifyForPay": {
2885 | "prefix": "wx-faceVerifyForPay",
2886 | "body": [
2887 | "wx.faceVerifyForPay({",
2888 | "\tscene: '${1}',",
2889 | "\tpackage: '${2}',",
2890 | "\tpackageSign: '${3}',",
2891 | "\totherVerifyTitle: '${4}',",
2892 | "\tsuccess: (result)=>{",
2893 | "\t\t${5}",
2894 | "\t},",
2895 | "\tfail: ()=>{},",
2896 | "\tcomplete: ()=>{}",
2897 | "});"
2898 | ],
2899 | "description": "支付各个安全场景验证人脸。"
2900 | },
2901 | "wx.requestPayment": {
2902 | "prefix": "wx-requestPayment",
2903 | "body": [
2904 | "wx.requestPayment({",
2905 | "\ttimeStamp: '${1}',",
2906 | "\tnonceStr: '${2}',",
2907 | "\tpackage: '${3}',",
2908 | "\tsignType: '${4}',",
2909 | "\tpaySign: '${5}',",
2910 | "\tsuccess: (result)=>{",
2911 | "\t\t${6}",
2912 | "\t},",
2913 | "\tfail: ()=>{},",
2914 | "\tcomplete: ()=>{}",
2915 | "});"
2916 | ],
2917 | "description": "发起微信支付。"
2918 | },
2919 | "wx.showShareMenu": {
2920 | "prefix": "wx-showShareMenu",
2921 | "body": [
2922 | "wx.showShareMenu({",
2923 | "\twithShareTicket: ${1:false}",
2924 | "\tsuccess: (result)=>{",
2925 | "\t\t${2}",
2926 | "\t},",
2927 | "\tfail: ()=>{},",
2928 | "\tcomplete: ()=>{}",
2929 | "});"
2930 | ],
2931 | "description": "显示当前页面的转发按钮"
2932 | },
2933 | "wx.hideShareMenu": {
2934 | "prefix": "wx-hideShareMenu",
2935 | "body": ["wx.hideShareMenu({",
2936 | "\tsuccess: (result)=>{",
2937 | "\t\t${1}",
2938 | "\t},",
2939 | "\tfail: ()=>{},",
2940 | "\tcomplete: ()=>{}",
2941 | "});"
2942 | ],
2943 | "description": "隐藏转发按钮"
2944 | },
2945 | "wx.updateShareMenu": {
2946 | "prefix": "wx-updateShareMenu",
2947 | "body": [
2948 | "wx.updateShareMenu({",
2949 | "\twithShareTicket: ${1:false}",
2950 | "\tsuccess: (result)=>{",
2951 | "\t\t${2}",
2952 | "\t},",
2953 | "\tfail: ()=>{},",
2954 | "\tcomplete: ()=>{}",
2955 | "});"
2956 | ],
2957 | "description": "更新转发属性"
2958 | },
2959 | "wx.getShareInfo": {
2960 | "prefix": "wx-getShareInfo",
2961 | "body": [
2962 | "wx.getShareInfo({",
2963 | "\tshareTicket: ${1},",
2964 | "\ttimeout:${2:10000},",
2965 | "\tsuccess: (result)=>{",
2966 | "\t\t${3}",
2967 | "\t},",
2968 | "\tfail: ()=>{},",
2969 | "\tcomplete: ()=>{}",
2970 | "});"
2971 | ],
2972 | "description": "获取转发详细信息"
2973 | },
2974 | "wx.getAccountInfoSync": {
2975 | "prefix": "wx-getAccountInfoSync",
2976 | "body": [
2977 | "${1:let accInfo = }wx.getAccountInfoSync();"
2978 | ],
2979 | "description": "获取当前账号信息"
2980 | },
2981 | "wx.chooseAddress": {
2982 | "prefix": "wx-chooseAddress",
2983 | "body": ["wx.chooseAddress({",
2984 | "\tsuccess: (result)=>{",
2985 | "\t\t${1}",
2986 | "\t},",
2987 | "\tfail: ()=>{},",
2988 | "\tcomplete: ()=>{}",
2989 | "});"
2990 | ],
2991 | "description": "调起用户编辑收货地址原生界面,并在编辑完成后返回用户选择的地址。"
2992 | },
2993 | "wx.addCard": {
2994 | "prefix": "wx-addCard",
2995 | "body": [
2996 | "wx.addCard({",
2997 | "\tcardList: [${1}],",
2998 | "\tsuccess: (result)=>{",
2999 | "\t\t${2}",
3000 | "\t},",
3001 | "\tfail: ()=>{},",
3002 | "\tcomplete: ()=>{}",
3003 | "});"
3004 | ],
3005 | "description": "批量添加卡券"
3006 | },
3007 | "wx.openCard": {
3008 | "prefix": "wx-openCard",
3009 | "body": [
3010 | "wx.openCard({",
3011 | "\tcardList: [${1}],",
3012 | "\tsuccess: (result)=>{",
3013 | "\t\t${2}",
3014 | "\t},",
3015 | "\tfail: ()=>{},",
3016 | "\tcomplete: ()=>{}",
3017 | "});"
3018 | ],
3019 | "description": "查看微信卡包中的卡券"
3020 | },
3021 | "wx.openSetting": {
3022 | "prefix": "wx-openSetting",
3023 | "body": ["wx.openSetting({",
3024 | "\tsuccess: (result)=>{",
3025 | "\t\t${1}",
3026 | "\t},",
3027 | "\tfail: ()=>{},",
3028 | "\tcomplete: ()=>{}",
3029 | "});"
3030 | ],
3031 | "description": "调起客户端小程序设置界面,返回用户设置的操作结果"
3032 | },
3033 | "wx.getSetting": {
3034 | "prefix": "wx-getSetting",
3035 | "body": ["wx.getSetting({",
3036 | "\tsuccess: (result)=>{",
3037 | "\t\t${1}",
3038 | "\t},",
3039 | "\tfail: ()=>{},",
3040 | "\tcomplete: ()=>{}",
3041 | "});"
3042 | ],
3043 | "description": "获取用户的当前设置"
3044 | },
3045 | "wx.getWeRunData": {
3046 | "prefix": "wx-getWeRunData",
3047 | "body": ["wx.getWeRunData({",
3048 | "\ttimeout:${1:10000},",
3049 | "\tsuccess: (result)=>{",
3050 | "\t\t${2}",
3051 | "\t},",
3052 | "\tfail: ()=>{},",
3053 | "\tcomplete: ()=>{}",
3054 | "});"
3055 | ],
3056 | "description": "获取用户过去三十天微信运动步数,需要先调用 wx.login 接口"
3057 | },
3058 | "wx.navigateToMiniProgram": {
3059 | "prefix": "wx-navigateToMiniProgram",
3060 | "body": ["wx.navigateToMiniProgram({",
3061 | "\tappId:'${1}',",
3062 | "\tpath:'${2}',",
3063 | "\textraData:{${3}},",
3064 | "\tenvVersion:'${4:release}',",
3065 | "\tsuccess: (result)=>{",
3066 | "\t\t${5}",
3067 | "\t},",
3068 | "\tfail: ()=>{},",
3069 | "\tcomplete: ()=>{}",
3070 | "});"
3071 | ],
3072 | "description": "打开同一公众号下关联的另一个小程序"
3073 | },
3074 | "wx.navigateBackMiniProgram": {
3075 | "prefix": "wx-navigateBackMiniProgram",
3076 | "body": ["wx.navigateBackMiniProgram({",
3077 | "\textraData:{${1}},",
3078 | "\tsuccess: (result)=>{",
3079 | "\t\t${2}",
3080 | "\t},",
3081 | "\tfail: ()=>{},",
3082 | "\tcomplete: ()=>{}",
3083 | "});"
3084 | ],
3085 | "description": "返回到上一个小程序,只有在当前小程序是被其他小程序打开时可以调用成功"
3086 | },
3087 | "wx.chooseInvoice": {
3088 | "prefix": "wx-chooseInvoice",
3089 | "body": ["wx.chooseInvoice({",
3090 | "\tsuccess: (result)=>{",
3091 | "\t\t${1}",
3092 | "\t},",
3093 | "\tfail: ()=>{},",
3094 | "\tcomplete: ()=>{}",
3095 | "});"
3096 | ],
3097 | "description": "选择用户已有的发票"
3098 | },
3099 | "wx.chooseInvoiceTitle": {
3100 | "prefix": "wx-chooseInvoiceTitle",
3101 | "body": ["wx.chooseInvoiceTitle({",
3102 | "\tsuccess: (result)=>{",
3103 | "\t\t${1}",
3104 | "\t},",
3105 | "\tfail: ()=>{},",
3106 | "\tcomplete: ()=>{}",
3107 | "});"
3108 | ],
3109 | "description": "选择用户的发票抬头"
3110 | },
3111 | "wx.checkIsSupportSoterAuthentication": {
3112 | "prefix": "wx-checkIsSupportSoterAuthentication",
3113 | "body": ["wx.checkIsSupportSoterAuthentication({",
3114 | "\tsuccess: (result)=>{",
3115 | "\t\t${1}",
3116 | "\t},",
3117 | "\tfail: ()=>{},",
3118 | "\tcomplete: ()=>{}",
3119 | "});"
3120 | ],
3121 | "description": "获取本机支持的SOTER生物认证方式"
3122 | },
3123 | "wx.startSoterAuthentication": {
3124 | "prefix": "wx-startSoterAuthentication",
3125 | "body": ["wx.startSoterAuthentication({",
3126 | "\trequestAuthModes:['fingerPrint'],",
3127 | "\tchallenge:'${1}',",
3128 | "\tauthContent:'${2}',",
3129 | "\tsuccess: (result)=>{",
3130 | "\t\t${3}",
3131 | "\t},",
3132 | "\tfail: ()=>{},",
3133 | "\tcomplete: ()=>{}",
3134 | "});"
3135 | ],
3136 | "description": "开始SOTER生物认证"
3137 | },
3138 | "wx.checkIsSoterEnrolledInDevice": {
3139 | "prefix": "wx-checkIsSoterEnrolledInDevice",
3140 | "body": ["wx.checkIsSoterEnrolledInDevice({",
3141 | "\tcheckAuthMode:{${1}},",
3142 | "\tsuccess: (result)=>{",
3143 | "\t\t${2}",
3144 | "\t},",
3145 | "\tfail: ()=>{},",
3146 | "\tcomplete: ()=>{}",
3147 | "});"
3148 | ],
3149 | "description": "获取设备内是否录入如指纹等生物信息的接口"
3150 | },
3151 | "wx.getUpdateManager": {
3152 | "prefix": "wx-getUpdateManager",
3153 | "body": ["${1:var updateManager = }wx.getUpdateManager();"],
3154 | "description": "获取全局唯一的版本更新管理器,用于管理小程序更新。"
3155 | },
3156 | "updateManager.onCheckForUpdate": {
3157 | "prefix": "updateManager-onCheckForUpdate",
3158 | "body": ["updateManager.onCheckForUpdate((result) => {${1}});"],
3159 | "description": "当向微信后台请求完新版本信息,会进行回调"
3160 | },
3161 | "updateManager.onUpdateReady": {
3162 | "prefix": "updateManager-onUpdateReady",
3163 | "body": ["updateManager.onUpdateReady((result) => {${1}});"],
3164 | "description": "当新版本下载完成,会进行回调"
3165 | },
3166 | "updateManager.onUpdateFailed": {
3167 | "prefix": "updateManager-onUpdateFailed",
3168 | "body": ["updateManager.onUpdateFailed((result) => {${1}});"],
3169 | "description": "当新版本下载失败,会进行回调"
3170 | },
3171 | "updateManager.applyUpdate": {
3172 | "prefix": "updateManager-applyUpdate",
3173 | "body": ["updateManager.applyUpdate();"],
3174 | "description": "当新版本下载完成,调用该方法会强制当前小程序应用上新版本并重启"
3175 | },
3176 | "wx.createWorker": {
3177 | "prefix": "wx-createWorker",
3178 | "body": ["${1:var worker = }wx.createWorker(${1});"],
3179 | "description": "创建一个Worker线程,并返回Worker实例,目前限制最多只能创建一个Worker,创建下一个Worker前请调用Worker.terminate。"
3180 | },
3181 | "worker.postMessage": {
3182 | "prefix": "worker-postMessage",
3183 | "body": ["worker.postMessage(${1});"],
3184 | "description": "向Worker线程发送的消息。"
3185 | },
3186 | "worker.onMessage": {
3187 | "prefix": "worker-onMessage",
3188 | "body": ["worker.onMessage((result) => {${1}});"],
3189 | "description": "监听Worker线程向当前线程发送的消息"
3190 | },
3191 | "worker.terminate": {
3192 | "prefix": "worker-terminate",
3193 | "body": ["worker.terminate();"],
3194 | "description": "结束当前Worker线程,仅限在主线程Worker实例上调用。"
3195 | },
3196 | "wx.reportMonitor": {
3197 | "prefix": "wx-reportMonitor",
3198 | "body": ["wx.reportMonitor(${1:name},${2:value});"],
3199 | "description": "自定义业务数据监控上报接口。"
3200 | },
3201 | "wx.setEnableDebug": {
3202 | "prefix": "wx-setEnableDebug",
3203 | "body": ["wx.setEnableDebug({",
3204 | "\tenableDebug:{${1:true}},",
3205 | "\tsuccess: (result)=>{",
3206 | "\t\t${2}",
3207 | "\t},",
3208 | "\tfail: ()=>{},",
3209 | "\tcomplete: ()=>{}",
3210 | "});"
3211 | ],
3212 | "description": "设置是否打开调试开关,此开关对正式版也能生效"
3213 | },
3214 | "wx.getLogManager": {
3215 | "prefix": "wx-getLogManager",
3216 | "body": ["${1:var logger = }wx.getLogManager();"],
3217 | "description": "获取日志管理器 logManager 对象。"
3218 | },
3219 | "logger.log": {
3220 | "prefix": "logger-log",
3221 | "body": ["logger.log(${1});"],
3222 | "description": "写log日志,可以提供任意个参数。"
3223 | },
3224 | "logger.info": {
3225 | "prefix": "logger-info",
3226 | "body": ["logger.info(${1});"],
3227 | "description": "写info日志,可以提供任意个参数。"
3228 | },
3229 | "logger.warn": {
3230 | "prefix": "logger-warn",
3231 | "body": ["logger.warn(${1});"],
3232 | "description": "写warn日志,可以提供任意个参数。"
3233 | },
3234 | "logger.debug": {
3235 | "prefix": "logger-debug",
3236 | "body": ["logger.debug(${1});"],
3237 | "description": "写debug日志,可以提供任意个参数。"
3238 | },
3239 | "wx.canvasToTempFilePath": {
3240 | "prefix": "wx-canvasToTempFilePath",
3241 | "body": [
3242 | "wx.canvasToTempFilePath({",
3243 | "\tx: ${1:0},",
3244 | "\ty: ${2:0},",
3245 | "\twidth: ${3},",
3246 | "\theight: ${4},",
3247 | "\tdestWidth: ${5},",
3248 | "\tdestHeight: ${6},",
3249 | "\tcanvasId: ${7},",
3250 | "\tfileType: ${8:png},",
3251 | "\tquality: ${9:1.0},",
3252 | "\tsuccess: (result)=>{",
3253 | "\t\t${10}",
3254 | "\t},",
3255 | "\tfail: ()=>{},",
3256 | "\tcomplete: ()=>{}",
3257 | "}, this);"
3258 | ],
3259 | "description": "把当前画布指定区域的内容导出生成指定大小的图片,并返回文件路径。"
3260 | },
3261 | "wx.canvasGetImageData": {
3262 | "prefix": "wx-canvasGetImageData",
3263 | "body": [
3264 | "wx.canvasGetImageData({",
3265 | "\tcanvasId: ${1},",
3266 | "\tx: ${2:0},",
3267 | "\ty: ${3:0},",
3268 | "\twidth: ${4},",
3269 | "\theight: ${5},",
3270 | "\tsuccess: (result)=>{",
3271 | "\t\t${6}",
3272 | "\t},",
3273 | "\tfail: ()=>{},",
3274 | "\tcomplete: ()=>{}",
3275 | "}, this);"
3276 | ],
3277 | "description": "返回一个数组,用来描述 canvas 区域隐含的像素数据。"
3278 | },
3279 | "wx.canvasPutImageData": {
3280 | "prefix": "wx-canvasPutImageData",
3281 | "body": [
3282 | "wx.canvasPutImageData({",
3283 | "\tcanvasId: ${1},",
3284 | "\tdata: ${2},",
3285 | "\tx: ${3},",
3286 | "\ty: ${4},",
3287 | "\twidth: ${5},",
3288 | "\theight: ${6},",
3289 | "\tsuccess: (result)=>{",
3290 | "\t\t${7}",
3291 | "\t},",
3292 | "\tfail: ()=>{},",
3293 | "\tcomplete: ()=>{}",
3294 | "}, this);"
3295 | ],
3296 | "description": "将像素数据绘制到画布的方法。"
3297 | },
3298 | "wx.createCanvasContext": {
3299 | "prefix": "wx-createCanvasContext",
3300 | "body": [
3301 | "${1:var cvsCtx = }wx.createCanvasContext(${2:canvas-id}, this);"
3302 | ],
3303 | "description": "创建 canvas 绘图上下文(指定 canvasId)。"
3304 | },
3305 | "cvsCtx.setFillStyle": {
3306 | "prefix": "cvsCtx-setFillStyle",
3307 | "body": ["cvsCtx.setFillStyle('${1}');"],
3308 | "description": "设置填充色。"
3309 | },
3310 | "cvsCtx.fillStyle": {
3311 | "prefix": "cvsCtx-fillStyle",
3312 | "body": ["cvsCtx.fillStyle = ${1};"],
3313 | "description": "设置填充色。基础库 1.9.90 起支持"
3314 | },
3315 | "cvsCtx.setStrokeStyle": {
3316 | "prefix": "cvsCtx-setStrokeStyle",
3317 | "body": ["cvsCtx.setStrokeStyle(${1});"],
3318 | "description": "设置边框颜色。"
3319 | },
3320 | "cvsCtx.strokeStyle": {
3321 | "prefix": "cvsCtx-strokeStyle",
3322 | "body": ["cvsCtx.strokeStyle = ${1};"],
3323 | "description": "设置边框颜色。基础库 1.9.90 起支持"
3324 | },
3325 | "cvsCtx.setShadow": {
3326 | "prefix": "cvsCtx-setShadow",
3327 | "body": [
3328 | "cvsCtx.setShadow(${1:offsetX}, ${2:offsetY}, ${3:blur}, ${4:color});"
3329 | ],
3330 | "description": "设置阴影样式。"
3331 | },
3332 | "cvsCtx.createLinearGradient": {
3333 | "prefix": "cvsCtx-createLinearGradient",
3334 | "body": [
3335 | "cvsCtx.createLinearGradient(${1:x0}, ${2:y0}, ${3:x1}, ${4:y1});"
3336 | ],
3337 | "description": "创建一个线性的渐变颜色。需要使用 addColorStop() 来指定渐变点,至少要两个。"
3338 | },
3339 | "cvsCtx.createCircularGradient": {
3340 | "prefix": "cvsCtx-createCircularGradient",
3341 | "body": ["cvsCtx.createCircularGradient(${1:x}, ${2:y}, ${3:r});"],
3342 | "description": "创建一个圆形的渐变颜色。需要使用 addColorStop() 来指定渐变点,至少要两个。"
3343 | },
3344 | "cvsCtx.addColorStop": {
3345 | "prefix": "cvsCtx-addColorStop",
3346 | "body": ["cvsCtx.addColorStop(${1:stop(0 ~ 1)}, ${2:color});"],
3347 | "description": "创建一个颜色的渐变点。"
3348 | },
3349 | "cvsCtx.setLineWidth": {
3350 | "prefix": "cvsCtx-setLineWidth",
3351 | "body": ["cvsCtx.setLineWidth(${1});"],
3352 | "description": "设置线条的宽度。"
3353 | },
3354 | "cvsCtx.lineWidth": {
3355 | "prefix": "cvsCtx-lineWidth",
3356 | "body": ["cvsCtx.lineWidth = ${1};"],
3357 | "description": "设置线条的宽度。基础库 1.9.90 起支持"
3358 | },
3359 | "cvsCtx.setLineCap": {
3360 | "prefix": "cvsCtx-setLineCap",
3361 | "body": ["cvsCtx.setLineCap('${1:butt}');"],
3362 | "description": "设置线条的端点样式。"
3363 | },
3364 | "cvsCtx.lineCap": {
3365 | "prefix": "cvsCtx-lineCap",
3366 | "body": ["cvsCtx.lineCap = '${1:butt}';"],
3367 | "description": "设置线条的端点样式。基础库 1.9.90 起支持"
3368 | },
3369 | "cvsCtx.setLineJoin": {
3370 | "prefix": "cvsCtx-setLineJoin",
3371 | "body": ["cvsCtx.setLineJoin('${1:bevel}');"],
3372 | "description": "设置线条的交点样式。"
3373 | },
3374 | "cvsCtx.lineJoin": {
3375 | "prefix": "cvsCtx-lineJoin",
3376 | "body": ["cvsCtx.lineJoin = '${1:bevel}';"],
3377 | "description": "设置线条的交点样式。基础库 1.9.90 起支持"
3378 | },
3379 | "cvsCtx.setLineDash": {
3380 | "prefix": "cvsCtx-setLineDash",
3381 | "body": ["cvsCtx.setLineDash([${1:pattern}], ${2:offset});"],
3382 | "description": "设置线条的宽度。"
3383 | },
3384 | "cvsCtx.setMiterLimit": {
3385 | "prefix": "cvsCtx-setMiterLimit",
3386 | "body": ["cvsCtx.setMiterLimit(${1});"],
3387 | "description": "设置最大斜接长度,斜接长度指的是在两条线交汇处内角和外角之间的距离。 当 setLineJoin() 为 miter 时才有效。"
3388 | },
3389 | "cvsCtx.rect": {
3390 | "prefix": "cvsCtx-rect",
3391 | "body": ["cvsCtx.rect(${1:x}, ${2:y}, ${3:width}, ${4:height});"],
3392 | "description": "创建一个矩形。"
3393 | },
3394 | "cvsCtx.fillRect": {
3395 | "prefix": "cvsCtx-fillRect",
3396 | "body": ["cvsCtx.fillRect(${1:x}, ${2:y}, ${3:width}, ${4:height});"],
3397 | "description": "填充一个矩形。"
3398 | },
3399 | "cvsCtx.strokeRect": {
3400 | "prefix": "cvsCtx-strokeRect",
3401 | "body": ["cvsCtx.strokeRect(${1:x}, ${2:y}, ${3:width}, ${4:height});"],
3402 | "description": "画一个矩形(非填充)。"
3403 | },
3404 | "cvsCtx.clearRect": {
3405 | "prefix": "cvsCtx-clearRect",
3406 | "body": ["cvsCtx.clearRect(${1:x}, ${2:y}, ${3:width}, ${4:height});"],
3407 | "description": "清除画布上在该矩形区域内的内容。"
3408 | },
3409 | "cvsCtx.fill": {
3410 | "prefix": "cvsCtx-fill",
3411 | "body": ["cvsCtx.fill();"],
3412 | "description": "对当前路径中的内容进行填充。"
3413 | },
3414 | "cvsCtx.stroke": {
3415 | "prefix": "cvsCtx-stroke",
3416 | "body": ["cvsCtx.stroke();"],
3417 | "description": "画出当前路径的边框。"
3418 | },
3419 | "cvsCtx.beginPath": {
3420 | "prefix": "cvsCtx-beginPath",
3421 | "body": ["cvsCtx.beginPath();"],
3422 | "description": "开始创建一个路径,需要调用fill或者stroke才会使用路径进行填充或描边。"
3423 | },
3424 | "cvsCtx.closePath": {
3425 | "prefix": "cvsCtx-closePath",
3426 | "body": ["cvsCtx.closePath();"],
3427 | "description": "关闭一个路径"
3428 | },
3429 | "cvsCtx.moveTo": {
3430 | "prefix": "cvsCtx-moveTo",
3431 | "body": ["cvsCtx.moveTo(${1:x}, ${2:y});"],
3432 | "description": "把路径移动到画布中的指定点,不创建线条。"
3433 | },
3434 | "cvsCtx.lineTo": {
3435 | "prefix": "cvsCtx-lineTo",
3436 | "body": ["cvsCtx.lineTo(${1:x}, ${2:y});"],
3437 | "description": "lineTo 方法增加一个新点,然后创建一条从上次指定点到目标点的线。"
3438 | },
3439 | "cvsCtx.arc": {
3440 | "prefix": "cvsCtx-arc",
3441 | "body": [
3442 | "cvsCtx.arc(${1:x}, ${2:y}, ${3:r}, ${4:sAngle}, ${5:eAngle}, ${6:false});"
3443 | ],
3444 | "description": "画一条弧线。"
3445 | },
3446 | "cvsCtx.bezierCurveTo": {
3447 | "prefix": "cvsCtx-bezierCurveTo",
3448 | "body": [
3449 | "cvsCtx.bezierCurveTo(${1:cp1x}, ${2:cp1y}, ${3:cp2x}, ${4:cp2y}, ${5:x}, ${6:y});"
3450 | ],
3451 | "description": "创建三次方贝塞尔曲线路径。曲线的起始点为路径中前一个点。"
3452 | },
3453 | "cvsCtx.quadraticCurveTo": {
3454 | "prefix": "cvsCtx-quadraticCurveTo",
3455 | "body": ["cvsCtx.quadraticCurveTo(${1:cpx}, ${2:cpy}, ${3:x}, ${4:y});"],
3456 | "description": "创建二次贝塞尔曲线路径。曲线的起始点为路径中前一个点。"
3457 | },
3458 | "cvsCtx.scale": {
3459 | "prefix": "cvsCtx-scale",
3460 | "body": ["cvsCtx.scale(${1:scaleWidth}, ${2:scaleHeight});"],
3461 | "description": "在调用scale方法后,之后创建的路径其横纵坐标会被缩放。多次调用scale,倍数会相乘。"
3462 | },
3463 | "cvsCtx.rotate": {
3464 | "prefix": "cvsCtx-rotate",
3465 | "body": ["cvsCtx.rotate(${1:degrees} * Math.PI/180);"],
3466 | "description": "以原点为中心,原点可以用 translate方法修改。顺时针旋转当前坐标轴。"
3467 | },
3468 | "cvsCtx.translate": {
3469 | "prefix": "cvsCtx-translate",
3470 | "body": ["cvsCtx.translate(${1:x}, ${2:y});"],
3471 | "description": "对当前坐标系的原点(0, 0)进行变换,默认的坐标系原点为页面左上角。"
3472 | },
3473 | "cvsCtx.clip": {
3474 | "prefix": "cvsCtx-clip",
3475 | "body": ["cvsCtx.clip();"],
3476 | "description": "从原始画布中剪切任意形状和尺寸。"
3477 | },
3478 | "cvsCtx.setFontSize": {
3479 | "prefix": "cvsCtx-setFontSize",
3480 | "body": ["cvsCtx.setFontSize(${1:20});"],
3481 | "description": "设置字体的字号。"
3482 | },
3483 | "cvsCtx.fillText": {
3484 | "prefix": "cvsCtx-fillText",
3485 | "body": ["cvsCtx.fillText('${1:text}', ${2:x}, ${3:y});"],
3486 | "description": "在画布上绘制被填充的文本。"
3487 | },
3488 | "cvsCtx.setTextAlign": {
3489 | "prefix": "cvsCtx-setTextAlign",
3490 | "body": ["cvsCtx.setTextAlign('${1:center}');"],
3491 | "description": "用于设置文字的对齐"
3492 | },
3493 | "cvsCtx.textAlign": {
3494 | "prefix": "cvsCtx-textAlign",
3495 | "body": ["cvsCtx.textAlign = '${1:center}';"],
3496 | "description": "用于设置文字的对齐,基础库 1.9.90 起支持"
3497 | },
3498 | "cvsCtx.setTextBaseline": {
3499 | "prefix": "cvsCtx-setTextBaseline",
3500 | "body": ["cvsCtx.setTextBaseline('${1:middle}');"],
3501 | "description": "用于设置文字的水平对齐"
3502 | },
3503 | "cvsCtx.textBaseline": {
3504 | "prefix": "cvsCtx-textBaseline",
3505 | "body": ["cvsCtx.textBaseline = '${1:middle}';"],
3506 | "description": "用于设置文字的水平对齐,基础库 1.9.90 起支持"
3507 | },
3508 | "cvsCtx.drawImage": {
3509 | "prefix": "cvsCtx-drawImage",
3510 | "body": [
3511 | "cvsCtx.drawImage(${1:imageResource}, ${2:dx}, ${3:dy}, ${4:dWidth}, ${5:dHeight});"
3512 | ],
3513 | "description": "绘制图像到画布。"
3514 | },
3515 | "cvsCtx.setGlobalAlpha": {
3516 | "prefix": "cvsCtx-setGlobalAlpha",
3517 | "body": ["cvsCtx.setGlobalAlpha(${1:1});"],
3518 | "description": "设置全局画笔透明度。"
3519 | },
3520 | "cvsCtx.globalAlpha": {
3521 | "prefix": "cvsCtx-globalAlpha",
3522 | "body": ["cvsCtx.globalAlpha = ${1:1};"],
3523 | "description": "设置全局画笔透明度。基础库 1.9.90 起支持"
3524 | },
3525 | "cvsCtx.save": {
3526 | "prefix": "cvsCtx-save",
3527 | "body": ["cvsCtx.save();"],
3528 | "description": "保存当前的绘图上下文。"
3529 | },
3530 | "cvsCtx.restore": {
3531 | "prefix": "cvsCtx-restore",
3532 | "body": ["cvsCtx.restore();"],
3533 | "description": "恢复之前保存的绘图上下文。"
3534 | },
3535 | "cvsCtx.draw": {
3536 | "prefix": "cvsCtx-draw",
3537 | "body": ["cvsCtx.draw(${1:true}, ${2:callback});"],
3538 | "description": "将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中"
3539 | },
3540 | "cvsCtx.measureText": {
3541 | "prefix": "cvsCtx-measureText",
3542 | "body": ["${1:var metrics =}cvsCtx.measureText(${2});"],
3543 | "description": "测量文本尺寸信息,目前仅返回文本宽度。同步接口。"
3544 | },
3545 | "cvsCtx.globalCompositeOperation": {
3546 | "prefix": "cvsCtx-globalCompositeOperation",
3547 | "body": ["cvsCtx.globalCompositeOperation = ${1};"],
3548 | "description": "该属性是设置要在绘制新形状时应用的合成操作的类型。"
3549 | },
3550 | "cvsCtx.arcTo": {
3551 | "prefix": "cvsCtx-arcTo",
3552 | "body": ["cvsCtx.arcTo(${1:x1}, ${2:y1}, ${3:x2}, ${4:y2}, ${5:radius});"],
3553 | "description": "根据控制点和半径绘制圆弧路径。"
3554 | },
3555 | "cvsCtx.strokeText": {
3556 | "prefix": "cvsCtx-strokeText",
3557 | "body": ["cvsCtx.strokeText(${1:text}, ${2:x}, ${3:y});"],
3558 | "description": "给定的 (x, y) 位置绘制文本描边的方法"
3559 | },
3560 | "cvsCtx.lineDashOffset": {
3561 | "prefix": "cvsCtx-lineDashOffset",
3562 | "body": ["cvsCtx.lineDashOffset = ${1:value};"],
3563 | "description": "设置虚线偏移量的属性"
3564 | },
3565 | "cvsCtx.createPattern": {
3566 | "prefix": "cvsCtx-createPattern",
3567 | "body": ["cvsCtx.createPattern(${1:image}, ${2:repetition});"],
3568 | "description": "对指定的图像创建模式的方法,可在指定的方向上重复元图像"
3569 | },
3570 | "cvsCtx.shadowBlur": {
3571 | "prefix": "cvsCtx-shadowBlur",
3572 | "body": ["cvsCtx.shadowBlur = ${1:value};"],
3573 | "description": "设置阴影的模糊级别"
3574 | },
3575 | "cvsCtx.shadowColor": {
3576 | "prefix": "cvsCtx-shadowColor",
3577 | "body": ["cvsCtx.shadowColor = ${1:value};"],
3578 | "description": "设置阴影的颜色"
3579 | },
3580 | "cvsCtx.shadowOffsetX": {
3581 | "prefix": "cvsCtx-shadowOffsetX",
3582 | "body": ["cvsCtx.shadowOffsetX = ${1:value};"],
3583 | "description": "设置阴影相对于形状在水平方向的偏移"
3584 | },
3585 | "cvsCtx.shadowOffsetY": {
3586 | "prefix": "cvsCtx-shadowOffsetY",
3587 | "body": ["cvsCtx.shadowOffsetY = ${1:value};"],
3588 | "description": "设置阴影相对于形状在竖直方向的偏移"
3589 | },
3590 | "cvsCtx.font": {
3591 | "prefix": "cvsCtx-font",
3592 | "body": [
3593 | "cvsCtx.font = '${1:style}, ${2:weight}, ${3:size}, ${4:family}';"
3594 | ],
3595 | "description": "设置当前字体样式的属性"
3596 | },
3597 | "cvsCtx.setTransform": {
3598 | "prefix": "cvsCtx-setTransform",
3599 | "body": [
3600 | "cvsCtx.setTransform(${1:scaleX}, ${2:skewX}, ${3:skewY}, ${4:scaleY}, ${5:translateX}, ${6:translateY});"
3601 | ],
3602 | "description": "使用矩阵重新设置(覆盖)当前变换的方法"
3603 | },
3604 |
3605 | "wx.getFileSystemManager": {
3606 | "prefix": "wx-getFileSystemManager",
3607 | "body": [
3608 | "${1:var fileManager = }wx.getFileSystemManager();"
3609 | ],
3610 | "description": "获取全局唯一的文件管理器。"
3611 | },
3612 | "fileManager.appendFile": {
3613 | "prefix": "fileManager-appendFile",
3614 | "body": [
3615 | "fileManager.appendFile({",
3616 | "\tfilePath: '${1}',",
3617 | "\tdata: '${2}',",
3618 | "\tencoding:'${3:utf8}',",
3619 | "\tsuccess: (result)=>{",
3620 | "\t\t${4}",
3621 | "\t},",
3622 | "\tfail: ()=>{},",
3623 | "\tcomplete: ()=>{}",
3624 | "});"
3625 | ],
3626 | "description": "在文件结尾追加内容"
3627 | },
3628 | "fileManager.appendFileSync": {
3629 | "prefix": "fileManager-appendFileSync",
3630 | "body": [
3631 | "try{",
3632 | "\tfileManager.appendFileSync('${1}','${2}','${3:utf8}');",
3633 | "}catch(e){",
3634 | "\t${4}",
3635 | "}"
3636 | ],
3637 | "description": "在文件结尾追加内容,同步接口"
3638 | },
3639 | "fileManager.access": {
3640 | "prefix": "fileManager-access",
3641 | "body": [
3642 | "fileManager.access({",
3643 | "\tpath: '${1}',",
3644 | "\tsuccess: (result)=>{",
3645 | "\t\t${2}",
3646 | "\t},",
3647 | "\tfail: ()=>{},",
3648 | "\tcomplete: ()=>{}",
3649 | "});"
3650 | ],
3651 | "description": "判断文件/目录是否存在"
3652 | },
3653 | "fileManager.accessSync": {
3654 | "prefix": "fileManager-accessSync",
3655 | "body": [
3656 | "try{",
3657 | "\tfileManager.accessSync('${1}');",
3658 | "}catch(e){",
3659 | "\t${2}",
3660 | "}"
3661 | ],
3662 | "description": "判断文件/目录是否存在,同步接口"
3663 | },
3664 | "fileManager.copyFile": {
3665 | "prefix": "fileManager-copyFile",
3666 | "body": [
3667 | "fileManager.copyFile({",
3668 | "\tsrcPath: '${1}',",
3669 | "\tdestPath: '${2}',",
3670 | "\tsuccess: (result)=>{",
3671 | "\t\t${3}",
3672 | "\t},",
3673 | "\tfail: ()=>{},",
3674 | "\tcomplete: ()=>{}",
3675 | "});"
3676 | ],
3677 | "description": "复制文件"
3678 | },
3679 | "fileManager.copyFileSync": {
3680 | "prefix": "fileManager-copyFileSync",
3681 | "body": [
3682 | "try{",
3683 | "\tfileManager.copyFileSync('${1}','${2}');",
3684 | "}catch(e){",
3685 | "\t${3}",
3686 | "}"
3687 | ],
3688 | "description": "复制文件,同步接口"
3689 | },
3690 | "fileManager.getSavedFileList": {
3691 | "prefix": "fileManager-getSavedFileList",
3692 | "body": [
3693 | "fileManager.getSavedFileList({",
3694 | "\tsuccess: (result)=>{",
3695 | "\t\t${1}",
3696 | "\t},",
3697 | "\tfail: ()=>{},",
3698 | "\tcomplete: ()=>{}",
3699 | "});"
3700 | ],
3701 | "description": "获取该小程序下已保存的本地缓存文件列表"
3702 | },
3703 | "fileManager.getFileInfo": {
3704 | "prefix": "fileManager-getFileInfo",
3705 | "body": [
3706 | "fileManager.getFileInfo({",
3707 | "\tfilePath: '${1}',",
3708 | "\tsuccess: (result)=>{",
3709 | "\t\t${2}",
3710 | "\t},",
3711 | "\tfail: ()=>{},",
3712 | "\tcomplete: ()=>{}",
3713 | "});"
3714 | ],
3715 | "description": "获取该小程序下的 本地临时文件 或 本地缓存文件 信息"
3716 | },
3717 | "fileManager.mkdir": {
3718 | "prefix": "fileManager-mkdir",
3719 | "body": [
3720 | "fileManager.mkdir({",
3721 | "\tdirPath: '${1}',",
3722 | "\tsuccess: (result)=>{",
3723 | "\t\t${2}",
3724 | "\t},",
3725 | "\tfail: ()=>{},",
3726 | "\tcomplete: ()=>{}",
3727 | "});"
3728 | ],
3729 | "description": "创建目录"
3730 | },
3731 | "fileManager.mkdirSync": {
3732 | "prefix": "fileManager-mkdirSync",
3733 | "body": [
3734 | "try{",
3735 | "\tfileManager.mkdirSync('${1}');",
3736 | "}catch(e){",
3737 | "\t${2}",
3738 | "}"
3739 | ],
3740 | "description": "创建目录,同步接口"
3741 | },
3742 | "fileManager.removeSavedFile": {
3743 | "prefix": "fileManager-removeSavedFile",
3744 | "body": [
3745 | "fileManager.removeSavedFile({",
3746 | "\tfilePath: '${1}',",
3747 | "\tsuccess: (result)=>{",
3748 | "\t\t${2}",
3749 | "\t},",
3750 | "\tfail: ()=>{},",
3751 | "\tcomplete: ()=>{}",
3752 | "});"
3753 | ],
3754 | "description": "删除该小程序下已保存的本地缓存文件"
3755 | },
3756 | "fileManager.readFile": {
3757 | "prefix": "fileManager-readFile",
3758 | "body": [
3759 | "fileManager.readFile({",
3760 | "\tfilePath: '${1}',",
3761 | "\tencoding: '${2}',",
3762 | "\tsuccess: (result)=>{",
3763 | "\t\t${3}",
3764 | "\t},",
3765 | "\tfail: ()=>{},",
3766 | "\tcomplete: ()=>{}",
3767 | "});"
3768 | ],
3769 | "description": "读取本地文件内容"
3770 | },
3771 | "fileManager.readFileSync": {
3772 | "prefix": "fileManager-readFileSync",
3773 | "body": [
3774 | "try{",
3775 | "\tvar ${1:fileData} = fileManager.readFileSync('${2}','${3}');",
3776 | "}catch(e){",
3777 | "\t${4}",
3778 | "}"
3779 | ],
3780 | "description": "读取本地文件内容,同步接口"
3781 | },
3782 | "fileManager.readdir": {
3783 | "prefix": "fileManager-readdir",
3784 | "body": [
3785 | "fileManager.readdir({",
3786 | "\tdirPath: '${1}',",
3787 | "\tsuccess: (result)=>{",
3788 | "\t\t${2}",
3789 | "\t},",
3790 | "\tfail: ()=>{},",
3791 | "\tcomplete: ()=>{}",
3792 | "});"
3793 | ],
3794 | "description": "读取目录内文件列表"
3795 | },
3796 | "fileManager.readdirSync": {
3797 | "prefix": "fileManager-readdirSync",
3798 | "body": [
3799 | "try{",
3800 | "\tvar ${1:fileList} = fileManager.readdirSync('${2}');",
3801 | "}catch(e){",
3802 | "\t${3}",
3803 | "}"
3804 | ],
3805 | "description": "读取目录内文件列表,同步接口"
3806 | },
3807 | "fileManager.rename": {
3808 | "prefix": "fileManager-rename",
3809 | "body": [
3810 | "fileManager.rename({",
3811 | "\toldPath: '${1}',",
3812 | "\tnewPath: '${2}',",
3813 | "\tsuccess: (result)=>{",
3814 | "\t\t${3}",
3815 | "\t},",
3816 | "\tfail: ()=>{},",
3817 | "\tcomplete: ()=>{}",
3818 | "});"
3819 | ],
3820 | "description": "重命名文件,可以把文件从 oldPath 移动到 newPath"
3821 | },
3822 | "fileManager.renameSync": {
3823 | "prefix": "fileManager-renameSync",
3824 | "body": [
3825 | "try{",
3826 | "\tfileManager.renameSync('${1}','${2}');",
3827 | "}catch(e){",
3828 | "\t${3}",
3829 | "}"
3830 | ],
3831 | "description": "重命名文件,可以把文件从 oldPath 移动到 newPath,同步接口"
3832 | },
3833 | "fileManager.rmdir": {
3834 | "prefix": "fileManager-rmdir",
3835 | "body": [
3836 | "fileManager.rmdir({",
3837 | "\tdirPath: '${1}',",
3838 | "\tsuccess: (result)=>{",
3839 | "\t\t${2}",
3840 | "\t},",
3841 | "\tfail: ()=>{},",
3842 | "\tcomplete: ()=>{}",
3843 | "});"
3844 | ],
3845 | "description": "删除目录"
3846 | },
3847 | "fileManager.rmdirSync": {
3848 | "prefix": "fileManager-rmdirSync",
3849 | "body": [
3850 | "try{",
3851 | "\tfileManager.rmdirSync('${1}');",
3852 | "}catch(e){",
3853 | "\t${2}",
3854 | "}"
3855 | ],
3856 | "description": "删除目录,同步接口"
3857 | },
3858 | "fileManager.saveFile": {
3859 | "prefix": "fileManager-saveFile",
3860 | "body": [
3861 | "fileManager.saveFile({",
3862 | "\ttempFilePath: '${1}',",
3863 | "\tfilePath: '${2}',",
3864 | "\tsuccess: (result)=>{",
3865 | "\t\t${3}",
3866 | "\t},",
3867 | "\tfail: ()=>{},",
3868 | "\tcomplete: ()=>{}",
3869 | "});"
3870 | ],
3871 | "description": "保存临时文件到本地。此接口会移动临时文件,因此调用成功后,tempFilePath 将不可用"
3872 | },
3873 | "fileManager.saveFileSync": {
3874 | "prefix": "fileManager-saveFileSync",
3875 | "body": [
3876 | "try{",
3877 | "\tvar ${1:fileNumber} = fileManager.saveFileSync('${2}','${3}');",
3878 | "}catch(e){",
3879 | "\t${4}",
3880 | "}"
3881 | ],
3882 | "description": "保存临时文件到本地。此接口会移动临时文件,因此调用成功后,tempFilePath 将不可用,同步接口"
3883 | },
3884 | "fileManager.stat": {
3885 | "prefix": "fileManager-stat",
3886 | "body": [
3887 | "fileManager.stat({",
3888 | "\tpath: '${1}',",
3889 | "\tsuccess: (result)=>{",
3890 | "\t\t${2}",
3891 | "\t},",
3892 | "\tfail: ()=>{},",
3893 | "\tcomplete: ()=>{}",
3894 | "});"
3895 | ],
3896 | "description": "获取文件 Stats 对象"
3897 | },
3898 | "fileManager.statSync": {
3899 | "prefix": "fileManager-statSync",
3900 | "body": [
3901 | "try{",
3902 | "\tvar ${1:fileStat} = fileManager.statSync('${2}');",
3903 | "}catch(e){",
3904 | "\t${3}",
3905 | "}"
3906 | ],
3907 | "description": "获取文件 Stats 对象,同步接口"
3908 | },
3909 | "fileStat.isDirectory": {
3910 | "prefix": "fileStat-isDirectory",
3911 | "body": [
3912 | "fileStat.isDirectory();"
3913 | ],
3914 | "description": "判断当前文件是否一个目录"
3915 | },
3916 | "fileStat.isFile": {
3917 | "prefix": "fileStat-isFile",
3918 | "body": [
3919 | "fileStat.isFile();"
3920 | ],
3921 | "description": "判断当前文件是否一个普通文件"
3922 | },
3923 | "fileManager.unlink": {
3924 | "prefix": "fileManager-unlink",
3925 | "body": [
3926 | "fileManager.unlink({",
3927 | "\tfilePath: '${1}',",
3928 | "\tsuccess: (result)=>{",
3929 | "\t\t${2}",
3930 | "\t},",
3931 | "\tfail: ()=>{},",
3932 | "\tcomplete: ()=>{}",
3933 | "});"
3934 | ],
3935 | "description": "删除文件"
3936 | },
3937 | "fileManager.unlinkSync": {
3938 | "prefix": "fileManager-unlinkSync",
3939 | "body": [
3940 | "try{",
3941 | "\tfileManager.unlinkSync('${1}');",
3942 | "}catch(e){",
3943 | "\t${2}",
3944 | "}"
3945 | ],
3946 | "description": "删除文件,同步接口"
3947 | },
3948 | "fileManager.unzip": {
3949 | "prefix": "fileManager-unzip",
3950 | "body": [
3951 | "fileManager.unzip({",
3952 | "\tzipFilePath: '${1}',",
3953 | "\ttargetPath: '${2}',",
3954 | "\tsuccess: (result)=>{",
3955 | "\t\t${3}",
3956 | "\t},",
3957 | "\tfail: ()=>{},",
3958 | "\tcomplete: ()=>{}",
3959 | "});"
3960 | ],
3961 | "description": "解压文件"
3962 | },
3963 | "fileManager.writeFile": {
3964 | "prefix": "fileManager-writeFile",
3965 | "body": [
3966 | "fileManager.writeFile({",
3967 | "\tfilePath: '${1}',",
3968 | "\tdata: '${2}',",
3969 | "\tencoding: '${3:utf8}',",
3970 | "\tsuccess: (result)=>{",
3971 | "\t\t${4}",
3972 | "\t},",
3973 | "\tfail: ()=>{},",
3974 | "\tcomplete: ()=>{}",
3975 | "});"
3976 | ],
3977 | "description": "写文件"
3978 | },
3979 | "fileManager.writeFileSync": {
3980 | "prefix": "fileManager-writeFileSync",
3981 | "body": [
3982 | "try{",
3983 | "\tfileManager.writeFileSync('${1}','${2}','${3:utf8}');",
3984 | "}catch(e){",
3985 | "\t${4}",
3986 | "}"
3987 | ],
3988 | "description": "写文件,同步接口"
3989 | },
3990 |
3991 | "wx.nextTick": {
3992 | "prefix": "wx-nextTick",
3993 | "body": [
3994 | "wx.nextTick(()=>{",
3995 | "\t${1}",
3996 | "});"
3997 | ],
3998 | "description": "用于延迟一部分操作到下一个时间片再执行"
3999 | },
4000 | "wx.getMenuButtonBoundingClientRect": {
4001 | "prefix": "wx-getMenuButtonBoundingClientRect",
4002 | "body": [
4003 | "let ${1:menuButton} = wx.getMenuButtonBoundingClientRect();"
4004 | ],
4005 | "description": "获取菜单按钮的布局置信息"
4006 | },
4007 | "wx.createIntersectionObserver": {
4008 | "prefix": "wx-createIntersectionObserver",
4009 | "body": [
4010 | "let ${1:interObser} = wx.createIntersectionObserver(${2:this},${3});"
4011 | ],
4012 | "description": "创建并返回一个 IntersectionObserver 对象实例"
4013 | },
4014 | "interObser.relativeTo": {
4015 | "prefix": "interObser-relativeTo",
4016 | "body": [
4017 | "interObser.relativeTo(${1:selector},${2});"
4018 | ],
4019 | "description": "使用选择器指定一个节点,作为参照区域之一"
4020 | },
4021 | "interObser.relativeToViewport": {
4022 | "prefix": "interObser-relativeToViewport",
4023 | "body": [
4024 | "interObser.relativeToViewport(${1});"
4025 | ],
4026 | "description": "指定页面显示区域作为参照区域之一"
4027 | },
4028 | "interObser.observe": {
4029 | "prefix": "interObser-observe",
4030 | "body": [
4031 | "interObser.observe(${1:selector},(result)=>{",
4032 | "\t${2}",
4033 | "});"
4034 | ],
4035 | "description": "指定目标节点并开始监听相交状态变化情况"
4036 | },
4037 | "interObser.disconnect": {
4038 | "prefix": "interObser-disconnect",
4039 | "body": [
4040 | "interObser.disconnect();"
4041 | ],
4042 | "description": "停止监听。回调函数将不再触发"
4043 | },
4044 | "wx.createSelectorQuery": {
4045 | "prefix": "wx-createSelectorQuery",
4046 | "body": [
4047 | "let ${1:selQuery} = wx.createSelectorQuery();"
4048 | ],
4049 | "description": "返回一个 SelectorQuery 对象实例。"
4050 | },
4051 | "selQuery.in": {
4052 | "prefix": "selQuery-in",
4053 | "body": [
4054 | "selQuery.in(${1:this});"
4055 | ],
4056 | "description": "将选择器的选取范围更改为自定义组件 component 内(初始时,选择器仅选取页面范围的节点,不会选取任何自定义组件中的节点)。"
4057 | },
4058 | "selQuery.select": {
4059 | "prefix": "selQuery-select",
4060 | "body": [
4061 | "selQuery.select(${2:selector});"
4062 | ],
4063 | "description": "在当前页面下选择第一个匹配选择器 selector 的节点,返回一个 NodesRef 对象实例,可以用于获取节点信息"
4064 | },
4065 | "selQuery.selectAll": {
4066 | "prefix": "selQuery-selectAll",
4067 | "body": [
4068 | "selQuery.selectAll();"
4069 | ],
4070 | "description": "在当前页面下选择匹配选择器 selector 的所有节点。"
4071 | },
4072 | "selQuery.selectViewport": {
4073 | "prefix": "selQuery-selectViewport",
4074 | "body": [
4075 | "selQuery.selectViewport();"
4076 | ],
4077 | "description": "选择显示区域,可用于获取显示区域的尺寸、滚动位置等信息。"
4078 | },
4079 | "selQuery.exec": {
4080 | "prefix": "selQuery-exec",
4081 | "body": [
4082 | "selQuery.exec(result)=>{",
4083 | "\t${1}",
4084 | "});"
4085 | ],
4086 | "description": "执行所有的请求,请求结果按请求次序构成数组,在callback的第一个参数中返回。"
4087 | }
4088 | }
--------------------------------------------------------------------------------
/snippets/wxjson.json:
--------------------------------------------------------------------------------
1 | {
2 | "page-json": {
3 | "prefix": "page",
4 | "body": [
5 | "{",
6 | "\t\"navigationBarBackgroundColor\": \"#000000\",",
7 | "\t\"navigationBarTextStyle\": \"white\",",
8 | "\t\"navigationBarTitleText\": \"\",",
9 | "\t\"backgroundColor\": \"#ffffff\",",
10 | "\t\"backgroundTextStyle\": \"dark|light\",",
11 | "\t\"enablePullDownRefresh\": false,",
12 | "\t\"disableScroll\": false,",
13 | "\t\"onReachBottomDistance\": false",
14 | "}"
15 | ],
16 | "description": "Page页面对应的JSON文件配置项"
17 | },
18 |
19 | "app-pages": {
20 | "prefix": "pages",
21 | "body": [
22 | "\"pages\": [",
23 | "\t\"pages/index/index\"",
24 | "],",
25 | "${1}"
26 | ],
27 | "description": "App对应的JSON文件pages配置项"
28 | },
29 | "app-window": {
30 | "prefix": "window",
31 | "body": [
32 | "\"window\": {",
33 | "\t\"navigationBarBackgroundColor\": \"#000000\",",
34 | "\t\"navigationBarTextStyle\": \"white\",",
35 | "\t\"navigationBarTitleText\": \"\",",
36 | "\t\"navigationStyle\": \"default|custom\",",
37 | "\t\"backgroundColor\": \"#ffffff\",",
38 | "\t\"backgroundTextStyle\": \"dark|light\",",
39 | "\t\"backgroundColorTop\": \"#ffffff\",",
40 | "\t\"backgroundColorBottom\": \"#ffffff\",",
41 | "\t\"enablePullDownRefresh\": true,",
42 | "\t\"onReachBottomDistance\": 50",
43 | "},",
44 | "${1}"
45 | ],
46 | "description": "App对应的JSON文件window配置项"
47 | },
48 |
49 | "app-tabbar": {
50 | "prefix": "tabbar",
51 | "body": [
52 | "\"tabBar\": {",
53 | "\t\"color\": \"${1}\",",
54 | "\t\"selectedColor\": \"${2}\",",
55 | "\t\"backgroundColor\": \"${3}\",",
56 | "\t\"position\": \"bottom\",",
57 | "\t\"borderStyle\": \"black\",",
58 | "\t\"list\": [",
59 | "\t\t{",
60 | "\t\t\t\"pagePath\": \"${4}\",",
61 | "\t\t\t\"text\": \"${5}\",",
62 | "\t\t\t\"iconPath\": \"${6}\",",
63 | "\t\t\t\"selectedIconPath\": \"${7}\"",
64 | "\t\t}",
65 | "\t]",
66 | "},",
67 | "${8}"
68 |
69 | ],
70 | "description": "App对应的JSON文件tabbar配置项"
71 | },
72 | "app-network": {
73 | "prefix": "networktimeout",
74 | "body": [
75 | "\"networkTimeout\": {",
76 | "\t\"request\": ${1:10000},",
77 | "\t\"connectSocket\": ${2:10000},",
78 | "\t\"uploadFile\": ${3:10000},",
79 | "\t\"downloadFile\": ${4:10000}",
80 | "},",
81 | "${5}"
82 | ],
83 | "description": "App对应的JSON文件networktimeout配置项,超时设置"
84 | },
85 | "app-debug": {
86 | "prefix": "debug",
87 | "body": [
88 | "\"debug\":true,"
89 | ],
90 | "description": "App对应的JSON文件debug配置项,是否是调试模式"
91 | },
92 | "app-functionalPages": {
93 | "prefix": "functionalPages",
94 | "body": [
95 | "\"functionalPages\":false,"
96 | ],
97 | "description": "是否启用插件功能页"
98 | },
99 | "app-subPackages": {
100 | "prefix": "subPackages",
101 | "body": [
102 | "\"subPackages\":[],"
103 | ],
104 | "description": "App对应的JSON文件subPackages配置项,分包结构配置"
105 | },
106 | "app-workers": {
107 | "prefix": "workers",
108 | "body": [
109 | "\"workers\":\"\","
110 | ],
111 | "description": "Worker代码放置的目录"
112 | },
113 | "app-requiredBackgroundModes": {
114 | "prefix": "requiredBackgroundModes",
115 | "body": [
116 | "\"requiredBackgroundModes\":[\"audio\"],"
117 | ],
118 | "description": "需要在后台使用的能力,如“音乐播放”"
119 | },
120 | "app-plugins": {
121 | "prefix": "plugins",
122 | "body": [
123 | "\"plugins\":{},"
124 | ],
125 | "description": "使用到的插件"
126 | },
127 | "app-preloadRule": {
128 | "prefix": "preloadRule",
129 | "body": [
130 | "\"preloadRule\":{},"
131 | ],
132 | "description": "分包预下载规则"
133 | },
134 | "app-resizable": {
135 | "prefix": "resizable",
136 | "body": [
137 | "\"resizable\":false,"
138 | ],
139 | "description": "iPad 小程序是否支持屏幕旋转,默认关闭"
140 | }
141 | }
--------------------------------------------------------------------------------
/snippets/wxxml.json:
--------------------------------------------------------------------------------
1 | {
2 | "view": {
3 | "prefix": "view",
4 | "body": [
5 | "",
6 | "\t${4}",
7 | ""
8 | ],
9 | "description": "基础的视图容器"
10 | },
11 | "scroll-view": {
12 | "prefix": "scroll-view",
13 | "body": [
14 | "",
17 | "\t${14}",
18 | ""
19 | ],
20 | "description": "可滚动视图区域"
21 | },
22 | "swiper": {
23 | "prefix": "swiper",
24 | "body": [
25 | "",
28 | "\t${16}",
29 | ""
30 | ],
31 | "description": "滑块视图容器"
32 | },
33 | "swiper-item": {
34 | "prefix": "swiper-item",
35 | "body": [
36 | "",
37 | "\t${3}",
38 | ""
39 | ],
40 | "description": "仅可放置在组件中,宽高自动设置为100%"
41 | },
42 | "movable-area": {
43 | "prefix": "movable-area",
44 | "body": [
45 | "",
46 | "\t${3}",
47 | ""
48 | ],
49 | "description": "movable-view 的可移动区域"
50 | },
51 | "movable-view": {
52 | "prefix": "movable-view",
53 | "body": [
54 | "",
57 | "\t${17}",
58 | ""
59 | ],
60 | "description": "可移动的视图容器 在页面中可以拖拽滑动"
61 | },
62 | "cover-view": {
63 | "prefix": "cover-view",
64 | "body": [
65 | "",
66 | "\t${3}",
67 | ""
68 | ],
69 | "description": "覆盖在原生组件之上的文本视图,可覆盖的原生组件包括map、video、canvas、camera、live-player、live-pusher,只支持嵌套cover-view、cover-image,可在cover-view中使用button"
70 | },
71 | "cover-image": {
72 | "prefix": "cover-image",
73 | "body": [
74 | "",
75 | "\t${5}",
76 | ""
77 | ],
78 | "description": "覆盖在原生组件之上的图片视图,可覆盖的原生组件同cover-view,支持嵌套在cover-view里"
79 | },
80 | "icon": {
81 | "prefix": "icon",
82 | "body": [
83 | "",
84 | "\t${5}",
85 | ""
86 | ],
87 | "description": "图标"
88 | },
89 | "text": {
90 | "prefix": "text",
91 | "body": [
92 | "",
93 | "\t${5}",
94 | ""
95 | ],
96 | "description": "文本"
97 | },
98 | "rich-text": {
99 | "prefix": "rich-text",
100 | "body": [
101 | "",
102 | "\t${3}",
103 | ""
104 | ],
105 | "description": "富文本"
106 | },
107 | "progress": {
108 | "prefix": "progress",
109 | "body": [
110 | ""
114 | ],
115 | "description": "进度条"
116 | },
117 | "button": {
118 | "prefix": "button",
119 | "body": [
120 | ""
125 | ],
126 | "description": "按钮"
127 | },
128 | "checkbox-group": {
129 | "prefix": "checkbox-group",
130 | "body": [
131 | "",
132 | "\t${2}",
133 | ""
134 | ],
135 | "description": "多项选择器 内部由多个checkbox组成"
136 | },
137 | "checkbox": {
138 | "prefix": "checkbox",
139 | "body": [
140 | "",
141 | "\t${6}",
142 | ""
143 | ],
144 | "description": "多选项目"
145 | },
146 | "form": {
147 | "prefix": "form",
148 | "body": [
149 | ""
152 | ],
153 | "description": "表单。将组件内的用户输入的 提交"
154 | },
155 | "input": {
156 | "prefix": "input",
157 | "body": [
158 | "",
160 | "\t${15}",
161 | ""
162 | ],
163 | "description": "输入框"
164 | },
165 | "label": {
166 | "prefix": "label",
167 | "body": [
168 | ""
171 | ],
172 | "description": "用来改进表单组件的可用性,使用for属性找到对应的id,或者将控件放在该标签下,当点击时,就会触发对应的控件。for优先级高于内部控件,内部有多个控件的时候默认触发第一个控件。目前可以绑定的控件有、、、"
173 | },
174 | "picker": {
175 | "prefix": "picker",
176 | "body": [
177 | "",
179 | "\t${9}",
180 | ""
181 | ],
182 | "description": "滚动选择器。现支持三种选择器 通过mode来区分,分别是普通选择器、时间选择器、日期选择器。默认是普通选择器"
183 | },
184 | "picker-view": {
185 | "prefix": "picker-view",
186 | "body": [
187 | "",
188 | "\t${7}",
189 | ""
190 | ],
191 | "description": "嵌入页面的滚动选择器"
192 | },
193 | "picker-view-column": {
194 | "prefix": "picker-view-column",
195 | "body": [
196 | "",
197 | "\t${1}",
198 | ""
199 | ],
200 | "description": "仅可放置于中 其孩子节点的高度会自动设置成与picker-view的选中框的高度一致"
201 | },
202 | "radio-group": {
203 | "prefix": "radio-group",
204 | "body": [
205 | "",
206 | "\t${2}",
207 | ""
208 | ],
209 | "description": "单项选择器 内部由多个组成"
210 | },
211 | "radio": {
212 | "prefix": "radio",
213 | "body": [
214 | "",
215 | "\t${6}",
216 | ""
217 | ],
218 | "description": "单选项目"
219 | },
220 | "slider": {
221 | "prefix": "slider",
222 | "body": [
223 | "",
225 | "\t${13}",
226 | ""
227 | ],
228 | "description": "滑动选择器"
229 | },
230 | "switch": {
231 | "prefix": "switch",
232 | "body": [
233 | "",
234 | "\t${5}",
235 | ""
236 | ],
237 | "description": "开关选择器"
238 | },
239 | "textarea": {
240 | "prefix": "textarea",
241 | "body": [
242 | ""
247 | ],
248 | "description": "多行输入框"
249 | },
250 | "navigator": {
251 | "prefix": "navigator",
252 | "body": [
253 | "",
254 | "\t${6}",
255 | ""
256 | ],
257 | "description": "页面链接"
258 | },
259 | "functional-page-navigator": {
260 | "prefix": "functional-page-navigator",
261 | "body": [
262 | "",
263 | "\t${5}",
264 | ""
265 | ],
266 | "description": "页面链接"
267 | },
268 | "audio": {
269 | "prefix": "audio",
270 | "body": [
271 | ""
275 | ],
276 | "description": "音频。1.6.0 版本开始,该组件不再维护"
277 | },
278 | "image": {
279 | "prefix": "image",
280 | "body": [
281 | "",
282 | "\t${7}",
283 | ""
284 | ],
285 | "description": "图片。默认宽度300px、高度225px。image组件中二维码/小程序码图片不支持长按识别"
286 | },
287 | "video": {
288 | "prefix": "video",
289 | "body": [
290 | ""
294 | ],
295 | "description": "视频。默认宽度300px、高度225px,可通过wxss设置宽高"
296 | },
297 | "camera": {
298 | "prefix": "camera",
299 | "body": [
300 | "",
302 | "\t${12}",
303 | ""
304 | ],
305 | "description": "系统相机。需要用户授权 scope.camera"
306 | },
307 | "live-player": {
308 | "prefix": "live-player",
309 | "body": [
310 | "",
313 | "\t${13}",
314 | ""
315 | ],
316 | "description": "实时音视频播放。默认宽度300px、高度225px,可通过wxss设置宽高"
317 | },
318 | "live-pusher": {
319 | "prefix": "live-pusher",
320 | "body": [
321 | "",
324 | "\t${16}",
325 | ""
326 | ],
327 | "description": "实时音视频录制。需要用户授权 scope.camera、scope.record。默认宽度为100%、无默认高度,请通过wxss设置宽高"
328 | },
329 |
330 | "map": {
331 | "prefix": "map",
332 | "body": [
333 | ""
335 | ],
336 | "description": "地图"
337 | },
338 | "canvas": {
339 | "prefix": "canvas",
340 | "body": [
341 | ""
343 | ],
344 | "description": "画布"
345 | },
346 | "open-data": {
347 | "prefix": "open-data",
348 | "body": [""],
349 | "description": "用于展示微信开放的数据"
350 | },
351 | "web-view": {
352 | "prefix": "web-view",
353 | "body": [""],
354 | "description": "可以用来承载网页的容器,会自动铺满整个小程序页面"
355 | },
356 | "ad": {
357 | "prefix": "ad",
358 | "body": [""],
359 | "description": "广告模块"
360 | },
361 | "block": {
362 | "prefix": "block",
363 | "body": ["",
364 | "\t${2}",
365 | ""
366 | ],
367 | "description": "block标签,不是组件,只是包装元素,不会在页面中做任何渲染,只接受控制属性"
368 | }
369 | }
370 |
--------------------------------------------------------------------------------