forked from dcloudio/mui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snippets.rb
286 lines (275 loc) · 8.59 KB
/
snippets.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
=begin
本文档是HBuilder预置的mui框架的HTML代码块。
使用代码块可以快速构建App页面,比如输入mheader,可以直接生成mui导航代码块。
关于代码块的使用介绍,请参考:http://dcloud.io/readme/#title7
=end
########## MUI代码块 begin ##########
snippet 'mButton' do |cmd|
cmd.trigger = 'mbutton'
cmd.expansion = "<button class=\"mui-btn\">按钮$1</button>"
end
snippet 'mButton-blue' do |cmd|
cmd.trigger = 'mbuttonblue'
cmd.expansion = "<button class=\"mui-btn mui-btn-blue\">按钮$1</button>"
end
snippet 'mButton-green' do |cmd|
cmd.trigger = 'mbuttongreen'
cmd.expansion = "<button class=\"mui-btn mui-btn-green\">按钮$1</button>"
end
snippet 'mButton-yellow' do |cmd|
cmd.trigger = 'mbuttonyellow'
cmd.expansion = "<button class=\"mui-btn mui-btn-yellow\">按钮$1</button>"
end
snippet 'mButton-red' do |cmd|
cmd.trigger = 'mbuttonred'
cmd.expansion = "<button class=\"mui-btn mui-btn-red\">按钮$1</button>"
end
snippet 'mButton-purple' do |cmd|
cmd.trigger = 'mbuttonred'
cmd.expansion = "<button class=\"mui-btn mui-btn-purple\">按钮$1</button>"
end
snippet 'mHeader' do |cmd|
cmd.trigger = 'mheader'
cmd.expansion = '<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title">标题$1</h1>
</header>'
end
snippet 'mBody' do |cmd|
cmd.trigger = 'mbody'
cmd.expansion = '<div class="mui-content">
$1
</div>'
end
snippet 'mText' do |cmd|
cmd.trigger = 'mtext'
cmd.expansion = "<input type=\"text\" class=\"mui-input-clear mui-input-speech\" placeholder=\"$1\">"
end
snippet 'mSearch' do |cmd|
cmd.trigger = 'msearch'
cmd.expansion = "<input type=\"search\" class=\"mui-input-clear mui-input-speech\" placeholder=\"$1\">"
end
snippet 'mForm' do |cmd|
cmd.trigger = 'mform'
cmd.expansion = "<form class=\"mui-input-group\">
<div class=\"mui-input-row\">
<label>input</label>
<input type=\"text\" class=\"mui-input-clear\" placeholder=\"${1:请输入}\">
</div>
</form>"
end
snippet 'mRadio' do |cmd|
cmd.trigger = 'mradio'
cmd.expansion = "<div class=\"mui-input-row mui-radio \">
<label>${1:Radio}</label>
<input name=\"$2\" type=\"radio\" checked>
</div>"
end
snippet 'mCheckbox' do |cmd|
cmd.trigger = 'mcheckbox'
cmd.expansion = "<div class=\"mui-input-row mui-checkbox \">
<label>${1:Checkbox}</label>
<input name=\"$2\" type=\"checkbox\" checked>
</div>"
end
snippet 'mRange' do |cmd|
cmd.trigger = 'mrange'
cmd.expansion = "<div class=\"mui-input-row mui-input-range\">
<label>slider</label>
<input type=\"range\" min=\"0\" max=\"100\">
</div>"
end
snippet 'mSwitch' do |cmd|
cmd.trigger = 'mswitch'
cmd.expansion = "<div class=\"mui-input-row\">
<label>Switch</label>
<div class=\"mui-switch mui-active\">
<div class=\"mui-switch-handle\"></div>
</div>
</div>"
end
snippet 'mSpeech' do |cmd|
cmd.trigger = 'mspecch'
cmd.expansion = "<div class=\"mui-input-row\">
<label>${1:Input}</label>
<input type=\"text\" class=\"mui-input-clear mui-input-speech\" placeholder=\"请输入\">
</div>"
end
snippet 'mBadge' do |cmd|
cmd.trigger = 'mbadge'
cmd.expansion = "<span class=\"mui-badge mui-badge-negative\">${1:1}</span>"
end
snippet 'mTab' do |cmd|
cmd.trigger = 'mtab'
cmd.expansion = "<nav class=\"mui-bar mui-bar-tab\">
<a class=\"mui-tab-item mui-active\">
<span class=\"mui-icon mui-icon-home\"></span>
<span class=\"mui-tab-label\">${1:首页}</span>
</a>
<a class=\"mui-tab-item\">
<span class=\"mui-icon mui-icon-phone\"></span>
<span class=\"mui-tab-label\">电话</span>
</a>
<a class=\"mui-tab-item\">
<span class=\"mui-icon mui-icon-email\"></span>
<span class=\"mui-tab-label\">邮件</span>
</a>
<a class=\"mui-tab-item\">
<span class=\"mui-icon mui-icon-gear\"></span>
<span class=\"mui-tab-label\">设置</span>
</a>
</nav>"
end
snippet 'mTabSegmented' do |cmd|
cmd.trigger = 'mtabsegmented'
cmd.expansion = "<div class=\"mui-segmented-control\">
<a class=\"mui-control-item mui-active\" href=\"#item1\">${1:选项卡1}</a>
<a class=\"mui-control-item\" href=\"#item2\">选项卡2</a>
</div>"
end
snippet 'mPagination' do |cmd|
cmd.trigger = 'mpagination'
cmd.expansion = "<ul class=\"mui-pagination\">
<li class=\"mui-disabled\">
<span> « </span>
</li>
<li class=\"mui-active\">
<a href=\"#\">${1:1}</a>
</li>
<li>
<a href=\"#\">2</a>
</li>
<li>
<a href=\"#\">»</a>
</li>
</ul>"
end
snippet 'mList' do |cmd|
cmd.trigger = 'mlist'
cmd.expansion = "<div class=\"mui-card\">
<ul class=\"mui-table-view\">
<li class=\"mui-table-view-cell\">
<a class=\"mui-navigate-right\">
${1:Item 1}
</a>
</li>
<li class=\"mui-table-view-cell\">
<a class=\"mui-navigate-right\">
Item 2
</a>
</li>
<li class=\"mui-table-view-cell\">
<a class=\"mui-navigate-right\">
Item 3
</a>
</li>
</ul>
</div>"
end
snippet 'mList-Media' do |cmd|
cmd.trigger = 'mlist-Media'
cmd.expansion = "<ul class=\"mui-table-view\">
<li class=\"mui-table-view-cell\">
<a class=\"mui-navigate-right\">
<img class=\"mui-media-object mui-pull-left\" src=\"img/hbuilder.png\">
<div class=\"mui-media-body\">
主标题
<p class='mui-ellipsis'>这里是摘要</p>
</div>
</a>
</li>
<li class=\"mui-table-view-cell\">
<a class=\"mui-navigate-right\">
<img class=\"mui-media-object mui-pull-left\" src=\"img/hbuilder.png\">
<div class=\"mui-media-body\">
主标题
<p class='mui-ellipsis'>这里是摘要</p>
</div>
</a>
</li>
</ul>"
end
snippet 'mGrid' do |cmd|
cmd.trigger = 'mgrid'
cmd.expansion = "<div class=\"mui-card\">
<ul class=\"mui-table-view mui-grid-view mui-grid-9\">
<li class=\"mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3\">
<a href=\"#\">
<span class=\"mui-icon mui-icon-home\"></span>
<div class=\"mui-media-body\">Home</div>
</a>
</li>
<li class=\"mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3\">
<a href=\"#\">
<span class=\"mui-icon mui-icon-email\"><span class=\"mui-badge mui-badge-red\">5</span></span>
<div class=\"mui-media-body\">Email</div>
</a>
</li>
<li class=\"mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3\">
<a href=\"#\">
<span class=\"mui-icon mui-icon-chatbubble\"></span>
<div class=\"mui-media-body\">Chat</div>
</a>
</li>
<li class=\"mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3\">
<a href=\"#\">
<span class=\"mui-icon mui-icon-location\"></span>
<div class=\"mui-media-body\">Location</div>
</a>
</li>
<li class=\"mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3\">
<a href=\"#\">
<span class=\"mui-icon mui-icon-search\"></span>
<div class=\"mui-media-body\">Search</div>
</a>
</li>
<li class=\"mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3\">
<a href=\"#\">
<span class=\"mui-icon mui-icon-phone\"></span>
<div class=\"mui-media-body\">Phone</div>
</a>
</li>
</ul>
</div>"
end
snippet 'mGrid-picture' do |cmd|
cmd.trigger = 'mgrid-picture'
cmd.expansion = "<ul class=\"mui-table-view mui-grid-view\">
<li class=\"mui-table-view-cell mui-media mui-col-xs-6\">
<a href=\"#\">
<img class=\"mui-media-object\" src=\"http://placehold.it/400x300\">
<div class=\"mui-media-body\">文字说明1</div>
</a>
</li>
<li class=\"mui-table-view-cell mui-media mui-col-xs-6\">
<a href=\"#\">
<img class=\"mui-media-object\" src=\"http://placehold.it/400x300\">
<div class=\"mui-media-body\">文字说明2</div>
</a>
</li>
</ul>"
end
snippet 'mGallery' do |cmd|
cmd.trigger = 'mgallery'
cmd.expansion = "<div class=\"mui-slider\">
<div class=\"mui-slider-group\">
<div class=\"mui-slider-item\">
<a href=\"#\">
<img src=\"http://placehold.it/200x100\">
<p class=\"mui-slider-title\">文字说明1</p>
</a>
</div>
<div class=\"mui-slider-item\">
<a href=\"#\">
<img src=\"http://placehold.it/200x100\">
<p class=\"mui-slider-title\">文字说明2</p>
</a>
</div>
</div>
<div class=\"mui-slider-indicator\">
<div class=\"mui-indicator mui-active\"></div>
<div class=\"mui-indicator\"></div>
</div>
</div>"
end
########## MUI代码块 end ##########