-
Notifications
You must be signed in to change notification settings - Fork 153
Expand file tree
/
Copy pathindex.axml
More file actions
382 lines (371 loc) · 11.3 KB
/
index.axml
File metadata and controls
382 lines (371 loc) · 11.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
<!-- #if ALIPAY || WECHAT -->
<view class="navigation-bar"/>
<!-- #endif -->
<import-sjs
from="./slice.sjs"
name="utils" />
<view class="t-swipe">
<view class="t-swipe-item">
<view class="t-swipe-item-title">基础用法</view>
<block
a:for="{{ 2 }}"
a:for-index="index"
a:for-item="_"
a:key="{{ index }}">
<view class="t-swipe-item-con">
<ant-swipe-action
data-item="{{ index }}"
rightButtons="{{ rightBtns }}"
elasticity="{{ true }}"
swiped="{{ swipeIndex === index }}"
onSwipeEnd="onSwipeEnd"
onSwipeStart="onSwipeStart"
onButtonTap="onButtonTap">
<view class="t-swipe-item-con-view">右侧-三个按钮</view>
</ant-swipe-action>
</view>
</block>
</view>
</view>
<view class="t-swipe">
<view class="t-swipe-item">
<view class="t-swipe-item-title">按钮在左侧</view>
<block
a:for="{{ 2 }}"
a:for-index="index"
a:for-item="_"
a:key="{{ index }}">
<view class="t-swipe-item-con">
<ant-swipe-action
data-item="{{ index }}"
leftButtons="{{ leftBtns }}"
elasticity="{{ true }}"
swiped="{{ swipeIndex === index }}"
onSwipeEnd="onSwipeEnd"
onSwipeStart="onSwipeStart"
onButtonTap="onButtonTap">
<view class="t-swipe-item-con-view">左侧-三个按钮</view>
</ant-swipe-action>
</view>
</block>
</view>
</view>
<view class="t-swipe">
<view class="t-swipe-item">
<view class="t-swipe-item-title">调整按钮数量,最多为3个</view>
<block
a:for="{{ 3 }}"
a:for-index="index"
a:for-item="_"
a:key="{{ index }}">
<view class="t-swipe-item-con">
<ant-swipe-action
data-item="{{ index }}"
rightButtons="{{ utils.sliceButton(rightBtns, index) }}"
elasticity="{{ index !== 0 }}"
swiped="{{ swipeIndex === index }}"
onSwipeEnd="onSwipeEnd"
onSwipeStart="onSwipeStart"
onButtonTap="onButtonTap">
<view class="t-swipe-item-con-view">
右侧-{{ index + 1 > 3 ? 3 : index + 1 }}个按钮
</view>
</ant-swipe-action>
</view>
</block>
</view>
</view>
<view class="t-swipe">
<view class="t-swipe-item">
<view class="t-swipe-item-title">去除松开手之后的滑动回弹效果</view>
<block
a:for="{{2}}"
a:for-index="index"
a:for-item="_"
>
<view class="t-swipe-item-con">
<ant-swipe-action
data-item="{{index}}"
rightButtons="{{rightBtns}}"
elasticity="{{false}}"
swiped="{{swipeIndex === index}}"
onSwipeEnd="onSwipeEnd"
onSwipeStart="onSwipeStart"
onButtonTap="onButtonTap"
>
<view class="t-swipe-item-con-view">右侧-三个按钮</view>
</ant-swipe-action>
</view>
</block>
</view>
</view>
<view class="t-swipe">
<view class="t-swipe-item">
<view class="t-swipe-item-title">滑动速度变慢</view>
<block
a:for="{{2}}"
a:for-index="index"
a:for-item="_"
>
<view class="t-swipe-item-con">
<ant-swipe-action
data-item="{{index}}"
rightButtons="{{rightBtns}}"
elasticity="{{false}}"
damping="25"
swiped="{{swipeIndex === index}}"
onSwipeEnd="onSwipeEnd"
onSwipeStart="onSwipeStart"
onButtonTap="onButtonTap"
>
<view class="t-swipe-item-con-view">右侧-三个按钮</view>
</ant-swipe-action>
</view>
</block>
</view>
</view>
<view class="t-swipe">
<view class="t-swipe-item">
<view class="t-swipe-item-title">删除按钮点击二次确认</view>
<block
a:for="{{2}}"
a:for-index="index"
a:for-item="_"
>
<view class="t-swipe-item-con">
<ant-swipe-action
data-item="{{index}}"
rightButtons="{{rightBtnsWithConfirm}}"
elasticity="{{true}}"
swiped="{{swipeIndex === index}}"
onSwipeEnd="onSwipeEnd"
onSwipeStart="onSwipeStart"
onButtonTap="onButtonTap"
>
<view class="t-swipe-item-con-view">右侧-三个按钮</view>
</ant-swipe-action>
</view>
</block>
</view>
</view>
<view class="t-swipe">
<view class="t-swipe-item">
<view class="t-swipe-item-title">删除按钮滑动到最大距离触发二次确认</view>
<block
a:for="{{2}}"
a:for-index="index"
a:for-item="_"
>
<view class="t-swipe-item-con">
<ant-swipe-action
data-item="{{index}}"
rightButtons="{{rightBtnsWithMove}}"
elasticity="{{true}}"
swiped="{{swipeIndex === index}}"
onSwipeEnd="onSwipeEnd"
onSwipeStart="onSwipeStart"
onButtonTap="onButtonTap"
>
<view class="t-swipe-item-con-view">右侧-三个按钮</view>
</ant-swipe-action>
</view>
</block>
</view>
</view>
<view class="t-swipe">
<view class="t-swipe-item">
<view class="t-swipe-item-title">左右两侧都有按钮</view>
<block
a:for="{{2}}"
a:for-index="index"
a:for-item="_"
>
<view class="t-swipe-item-con">
<ant-swipe-action
data-item="{{index}}"
leftButtons="{{rightBtns}}"
rightButtons="{{rightBtns}}"
elasticity="{{true}}"
swiped="{{swipeIndex === index}}"
onSwipeEnd="onSwipeEnd"
onSwipeStart="onSwipeStart"
onButtonTap="onButtonTap"
>
<view class="t-swipe-item-con-view">三个按钮</view>
</ant-swipe-action>
</view>
</block>
</view>
</view>
<view class="t-swipe">
<view class="t-swipe-item">
<view class="t-swipe-item-title">自定义按钮</view>
<block
a:for="{{2}}"
a:for-index="index"
a:for-item="_"
>
<view class="t-swipe-item-con">
<ant-swipe-action
data-item="{{index}}"
rightButtons="{{[
{
text: 'No Slot',
bgColor: '#1677FF',
color: '#fff',
},
{
text: '重命名',
bgColor: '#FFA91B',
color: '#fff',
slotName: 'reName',
confirmType: 'tap',
confirmText: '确认修改吗?',
},
{
text: '删除',
bgColor: '#FF2B00',
color: '#fff',
slotName: 'delete',
confirmType: 'tap',
confirmText: '确认删除吗?',
},
]}}"
leftButtons="{{[
{
text: 'No Slot',
bgColor: '#1677FF',
color: '#fff',
},
{
text: '重命名',
bgColor: '#FFA91B',
color: '#fff',
width: 300,
slotName: 'reName-left',
confirmType: 'tap',
confirmText: '确认修改吗?',
},
]}}"
elasticity="{{true}}"
swiped="{{swipeIndex === index}}"
onSwipeEnd="onSwipeEnd"
onSwipeStart="onSwipeStart"
onButtonTap="onButtonTap"
>
<view class="t-swipe-item-con-view">左右自定义按钮</view>
<view
slot="delete"
class="t-swipe-item-con-btn"
>
<ant-icon
type="DeleteOutline"
className="t-swipe-item-con-btn-icon"
></ant-icon>
<!--display: inline-->
<text class="t-swipe-item-con-btn-del">删除</text>
</view>
<view
slot="delete-confirm"
class="t-swipe-item-con-btn"
>
<ant-icon
type="DeleteOutline"
className="t-swipe-item-con-btn-icon"
></ant-icon>
<view class="t-swipe-item-con-btn-del">确认删除吗?</view>
</view>
<view
slot="reName"
class="t-swipe-item-con-btn"
>
<ant-icon
type="EditFill"
className="t-swipe-item-con-btn-icon"
></ant-icon>
<view class="t-swipe-item-con-btn-del">重命名</view>
</view>
<view
slot="reName-confirm"
class="t-swipe-item-con-btn"
>
<ant-icon
type="EditFill"
className="t-swipe-item-con-btn-icon"
></ant-icon>
<view class="t-swipe-item-con-btn-del">确认修改吗?</view>
</view>
<view
slot="reName-left"
class="t-swipe-item-con-btn left-slot"
>
<ant-icon
type="EditFill"
className="t-swipe-item-con-btn-icon"
></ant-icon>
<view class="t-swipe-item-con-btn-del">重命名</view>
</view>
<view
slot="reName-left-confirm"
class="t-swipe-item-con-btn left-slot"
>
<ant-icon
type="EditFill"
className="t-swipe-item-con-btn-icon"
></ant-icon>
<view class="t-swipe-item-con-btn-del">确认修改吗?</view>
</view>
</ant-swipe-action>
</view>
</block>
</view>
</view>
<view class="t-swipe">
<view class="t-swipe-item">
<view class="t-swipe-item-title">默认展开-使用 defaultSwiped</view>
<view class="t-swipe-item-con">
<ant-swipe-action
rightButtons="{{ rightBtns }}"
elasticity="{{ true }}"
defaultSwiped="right"
onSwipeEnd="onSwipeEnd"
onSwipeStart="onSwipeStart"
onButtonTap="onButtonTap">
<view class="t-swipe-item-con-view">默认展开右侧按钮(defaultSwiped="right")</view>
</ant-swipe-action>
</view>
<view class="t-swipe-item-con">
<ant-swipe-action
leftButtons="{{ leftBtns }}"
elasticity="{{ true }}"
defaultSwiped="left"
onSwipeEnd="onSwipeEnd"
onSwipeStart="onSwipeStart"
onButtonTap="onButtonTap">
<view class="t-swipe-item-con-view">默认展开左侧按钮(defaultSwiped="left")</view>
</ant-swipe-action>
</view>
</view>
</view>
<view class="t-swipe">
<view class="t-swipe-item">
<view class="t-swipe-item-title">受控模式-通过按钮控制展开</view>
<view class="control-buttons">
<button size="mini" onTap="onControlSwipe" data-index="0" data-direction="">关闭</button>
<button size="mini" onTap="onControlSwipe" data-index="0" data-direction="right">展开右侧</button>
<button size="mini" onTap="onControlSwipe" data-index="0" data-direction="left">展开左侧</button>
</view>
<view class="t-swipe-item-con">
<ant-swipe-action
rightButtons="{{ rightBtns }}"
leftButtons="{{ leftBtns }}"
elasticity="{{ true }}"
swiped="{{ controlledSwipe }}"
onSwipeEnd="onSwipeEnd"
onSwipeStart="onSwipeStart"
onButtonTap="onButtonTap">
<view class="t-swipe-item-con-view">受控组件示例1 - 当前状态: {{ controlledSwipe || '关闭' }}</view>
</ant-swipe-action>
</view>
</view>
</view>