@kengic/uni 0.5.1 → 0.5.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/uni/uni-ui/uni-badge/uni-badge.vue +222 -219
- package/dist/uni/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +29 -29
- package/dist/uni/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +88 -88
- package/dist/uni/uni-ui/uni-calendar/calendar.js +936 -532
- package/dist/uni/uni-ui/uni-calendar/i18n/en.json +10 -10
- package/dist/uni/uni-ui/uni-calendar/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hans.json +10 -10
- package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hant.json +10 -10
- package/dist/uni/uni-ui/uni-calendar/uni-calendar-item.vue +190 -168
- package/dist/uni/uni-ui/uni-calendar/uni-calendar.vue +459 -459
- package/dist/uni/uni-ui/uni-calendar/util.js +324 -340
- package/dist/uni/uni-ui/uni-card/uni-card.vue +8 -1
- package/dist/uni/uni-ui/uni-col/uni-col.vue +294 -287
- package/dist/uni/uni-ui/uni-collapse/uni-collapse.vue +139 -140
- package/dist/uni/uni-ui/uni-collapse-item/uni-collapse-item.vue +381 -378
- package/dist/uni/uni-ui/uni-combox/uni-combox.vue +280 -272
- package/dist/uni/uni-ui/uni-countdown/i18n/en.json +4 -4
- package/dist/uni/uni-ui/uni-countdown/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hans.json +4 -4
- package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hant.json +4 -4
- package/dist/uni/uni-ui/uni-countdown/uni-countdown.vue +249 -257
- package/dist/uni/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +832 -813
- package/dist/uni/uni-ui/uni-data-picker/keypress.js +42 -42
- package/dist/uni/uni-ui/uni-data-picker/uni-data-picker.vue +535 -516
- package/dist/uni/uni-ui/uni-data-pickerview/uni-data-picker.js +623 -618
- package/dist/uni/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +293 -288
- package/dist/uni/uni-ui/uni-data-select/uni-data-select.vue +495 -509
- package/dist/uni/uni-ui/uni-dateformat/date-format.js +181 -184
- package/dist/uni/uni-ui/uni-dateformat/uni-dateformat.vue +81 -82
- package/dist/uni/uni-ui/uni-datetime-picker/calendar-item.vue +176 -170
- package/dist/uni/uni-ui/uni-datetime-picker/calendar.vue +926 -920
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/en.json +20 -20
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +21 -21
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +21 -21
- package/dist/uni/uni-ui/uni-datetime-picker/time-picker.vue +921 -926
- package/dist/uni/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1059 -1012
- package/dist/uni/uni-ui/uni-datetime-picker/util.js +366 -377
- package/dist/uni/uni-ui/uni-drawer/keypress.js +42 -42
- package/dist/uni/uni-ui/uni-drawer/uni-drawer.vue +176 -167
- package/dist/uni/uni-ui/uni-easyinput/common.js +40 -42
- package/dist/uni/uni-ui/uni-easyinput/uni-easyinput.vue +628 -547
- package/dist/uni/uni-ui/uni-fab/uni-fab.vue +507 -483
- package/dist/uni/uni-ui/uni-fav/i18n/en.json +2 -2
- package/dist/uni/uni-ui/uni-fav/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-fav/i18n/zh-Hans.json +2 -2
- package/dist/uni/uni-ui/uni-fav/i18n/zh-Hant.json +2 -2
- package/dist/uni/uni-ui/uni-fav/uni-fav.vue +155 -147
- package/dist/uni/uni-ui/uni-file-picker/choose-and-upload-file.js +172 -198
- package/dist/uni/uni-ui/uni-file-picker/uni-file-picker.vue +636 -634
- package/dist/uni/uni-ui/uni-file-picker/upload-file.vue +294 -293
- package/dist/uni/uni-ui/uni-file-picker/upload-image.vue +267 -270
- package/dist/uni/uni-ui/uni-file-picker/utils.js +81 -82
- package/dist/uni/uni-ui/uni-forms/uni-forms.vue +360 -372
- package/dist/uni/uni-ui/uni-forms/utils.js +170 -174
- package/dist/uni/uni-ui/uni-forms/validate.js +447 -456
- package/dist/uni/uni-ui/uni-forms-item/uni-forms-item.vue +497 -497
- package/dist/uni/uni-ui/uni-goods-nav/i18n/en.json +4 -4
- package/dist/uni/uni-ui/uni-goods-nav/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hans.json +4 -4
- package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hant.json +4 -4
- package/dist/uni/uni-ui/uni-goods-nav/uni-goods-nav.vue +238 -222
- package/dist/uni/uni-ui/uni-grid/uni-grid.vue +134 -134
- package/dist/uni/uni-ui/uni-grid-item/uni-grid-item.vue +121 -119
- package/dist/uni/uni-ui/uni-group/uni-group.vue +121 -121
- package/dist/uni/uni-ui/uni-icons/icons.js +1170 -1168
- package/dist/uni/uni-ui/uni-icons/uni-icons.vue +91 -86
- package/dist/uni/uni-ui/uni-icons/uniicons.css +166 -166
- package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +129 -129
- package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list.vue +352 -347
- package/dist/uni/uni-ui/uni-link/uni-link.vue +134 -119
- package/dist/uni/uni-ui/uni-list/uni-list.vue +119 -110
- package/dist/uni/uni-ui/uni-list/uni-refresh.vue +14 -14
- package/dist/uni/uni-ui/uni-list/uni-refresh.wxs +14 -14
- package/dist/uni/uni-ui/uni-list-ad/uni-list-ad.vue +101 -95
- package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.scss +18 -18
- package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.vue +602 -586
- package/dist/uni/uni-ui/uni-list-item/uni-list-item.vue +507 -503
- package/dist/uni/uni-ui/uni-load-more/i18n/en.json +3 -3
- package/dist/uni/uni-ui/uni-load-more/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hans.json +3 -3
- package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hant.json +3 -3
- package/dist/uni/uni-ui/uni-load-more/uni-load-more.vue +402 -392
- package/dist/uni/uni-ui/uni-nav-bar/uni-nav-bar.vue +328 -330
- package/dist/uni/uni-ui/uni-nav-bar/uni-status-bar.vue +17 -17
- package/dist/uni/uni-ui/uni-notice-bar/uni-notice-bar.vue +422 -401
- package/dist/uni/uni-ui/uni-number-box/uni-number-box.vue +211 -205
- package/dist/uni/uni-ui/uni-pagination/i18n/en.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/es.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/fr.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/index.js +12 -11
- package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hans.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hant.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/uni-pagination.vue +450 -433
- package/dist/uni/uni-ui/uni-popup/uni-popup.vue +404 -404
- package/dist/uni/uni-ui/uni-popup-dialog/keypress.js +42 -42
- package/dist/uni/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +1 -0
- package/dist/uni/uni-ui/uni-popup-message/uni-popup-message.vue +126 -125
- package/dist/uni/uni-ui/uni-popup-share/uni-popup-share.vue +172 -172
- package/dist/uni/uni-ui/uni-rate/uni-rate.vue +343 -347
- package/dist/uni/uni-ui/uni-row/uni-row.vue +180 -182
- package/dist/uni/uni-ui/uni-scss/changelog.md +11 -4
- package/dist/uni/uni-ui/uni-scss/package.json +73 -73
- package/dist/uni/uni-ui/uni-scss/readme.md +2 -1
- package/dist/uni/uni-ui/uni-scss/styles/setting/_border.scss +2 -2
- package/dist/uni/uni-ui/uni-scss/styles/setting/_color.scss +46 -47
- package/dist/uni/uni-ui/uni-scss/styles/setting/_radius.scss +49 -49
- package/dist/uni/uni-ui/uni-scss/styles/setting/_space.scss +52 -53
- package/dist/uni/uni-ui/uni-scss/styles/setting/_styles.scss +142 -147
- package/dist/uni/uni-ui/uni-scss/styles/setting/_text.scss +20 -20
- package/dist/uni/uni-ui/uni-scss/styles/setting/_variables.scss +111 -95
- package/dist/uni/uni-ui/uni-scss/styles/tools/functions.scss +28 -18
- package/dist/uni/uni-ui/uni-scss/theme.scss +10 -7
- package/dist/uni/uni-ui/uni-scss/variables.scss +42 -24
- package/dist/uni/uni-ui/uni-search-bar/i18n/en.json +3 -3
- package/dist/uni/uni-ui/uni-search-bar/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hans.json +2 -2
- package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hant.json +2 -2
- package/dist/uni/uni-ui/uni-search-bar/uni-search-bar.vue +290 -281
- package/dist/uni/uni-ui/uni-section/uni-section.vue +149 -146
- package/dist/uni/uni-ui/uni-segmented-control/uni-segmented-control.vue +141 -131
- package/dist/uni/uni-ui/uni-steps/uni-steps.vue +255 -236
- package/dist/uni/uni-ui/uni-swipe-action/uni-swipe-action.vue +51 -51
- package/dist/uni/uni-ui/uni-swipe-action-item/bindingx.js +276 -282
- package/dist/uni/uni-ui/uni-swipe-action-item/isPC.js +10 -10
- package/dist/uni/uni-ui/uni-swipe-action-item/mpalipay.js +182 -187
- package/dist/uni/uni-ui/uni-swipe-action-item/mpother.js +235 -244
- package/dist/uni/uni-ui/uni-swipe-action-item/mpwxs.js +70 -75
- package/dist/uni/uni-ui/uni-swipe-action-item/render.js +238 -247
- package/dist/uni/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +387 -313
- package/dist/uni/uni-ui/uni-swipe-action-item/wx.wxs +206 -215
- package/dist/uni/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +241 -197
- package/dist/uni/uni-ui/uni-table/uni-table.vue +445 -447
- package/dist/uni/uni-ui/uni-tag/uni-tag.vue +234 -244
- package/dist/uni/uni-ui/uni-tbody/uni-tbody.vue +20 -23
- package/dist/uni/uni-ui/uni-td/uni-td.vue +79 -80
- package/dist/uni/uni-ui/uni-th/filter-dropdown.vue +510 -503
- package/dist/uni/uni-ui/uni-th/uni-th.vue +289 -273
- package/dist/uni/uni-ui/uni-thead/uni-thead.vue +115 -114
- package/dist/uni/uni-ui/uni-title/uni-title.vue +151 -154
- package/dist/uni/uni-ui/uni-tooltip/uni-tooltip.vue +55 -60
- package/dist/uni/uni-ui/uni-tr/table-checkbox.vue +162 -163
- package/dist/uni/uni-ui/uni-tr/uni-tr.vue +158 -157
- package/dist/uni/uni-ui/uni-transition/createAnimation.js +130 -113
- package/dist/uni/uni-ui/uni-transition/uni-transition.vue +274 -272
- package/package.json +1 -1
|
@@ -1,367 +1,372 @@
|
|
|
1
1
|
<template>
|
|
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
|
-
|
|
2
|
+
<view class="uni-indexed-list" ref="list" id="list">
|
|
3
|
+
<!-- #ifdef APP-NVUE -->
|
|
4
|
+
<list class="uni-indexed-list__scroll" scrollable="true" show-scrollbar="false">
|
|
5
|
+
<cell v-for="(list, idx) in lists" :key="idx" :ref="'uni-indexed-list-' + idx">
|
|
6
|
+
<!-- #endif -->
|
|
7
|
+
<!-- #ifndef APP-NVUE -->
|
|
8
|
+
<scroll-view :scroll-into-view="scrollViewId" class="uni-indexed-list__scroll" scroll-y>
|
|
9
|
+
<view v-for="(list, idx) in lists" :key="idx" :id="'uni-indexed-list-' + idx">
|
|
10
|
+
<!-- #endif -->
|
|
11
|
+
<indexed-list-item :list="list" :loaded="loaded" :idx="idx" :showSelect="showSelect" @itemClick="onClick"></indexed-list-item>
|
|
12
|
+
<!-- #ifndef APP-NVUE -->
|
|
13
|
+
</view>
|
|
14
|
+
</scroll-view>
|
|
15
|
+
<!-- #endif -->
|
|
16
|
+
<!-- #ifdef APP-NVUE -->
|
|
17
|
+
</cell>
|
|
18
|
+
</list>
|
|
19
|
+
<!-- #endif -->
|
|
20
|
+
<view
|
|
21
|
+
class="uni-indexed-list__menu"
|
|
22
|
+
@touchstart="touchStart"
|
|
23
|
+
@touchmove.stop.prevent="touchMove"
|
|
24
|
+
@touchend="touchEnd"
|
|
25
|
+
@mousedown.stop="mousedown"
|
|
26
|
+
@mousemove.stop.prevent="mousemove"
|
|
27
|
+
@mouseleave.stop="mouseleave"
|
|
28
|
+
>
|
|
29
|
+
<view
|
|
30
|
+
v-for="(list, key) in lists"
|
|
31
|
+
:key="key"
|
|
32
|
+
class="uni-indexed-list__menu-item"
|
|
33
|
+
:class="touchmoveIndex == key ? 'uni-indexed-list__menu--active' : ''"
|
|
34
|
+
>
|
|
35
|
+
<text class="uni-indexed-list__menu-text" :class="touchmoveIndex == key ? 'uni-indexed-list__menu-text--active' : ''">{{ list.key }}</text>
|
|
36
|
+
</view>
|
|
37
|
+
</view>
|
|
38
|
+
<view v-if="touchmove" class="uni-indexed-list__alert-wrapper">
|
|
39
|
+
<text class="uni-indexed-list__alert">{{ lists[touchmoveIndex].key }}</text>
|
|
40
|
+
</view>
|
|
41
|
+
</view>
|
|
34
42
|
</template>
|
|
35
43
|
<script>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
import indexedListItem from './uni-indexed-list-item.vue';
|
|
45
|
+
// #ifdef APP-NVUE
|
|
46
|
+
const dom = weex.requireModule('dom');
|
|
47
|
+
// #endif
|
|
48
|
+
// #ifdef APP-PLUS
|
|
49
|
+
function throttle(func, delay) {
|
|
50
|
+
var prev = Date.now();
|
|
51
|
+
return function () {
|
|
52
|
+
var context = this;
|
|
53
|
+
var args = arguments;
|
|
54
|
+
var now = Date.now();
|
|
55
|
+
if (now - prev >= delay) {
|
|
56
|
+
func.apply(context, args);
|
|
57
|
+
prev = Date.now();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
53
61
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
function touchMove(e) {
|
|
63
|
+
let pageY = e.touches[0].pageY;
|
|
64
|
+
let index = Math.floor((pageY - this.winOffsetY) / this.itemHeight);
|
|
65
|
+
if (this.touchmoveIndex === index) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
let item = this.lists[index];
|
|
69
|
+
if (item) {
|
|
70
|
+
// #ifndef APP-NVUE
|
|
71
|
+
this.scrollViewId = 'uni-indexed-list-' + index;
|
|
72
|
+
this.touchmoveIndex = index;
|
|
73
|
+
// #endif
|
|
74
|
+
// #ifdef APP-NVUE
|
|
75
|
+
dom.scrollToElement(this.$refs['uni-indexed-list-' + index][0], {
|
|
76
|
+
animated: false,
|
|
77
|
+
});
|
|
78
|
+
this.touchmoveIndex = index;
|
|
79
|
+
// #endif
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const throttleTouchMove = throttle(touchMove, 40);
|
|
83
|
+
// #endif
|
|
76
84
|
|
|
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
|
-
|
|
85
|
+
/**
|
|
86
|
+
* IndexedList 索引列表
|
|
87
|
+
* @description 用于展示索引列表
|
|
88
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=375
|
|
89
|
+
* @property {Boolean} showSelect = [true|false] 展示模式
|
|
90
|
+
* @value true 展示模式
|
|
91
|
+
* @value false 选择模式
|
|
92
|
+
* @property {Object} options 索引列表需要的数据对象
|
|
93
|
+
* @event {Function} click 点击列表事件 ,返回当前选择项的事件对象
|
|
94
|
+
* @example <uni-indexed-list options="" showSelect="false" @click=""></uni-indexed-list>
|
|
95
|
+
*/
|
|
96
|
+
export default {
|
|
97
|
+
name: 'UniIndexedList',
|
|
98
|
+
components: {
|
|
99
|
+
indexedListItem,
|
|
100
|
+
},
|
|
101
|
+
emits: ['click'],
|
|
102
|
+
props: {
|
|
103
|
+
options: {
|
|
104
|
+
type: Array,
|
|
105
|
+
default() {
|
|
106
|
+
return [];
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
showSelect: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
default: false,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
data() {
|
|
115
|
+
return {
|
|
116
|
+
lists: [],
|
|
117
|
+
winHeight: 0,
|
|
118
|
+
itemHeight: 0,
|
|
119
|
+
winOffsetY: 0,
|
|
120
|
+
touchmove: false,
|
|
121
|
+
touchmoveIndex: -1,
|
|
122
|
+
scrollViewId: '',
|
|
123
|
+
touchmovable: true,
|
|
124
|
+
loaded: false,
|
|
125
|
+
isPC: false,
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
watch: {
|
|
129
|
+
options: {
|
|
130
|
+
handler: function () {
|
|
131
|
+
this.setList();
|
|
132
|
+
},
|
|
133
|
+
deep: true,
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
mounted() {
|
|
137
|
+
// #ifdef H5
|
|
138
|
+
this.isPC = this.IsPC();
|
|
139
|
+
// #endif
|
|
140
|
+
setTimeout(() => {
|
|
141
|
+
this.setList();
|
|
142
|
+
}, 50);
|
|
143
|
+
setTimeout(() => {
|
|
144
|
+
this.loaded = true;
|
|
145
|
+
}, 300);
|
|
146
|
+
},
|
|
147
|
+
methods: {
|
|
148
|
+
setList() {
|
|
149
|
+
let index = 0;
|
|
150
|
+
this.lists = [];
|
|
151
|
+
this.options.forEach((value) => {
|
|
152
|
+
if (value.data.length === 0) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
let indexBefore = index;
|
|
156
|
+
let items = value.data.map((item) => {
|
|
157
|
+
let obj = {};
|
|
158
|
+
obj['key'] = value.letter;
|
|
159
|
+
obj['name'] = item;
|
|
160
|
+
obj['itemIndex'] = index;
|
|
161
|
+
index++;
|
|
162
|
+
obj.checked = item.checked ? item.checked : false;
|
|
163
|
+
return obj;
|
|
164
|
+
});
|
|
165
|
+
this.lists.push({
|
|
166
|
+
title: value.letter,
|
|
167
|
+
key: value.letter,
|
|
168
|
+
items: items,
|
|
169
|
+
itemIndex: indexBefore,
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
// #ifndef APP-NVUE
|
|
173
|
+
uni.createSelectorQuery()
|
|
174
|
+
.in(this)
|
|
175
|
+
.select('#list')
|
|
176
|
+
.boundingClientRect()
|
|
177
|
+
.exec((ret) => {
|
|
178
|
+
this.winOffsetY = ret[0].top;
|
|
179
|
+
this.winHeight = ret[0].height;
|
|
180
|
+
this.itemHeight = this.winHeight / this.lists.length;
|
|
181
|
+
});
|
|
182
|
+
// #endif
|
|
183
|
+
// #ifdef APP-NVUE
|
|
184
|
+
dom.getComponentRect(this.$refs['list'], (res) => {
|
|
185
|
+
this.winOffsetY = res.size.top;
|
|
186
|
+
this.winHeight = res.size.height;
|
|
187
|
+
this.itemHeight = this.winHeight / this.lists.length;
|
|
188
|
+
});
|
|
189
|
+
// #endif
|
|
190
|
+
},
|
|
191
|
+
touchStart(e) {
|
|
192
|
+
this.touchmove = true;
|
|
193
|
+
let pageY = this.isPC ? e.pageY : e.touches[0].pageY;
|
|
194
|
+
let index = Math.floor((pageY - this.winOffsetY) / this.itemHeight);
|
|
195
|
+
let item = this.lists[index];
|
|
196
|
+
if (item) {
|
|
197
|
+
this.scrollViewId = 'uni-indexed-list-' + index;
|
|
198
|
+
this.touchmoveIndex = index;
|
|
199
|
+
// #ifdef APP-NVUE
|
|
200
|
+
dom.scrollToElement(this.$refs['uni-indexed-list-' + index][0], {
|
|
201
|
+
animated: false,
|
|
202
|
+
});
|
|
203
|
+
// #endif
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
touchMove(e) {
|
|
207
|
+
// #ifndef APP-PLUS
|
|
208
|
+
let pageY = this.isPC ? e.pageY : e.touches[0].pageY;
|
|
209
|
+
let index = Math.floor((pageY - this.winOffsetY) / this.itemHeight);
|
|
210
|
+
if (this.touchmoveIndex === index) {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
let item = this.lists[index];
|
|
214
|
+
if (item) {
|
|
215
|
+
this.scrollViewId = 'uni-indexed-list-' + index;
|
|
216
|
+
this.touchmoveIndex = index;
|
|
217
|
+
}
|
|
218
|
+
// #endif
|
|
219
|
+
// #ifdef APP-PLUS
|
|
220
|
+
throttleTouchMove.call(this, e);
|
|
221
|
+
// #endif
|
|
222
|
+
},
|
|
223
|
+
touchEnd() {
|
|
224
|
+
this.touchmove = false;
|
|
225
|
+
// this.touchmoveIndex = -1
|
|
226
|
+
},
|
|
219
227
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
228
|
+
/**
|
|
229
|
+
* 兼容 PC @tian
|
|
230
|
+
*/
|
|
223
231
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
232
|
+
mousedown(e) {
|
|
233
|
+
if (!this.isPC) return;
|
|
234
|
+
this.touchStart(e);
|
|
235
|
+
},
|
|
236
|
+
mousemove(e) {
|
|
237
|
+
if (!this.isPC) return;
|
|
238
|
+
this.touchMove(e);
|
|
239
|
+
},
|
|
240
|
+
mouseleave(e) {
|
|
241
|
+
if (!this.isPC) return;
|
|
242
|
+
this.touchEnd(e);
|
|
243
|
+
},
|
|
236
244
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
245
|
+
// #ifdef H5
|
|
246
|
+
IsPC() {
|
|
247
|
+
var userAgentInfo = navigator.userAgent;
|
|
248
|
+
var Agents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'];
|
|
249
|
+
var flag = true;
|
|
250
|
+
for (let v = 0; v < Agents.length - 1; v++) {
|
|
251
|
+
if (userAgentInfo.indexOf(Agents[v]) > 0) {
|
|
252
|
+
flag = false;
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return flag;
|
|
257
|
+
},
|
|
258
|
+
// #endif
|
|
251
259
|
|
|
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
|
-
}
|
|
260
|
+
onClick(e) {
|
|
261
|
+
let { idx, index } = e;
|
|
262
|
+
let obj = {};
|
|
263
|
+
for (let key in this.lists[idx].items[index]) {
|
|
264
|
+
obj[key] = this.lists[idx].items[index][key];
|
|
265
|
+
}
|
|
266
|
+
let select = [];
|
|
267
|
+
if (this.showSelect) {
|
|
268
|
+
this.lists[idx].items[index].checked = !this.lists[idx].items[index].checked;
|
|
269
|
+
this.lists.forEach((value, idx) => {
|
|
270
|
+
value.items.forEach((item, index) => {
|
|
271
|
+
if (item.checked) {
|
|
272
|
+
let obj = {};
|
|
273
|
+
for (let key in this.lists[idx].items[index]) {
|
|
274
|
+
obj[key] = this.lists[idx].items[index][key];
|
|
275
|
+
}
|
|
276
|
+
select.push(obj);
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
this.$emit('click', {
|
|
282
|
+
item: obj,
|
|
283
|
+
select: select,
|
|
284
|
+
});
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
};
|
|
284
288
|
</script>
|
|
285
|
-
<style lang="scss"
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
289
|
+
<style lang="scss">
|
|
290
|
+
.uni-indexed-list {
|
|
291
|
+
position: absolute;
|
|
292
|
+
left: 0;
|
|
293
|
+
top: 0;
|
|
294
|
+
right: 0;
|
|
295
|
+
bottom: 0;
|
|
296
|
+
/* #ifndef APP-NVUE */
|
|
297
|
+
display: flex;
|
|
298
|
+
/* #endif */
|
|
299
|
+
flex-direction: row;
|
|
300
|
+
}
|
|
297
301
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
302
|
+
.uni-indexed-list__scroll {
|
|
303
|
+
flex: 1;
|
|
304
|
+
}
|
|
301
305
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
306
|
+
.uni-indexed-list__menu {
|
|
307
|
+
width: 24px;
|
|
308
|
+
/* #ifndef APP-NVUE */
|
|
309
|
+
display: flex;
|
|
310
|
+
/* #endif */
|
|
311
|
+
flex-direction: column;
|
|
312
|
+
}
|
|
309
313
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
314
|
+
.uni-indexed-list__menu-item {
|
|
315
|
+
/* #ifndef APP-NVUE */
|
|
316
|
+
display: flex;
|
|
317
|
+
/* #endif */
|
|
318
|
+
flex: 1;
|
|
319
|
+
align-items: center;
|
|
320
|
+
justify-content: center;
|
|
321
|
+
/* #ifdef H5 */
|
|
322
|
+
cursor: pointer;
|
|
323
|
+
/* #endif */
|
|
324
|
+
}
|
|
321
325
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
326
|
+
.uni-indexed-list__menu-text {
|
|
327
|
+
font-size: 12px;
|
|
328
|
+
text-align: center;
|
|
329
|
+
color: #aaa;
|
|
330
|
+
}
|
|
327
331
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
332
|
+
.uni-indexed-list__menu--active {
|
|
333
|
+
// background-color: rgb(200, 200, 200);
|
|
334
|
+
}
|
|
331
335
|
|
|
332
|
-
|
|
336
|
+
.uni-indexed-list__menu--active {
|
|
337
|
+
}
|
|
333
338
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
339
|
+
.uni-indexed-list__menu-text--active {
|
|
340
|
+
border-radius: 16px;
|
|
341
|
+
width: 16px;
|
|
342
|
+
height: 16px;
|
|
343
|
+
line-height: 16px;
|
|
344
|
+
background-color: #007aff;
|
|
345
|
+
color: #fff;
|
|
346
|
+
}
|
|
342
347
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
348
|
+
.uni-indexed-list__alert-wrapper {
|
|
349
|
+
position: absolute;
|
|
350
|
+
left: 0;
|
|
351
|
+
top: 0;
|
|
352
|
+
right: 0;
|
|
353
|
+
bottom: 0;
|
|
354
|
+
/* #ifndef APP-NVUE */
|
|
355
|
+
display: flex;
|
|
356
|
+
/* #endif */
|
|
357
|
+
flex-direction: row;
|
|
358
|
+
align-items: center;
|
|
359
|
+
justify-content: center;
|
|
360
|
+
}
|
|
356
361
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
362
|
+
.uni-indexed-list__alert {
|
|
363
|
+
width: 80px;
|
|
364
|
+
height: 80px;
|
|
365
|
+
border-radius: 80px;
|
|
366
|
+
text-align: center;
|
|
367
|
+
line-height: 80px;
|
|
368
|
+
font-size: 35px;
|
|
369
|
+
color: #fff;
|
|
370
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
371
|
+
}
|
|
367
372
|
</style>
|