project.code-snippets
2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{
"小程序页面模板": {
"prefix": "page",
"scope": "javascript",
"body": [
"Page({",
"\tdata: {",
"\t\tnavBarHeight: 0,",
"\t},",
"",
"\tnavbarReady(e) {",
"\t\tlet navBarHeight = e?.detail?.height;",
"\t\tthis.setData({",
"\t\t\tnavBarHeight,",
"\t\t});",
"\t},",
"",
"\tback() {",
"\t\twx.\\$router.back();",
"\t},",
"",
"\tonLoad(options) {",
"\t\t$1",
"\t},",
"",
"\tonRoute(options) {",
"\t\tconsole.log(options);",
"\t},",
"",
"\t/**",
"\t * 生命周期函数--监听页面隐藏",
"\t */",
"\tonHide() {},",
"",
"\t/**",
"\t * 生命周期函数--监听页面卸载",
"\t */",
"\tonUnload() {},",
"",
"\t/**",
"\t * 页面相关事件处理函数--监听用户下拉动作",
"\t */",
"\tonPullDownRefresh() {},",
"",
"\t/**",
"\t * 页面上拉触底事件的处理函数",
"\t */",
"\tonReachBottom() {}",
"});",
],
"description": "微信小程序 Page 页面模板(含 navbarReady / back)",
},
"小程序组件模板": {
"prefix": "component",
"scope": "javascript",
"body": [
"Component({",
" /**",
" * 组件的属性列表",
" */",
" properties: {",
" ${1:exampleProp}: {",
" type: ${2:String},",
" value: ${3:''},",
" observer: function(newVal, oldVal) {",
" $4",
" }",
" }",
" },",
"",
" /**",
" * 组件的初始数据",
" */",
" data: {",
" ${5:exampleData}: ${6:null}",
" },",
"",
" /**",
" * 组件的方法列表",
" */",
" methods: {",
" ${7:exampleMethod}() {",
" $0",
" }",
" },",
"",
" /**",
" * 组件生命周期函数",
" */",
" lifetimes: {",
" created() {",
" ",
" },",
" attached() {",
" ",
" },",
" ready() {",
" ",
" },",
" moved() {",
" ",
" },",
" detached() {",
" ",
" }",
" },",
"",
" /**",
" * 组件数据监听器",
" */",
" observers: {",
" }",
"})",
],
"description": "微信小程序 Component 完整模板(含 properties, data, methods, lifetimes, observers)",
},
}