@10yun/cv-mobile-ui 0.4.1 → 0.4.2
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/package.json +1 -1
- package/ui-cv/cv-badge/{uni-badge.vue → cv-badge.vue} +2 -2
- package/ui-cv/cv-calendar/calendar.js +762 -345
- package/ui-cv/cv-calendar/cv-calendar-item.vue +198 -0
- package/ui-cv/cv-calendar/cv-calendar.vue +508 -0
- package/ui-cv/cv-card/cv-card.vue +427 -0
- package/ui-cv/cv-col/cv-col.vue +2965 -0
- package/ui-cv/cv-collapse/cv-collapse.vue +146 -0
- package/ui-cv/cv-collapse-item/cv-collapse-item.vue +395 -0
- package/ui-cv/cv-combox/cv-combox.vue +250 -0
- package/ui-cv/cv-countdown/cv-countdown.vue +245 -0
- package/ui-cv/cv-data-checkbox/cv-data-checkbox.vue +841 -0
- package/ui-cv/cv-data-indexed-list/cv-data-indexed-list-item.vue +154 -0
- package/ui-cv/cv-data-indexed-list/cv-data-indexed-list.vue +376 -0
- package/ui-cv/cv-data-picker/cv-data-picker.vue +486 -0
- package/ui-cv/cv-data-pickerview/{uni-data-picker.js → cv-data-picker.js} +0 -0
- package/ui-cv/cv-data-pickerview/cv-data-pickerview.vue +304 -0
- package/ui-cv/cv-dateformat/cv-dateformat.vue +86 -0
- package/ui-cv/cv-datetime-picker/calendar.vue +752 -738
- package/ui-cv/cv-datetime-picker/cv-datetime-picker.vue +958 -0
- package/ui-cv/cv-datetime-picker/time-picker.vue +900 -892
- package/ui-cv/cv-easyinput/cv-easyinput.vue +514 -0
- package/ui-cv/cv-fab/cv-fab.vue +465 -0
- package/ui-cv/cv-fab/{uni-fab.vue.bak → cv-fab.vue.bak} +2 -2
- package/ui-cv/cv-fav/cv-fav.vue +150 -0
- package/ui-cv/cv-file-picker/cv-file-picker.vue +619 -0
- package/ui-cv/cv-form-item/cv-form-item.vue +1 -1
- package/ui-cv/cv-goods-nav/{uni-goods-nav.vue → cv-goods-nav.vue} +1 -1
- package/ui-cv/{cv-icons2/cv-icons2.vue → cv-icon2/cv-icon2.vue} +3 -3
- package/ui-cv/{cv-icons2 → cv-icon2}/icons.js +0 -0
- package/ui-cv/{cv-icons2 → cv-icon2}/uni.ttf +0 -0
- package/ui-cv/cv-indexed-list/cv-indexed-list-item.vue +154 -0
- package/ui-cv/cv-indexed-list/cv-indexed-list.vue +371 -0
- package/ui-cv/cv-input-password/cv-input-password.vue +2 -2
- package/ui-cv/{cv-link/uni-link.vue → cv-link2/cv-link2.vue} +1 -1
- package/ui-cv/cv-list/cv-list.vue +107 -0
- package/ui-cv/cv-list/cv-refresh.vue +65 -0
- package/ui-cv/cv-list-ad/cv-list-ad.vue +113 -0
- package/ui-cv/cv-list-chat/{uni-list-chat.scss → cv-list-chat.scss} +0 -0
- package/ui-cv/cv-list-chat/{uni-list-chat.vue → cv-list-chat.vue} +0 -0
- package/ui-cv/cv-list-item/cv-list-item.vue +449 -0
- package/ui-cv/cv-nav-bar/cv-nav-bar.vue +256 -0
- package/ui-cv/cv-nav-bar/{uni-status-bar.vue → cv-status-bar.vue} +0 -0
- package/ui-cv/cv-notice-bar/cv-notice-bar.vue +453 -0
- package/ui-cv/cv-number-box/cv-number-box.vue +223 -0
- package/ui-cv/cv-pagination/cv-pagination.vue +397 -0
- package/ui-cv/cv-popup/cv-popup.vue +429 -0
- package/ui-cv/cv-popup-dialog/{uni-popup-dialog.vue → cv-popup-dialog.vue} +0 -0
- package/ui-cv/cv-popup-message/cv-popup-message.vue +143 -0
- package/ui-cv/cv-popup-share/{uni-popup-share.vue → cv-popup-share.vue} +0 -0
- package/ui-cv/cv-row/{uni-row.vue → cv-row.vue} +1 -1
- package/ui-cv/cv-search-bar/cv-search-bar.vue +280 -0
- package/ui-cv/cv-section/{uni-section.vue → cv-section.vue} +0 -0
- package/ui-cv/cv-segmented-control/{uni-segmented-control.vue → cv-segmented-control.vue} +0 -0
- package/ui-cv/cv-status-bar/{uni-status-bar.vue → cv-status-bar.vue} +0 -0
- package/ui-cv/cv-steps/cv-steps.vue +293 -0
- package/ui-cv/cv-swipe-action/{uni-swipe-action.vue → cv-swipe-action.vue} +0 -0
- package/ui-cv/cv-swipe-action-item/{uni-swipe-action-item.vue → cv-swipe-action-item.vue} +0 -0
- package/ui-cv/cv-swiper-dot/cv-swiper-dot.vue +255 -0
- package/ui-cv/cv-table/cv-table.vue +460 -0
- package/ui-cv/cv-tag/cv-tag.vue +276 -0
- package/ui-cv/cv-tbody/cv-tbody.vue +28 -0
- package/ui-cv/cv-td/cv-td.vue +93 -0
- package/ui-cv/cv-test/{uni-test.vue → cv-test.vue} +0 -0
- package/ui-cv/cv-th/cv-th.vue +270 -0
- package/ui-cv/cv-thead/cv-thead.vue +114 -0
- package/ui-cv/cv-title/cv-title.vue +168 -0
- package/ui-cv/cv-tr/cv-tr.vue +166 -0
- package/ui-cv/cv-transition/cv-transition.vue +279 -0
- package/ui-cv/cv-calendar/uni-calendar-item.vue +0 -171
- package/ui-cv/cv-calendar/uni-calendar.vue +0 -504
- package/ui-cv/cv-card/uni-card.vue +0 -420
- package/ui-cv/cv-col/uni-col.vue +0 -2968
- package/ui-cv/cv-collapse/uni-collapse.vue +0 -146
- package/ui-cv/cv-collapse-item/uni-collapse-item.vue +0 -378
- package/ui-cv/cv-combox/uni-combox.vue +0 -237
- package/ui-cv/cv-countdown/uni-countdown.vue +0 -234
- package/ui-cv/cv-data-checkbox/uni-data-checkbox.vue +0 -792
- package/ui-cv/cv-data-indexed-list/uni-data-indexed-list-item.vue +0 -142
- package/ui-cv/cv-data-indexed-list/uni-data-indexed-list.vue +0 -364
- package/ui-cv/cv-data-picker/uni-data-picker.vue +0 -468
- package/ui-cv/cv-data-pickerview/uni-data-pickerview.vue +0 -298
- package/ui-cv/cv-dateformat/uni-dateformat.vue +0 -88
- package/ui-cv/cv-datetime-picker/uni-datetime-picker.vue +0 -874
- package/ui-cv/cv-easyinput/uni-easyinput.vue +0 -438
- package/ui-cv/cv-fab/uni-fab.vue +0 -443
- package/ui-cv/cv-fav/uni-fav.vue +0 -136
- package/ui-cv/cv-file-picker/uni-file-picker.vue +0 -614
- package/ui-cv/cv-indexed-list/uni-indexed-list-item.vue +0 -142
- package/ui-cv/cv-indexed-list/uni-indexed-list.vue +0 -357
- package/ui-cv/cv-list/uni-list.vue +0 -107
- package/ui-cv/cv-list/uni-refresh.vue +0 -65
- package/ui-cv/cv-list-ad/uni-list-ad.vue +0 -106
- package/ui-cv/cv-list-item/uni-list-item.vue +0 -428
- package/ui-cv/cv-nav-bar/uni-nav-bar.vue +0 -244
- package/ui-cv/cv-notice-bar/uni-notice-bar.vue +0 -394
- package/ui-cv/cv-number-box/uni-number-box.vue +0 -224
- package/ui-cv/cv-pagination/uni-pagination.vue +0 -376
- package/ui-cv/cv-popup/uni-popup.vue +0 -412
- package/ui-cv/cv-popup-message/uni-popup-message.vue +0 -143
- package/ui-cv/cv-search-bar/uni-search-bar.vue +0 -262
- package/ui-cv/cv-steps/uni-steps.vue +0 -250
- package/ui-cv/cv-swiper-dot/uni-swiper-dot.vue +0 -205
- package/ui-cv/cv-table/uni-table.vue +0 -455
- package/ui-cv/cv-tag/uni-tag.vue +0 -283
- package/ui-cv/cv-tbody/uni-tbody.vue +0 -30
- package/ui-cv/cv-td/uni-td.vue +0 -88
- package/ui-cv/cv-th/uni-th.vue +0 -259
- package/ui-cv/cv-thead/uni-thead.vue +0 -114
- package/ui-cv/cv-title/uni-title.vue +0 -171
- package/ui-cv/cv-tr/uni-tr.vue +0 -156
- package/ui-cv/cv-transition/uni-transition.vue +0 -287
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view>
|
|
3
|
+
<view v-if="loaded || list.itemIndex < 15" class="uni-indexed-list__title-wrapper">
|
|
4
|
+
<text v-if="list.items && list.items.length > 0" class="uni-indexed-list__title">{{ list.key }}</text>
|
|
5
|
+
</view>
|
|
6
|
+
<view v-if="(loaded || list.itemIndex < 15) && list.items && list.items.length > 0" class="uni-indexed-list__list">
|
|
7
|
+
<view
|
|
8
|
+
v-for="(item, index) in list.items"
|
|
9
|
+
:key="index"
|
|
10
|
+
class="uni-indexed-list__item"
|
|
11
|
+
hover-class="uni-indexed-list__item--hover"
|
|
12
|
+
>
|
|
13
|
+
<view class="uni-indexed-list__item-container" @click="onClick(idx, index)">
|
|
14
|
+
<view
|
|
15
|
+
class="uni-indexed-list__item-border"
|
|
16
|
+
:class="{ 'uni-indexed-list__item-border--last': index === list.items.length - 1 }"
|
|
17
|
+
>
|
|
18
|
+
<view v-if="showSelect" style="margin-right: 20rpx">
|
|
19
|
+
<cv-icon2
|
|
20
|
+
:type="item.checked ? 'checkbox-filled' : 'circle'"
|
|
21
|
+
:color="item.checked ? '#007aff' : '#aaa'"
|
|
22
|
+
size="24"
|
|
23
|
+
/>
|
|
24
|
+
</view>
|
|
25
|
+
<text class="uni-indexed-list__item-content">{{ item.name }}</text>
|
|
26
|
+
</view>
|
|
27
|
+
</view>
|
|
28
|
+
</view>
|
|
29
|
+
</view>
|
|
30
|
+
</view>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script>
|
|
34
|
+
export default {
|
|
35
|
+
name: 'UniIndexedList',
|
|
36
|
+
emits: ['itemClick'],
|
|
37
|
+
props: {
|
|
38
|
+
loaded: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false
|
|
41
|
+
},
|
|
42
|
+
idx: {
|
|
43
|
+
type: Number,
|
|
44
|
+
default: 0
|
|
45
|
+
},
|
|
46
|
+
list: {
|
|
47
|
+
type: Object,
|
|
48
|
+
default() {
|
|
49
|
+
return {};
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
showSelect: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
methods: {
|
|
58
|
+
onClick(idx, index) {
|
|
59
|
+
this.$emit('itemClick', {
|
|
60
|
+
idx,
|
|
61
|
+
index
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<style scoped>
|
|
69
|
+
.uni-indexed-list__list {
|
|
70
|
+
background-color: #ffffff;
|
|
71
|
+
/* #ifndef APP-NVUE */
|
|
72
|
+
display: flex;
|
|
73
|
+
/* #endif */
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
border-top-style: solid;
|
|
76
|
+
border-top-width: 1px;
|
|
77
|
+
border-top-color: #e5e5e5;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.uni-indexed-list__item {
|
|
81
|
+
font-size: 16px;
|
|
82
|
+
/* #ifndef APP-NVUE */
|
|
83
|
+
display: flex;
|
|
84
|
+
/* #endif */
|
|
85
|
+
flex: 1;
|
|
86
|
+
flex-direction: row;
|
|
87
|
+
justify-content: space-between;
|
|
88
|
+
align-items: center;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.uni-indexed-list__item-container {
|
|
92
|
+
padding-left: 15px;
|
|
93
|
+
flex: 1;
|
|
94
|
+
position: relative;
|
|
95
|
+
/* #ifndef APP-NVUE */
|
|
96
|
+
display: flex;
|
|
97
|
+
box-sizing: border-box;
|
|
98
|
+
/* #endif */
|
|
99
|
+
flex-direction: row;
|
|
100
|
+
justify-content: space-between;
|
|
101
|
+
align-items: center;
|
|
102
|
+
/* #ifdef H5 */
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
/* #endif */
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.uni-indexed-list__item-border {
|
|
108
|
+
flex: 1;
|
|
109
|
+
position: relative;
|
|
110
|
+
/* #ifndef APP-NVUE */
|
|
111
|
+
display: flex;
|
|
112
|
+
box-sizing: border-box;
|
|
113
|
+
/* #endif */
|
|
114
|
+
flex-direction: row;
|
|
115
|
+
justify-content: space-between;
|
|
116
|
+
align-items: center;
|
|
117
|
+
height: 50px;
|
|
118
|
+
padding: 15px;
|
|
119
|
+
padding-left: 0;
|
|
120
|
+
border-bottom-style: solid;
|
|
121
|
+
border-bottom-width: 1px;
|
|
122
|
+
border-bottom-color: #e5e5e5;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.uni-indexed-list__item-border--last {
|
|
126
|
+
border-bottom-width: 0px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.uni-indexed-list__item-content {
|
|
130
|
+
flex: 1;
|
|
131
|
+
font-size: 14px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.uni-indexed-list {
|
|
135
|
+
/* #ifndef APP-NVUE */
|
|
136
|
+
display: flex;
|
|
137
|
+
/* #endif */
|
|
138
|
+
flex-direction: row;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.uni-indexed-list__title-wrapper {
|
|
142
|
+
/* #ifndef APP-NVUE */
|
|
143
|
+
display: flex;
|
|
144
|
+
width: 100%;
|
|
145
|
+
/* #endif */
|
|
146
|
+
background-color: #f7f7f7;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.uni-indexed-list__title {
|
|
150
|
+
padding: 6px 12px;
|
|
151
|
+
line-height: 24px;
|
|
152
|
+
font-size: 12px;
|
|
153
|
+
}
|
|
154
|
+
</style>
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
<template>
|
|
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
|
|
12
|
+
:list="list"
|
|
13
|
+
:loaded="loaded"
|
|
14
|
+
:idx="idx"
|
|
15
|
+
:showSelect="showSelect"
|
|
16
|
+
@itemClick="onClick"
|
|
17
|
+
></indexed-list-item>
|
|
18
|
+
<!-- #ifndef APP-NVUE -->
|
|
19
|
+
</view>
|
|
20
|
+
</scroll-view>
|
|
21
|
+
<!-- #endif -->
|
|
22
|
+
<!-- #ifdef APP-NVUE -->
|
|
23
|
+
</cell>
|
|
24
|
+
</list>
|
|
25
|
+
<!-- #endif -->
|
|
26
|
+
<view
|
|
27
|
+
class="uni-indexed-list__menu"
|
|
28
|
+
:class="touchmove ? 'uni-indexed-list__menu--active' : ''"
|
|
29
|
+
@touchstart="touchStart"
|
|
30
|
+
@touchmove.stop.prevent="touchMove"
|
|
31
|
+
@touchend="touchEnd"
|
|
32
|
+
@mousedown.stop="mousedown"
|
|
33
|
+
@mousemove.stop.prevent="mousemove"
|
|
34
|
+
@mouseleave.stop="mouseleave"
|
|
35
|
+
>
|
|
36
|
+
<view v-for="(list, key) in lists" :key="key" class="uni-indexed-list__menu-item">
|
|
37
|
+
<text class="uni-indexed-list__menu-text" :class="touchmoveIndex == key ? 'uni-indexed-list__menu-text--active' : ''">
|
|
38
|
+
{{ list.key }}
|
|
39
|
+
</text>
|
|
40
|
+
</view>
|
|
41
|
+
</view>
|
|
42
|
+
<view v-if="touchmove" class="uni-indexed-list__alert-wrapper">
|
|
43
|
+
<text class="uni-indexed-list__alert">{{ lists[touchmoveIndex].key }}</text>
|
|
44
|
+
</view>
|
|
45
|
+
</view>
|
|
46
|
+
</template>
|
|
47
|
+
<script>
|
|
48
|
+
import indexedListItem from './uni-indexed-list-item.vue';
|
|
49
|
+
// #ifdef APP-NVUE
|
|
50
|
+
const dom = weex.requireModule('dom');
|
|
51
|
+
// #endif
|
|
52
|
+
// #ifdef APP-PLUS
|
|
53
|
+
function throttle(func, delay) {
|
|
54
|
+
var prev = Date.now();
|
|
55
|
+
return function () {
|
|
56
|
+
var context = this;
|
|
57
|
+
var args = arguments;
|
|
58
|
+
var now = Date.now();
|
|
59
|
+
if (now - prev >= delay) {
|
|
60
|
+
func.apply(context, args);
|
|
61
|
+
prev = Date.now();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function touchMove(e) {
|
|
67
|
+
let pageY = e.touches[0].pageY;
|
|
68
|
+
let index = Math.floor((pageY - this.winOffsetY) / this.itemHeight);
|
|
69
|
+
if (this.touchmoveIndex === index) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
let item = this.lists[index];
|
|
73
|
+
if (item) {
|
|
74
|
+
// #ifndef APP-NVUE
|
|
75
|
+
this.scrollViewId = 'uni-indexed-list-' + index;
|
|
76
|
+
this.touchmoveIndex = index;
|
|
77
|
+
// #endif
|
|
78
|
+
// #ifdef APP-NVUE
|
|
79
|
+
dom.scrollToElement(this.$refs['uni-indexed-list-' + index][0], {
|
|
80
|
+
animated: false
|
|
81
|
+
});
|
|
82
|
+
this.touchmoveIndex = index;
|
|
83
|
+
// #endif
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const throttleTouchMove = throttle(touchMove, 40);
|
|
87
|
+
// #endif
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* IndexedList 索引列表
|
|
91
|
+
* @description 用于展示索引列表
|
|
92
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=375
|
|
93
|
+
* @property {Boolean} showSelect = [true|false] 展示模式
|
|
94
|
+
* @value true 展示模式
|
|
95
|
+
* @value false 选择模式
|
|
96
|
+
* @property {Object} options 索引列表需要的数据对象
|
|
97
|
+
* @event {Function} click 点击列表事件 ,返回当前选择项的事件对象
|
|
98
|
+
* @example <uni-indexed-list options="" showSelect="false" @click=""></uni-indexed-list>
|
|
99
|
+
*/
|
|
100
|
+
export default {
|
|
101
|
+
name: 'UniIndexedList',
|
|
102
|
+
components: {
|
|
103
|
+
indexedListItem
|
|
104
|
+
},
|
|
105
|
+
emits: ['click'],
|
|
106
|
+
props: {
|
|
107
|
+
options: {
|
|
108
|
+
type: Array,
|
|
109
|
+
default() {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
showSelect: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
default: false
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
data() {
|
|
119
|
+
return {
|
|
120
|
+
lists: [],
|
|
121
|
+
winHeight: 0,
|
|
122
|
+
itemHeight: 0,
|
|
123
|
+
winOffsetY: 0,
|
|
124
|
+
touchmove: false,
|
|
125
|
+
touchmoveIndex: -1,
|
|
126
|
+
scrollViewId: '',
|
|
127
|
+
touchmovable: true,
|
|
128
|
+
loaded: false,
|
|
129
|
+
isPC: false
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
watch: {
|
|
133
|
+
options: {
|
|
134
|
+
handler: function () {
|
|
135
|
+
this.setList();
|
|
136
|
+
},
|
|
137
|
+
deep: true
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
mounted() {
|
|
141
|
+
// #ifdef H5
|
|
142
|
+
this.isPC = this.IsPC();
|
|
143
|
+
// #endif
|
|
144
|
+
setTimeout(() => {
|
|
145
|
+
this.setList();
|
|
146
|
+
}, 50);
|
|
147
|
+
setTimeout(() => {
|
|
148
|
+
this.loaded = true;
|
|
149
|
+
}, 300);
|
|
150
|
+
},
|
|
151
|
+
methods: {
|
|
152
|
+
setList() {
|
|
153
|
+
let index = 0;
|
|
154
|
+
this.lists = [];
|
|
155
|
+
this.options.forEach((value, index) => {
|
|
156
|
+
if (value.data.length === 0) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
let indexBefore = index;
|
|
160
|
+
let items = value.data.map((item) => {
|
|
161
|
+
let obj = {};
|
|
162
|
+
obj['key'] = value.letter;
|
|
163
|
+
obj['name'] = item;
|
|
164
|
+
obj['itemIndex'] = index;
|
|
165
|
+
index++;
|
|
166
|
+
obj.checked = item.checked ? item.checked : false;
|
|
167
|
+
return obj;
|
|
168
|
+
});
|
|
169
|
+
this.lists.push({
|
|
170
|
+
title: value.letter,
|
|
171
|
+
key: value.letter,
|
|
172
|
+
items: items,
|
|
173
|
+
itemIndex: indexBefore
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
// #ifndef APP-NVUE
|
|
177
|
+
uni
|
|
178
|
+
.createSelectorQuery()
|
|
179
|
+
.in(this)
|
|
180
|
+
.select('#list')
|
|
181
|
+
.boundingClientRect()
|
|
182
|
+
.exec((ret) => {
|
|
183
|
+
this.winOffsetY = ret[0].top;
|
|
184
|
+
this.winHeight = ret[0].height;
|
|
185
|
+
this.itemHeight = this.winHeight / this.lists.length;
|
|
186
|
+
});
|
|
187
|
+
// #endif
|
|
188
|
+
// #ifdef APP-NVUE
|
|
189
|
+
dom.getComponentRect(this.$refs['list'], (res) => {
|
|
190
|
+
this.winOffsetY = res.size.top;
|
|
191
|
+
this.winHeight = res.size.height;
|
|
192
|
+
this.itemHeight = this.winHeight / this.lists.length;
|
|
193
|
+
});
|
|
194
|
+
// #endif
|
|
195
|
+
},
|
|
196
|
+
touchStart(e) {
|
|
197
|
+
this.touchmove = true;
|
|
198
|
+
let pageY = this.isPC ? e.pageY : e.touches[0].pageY;
|
|
199
|
+
let index = Math.floor((pageY - this.winOffsetY) / this.itemHeight);
|
|
200
|
+
let item = this.lists[index];
|
|
201
|
+
if (item) {
|
|
202
|
+
this.scrollViewId = 'uni-indexed-list-' + index;
|
|
203
|
+
this.touchmoveIndex = index;
|
|
204
|
+
// #ifdef APP-NVUE
|
|
205
|
+
dom.scrollToElement(this.$refs['uni-indexed-list-' + index][0], {
|
|
206
|
+
animated: false
|
|
207
|
+
});
|
|
208
|
+
// #endif
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
touchMove(e) {
|
|
212
|
+
// #ifndef APP-PLUS
|
|
213
|
+
let pageY = this.isPC ? e.pageY : e.touches[0].pageY;
|
|
214
|
+
let index = Math.floor((pageY - this.winOffsetY) / this.itemHeight);
|
|
215
|
+
if (this.touchmoveIndex === index) {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
let item = this.lists[index];
|
|
219
|
+
if (item) {
|
|
220
|
+
this.scrollViewId = 'uni-indexed-list-' + index;
|
|
221
|
+
this.touchmoveIndex = index;
|
|
222
|
+
}
|
|
223
|
+
// #endif
|
|
224
|
+
// #ifdef APP-PLUS
|
|
225
|
+
throttleTouchMove.call(this, e);
|
|
226
|
+
// #endif
|
|
227
|
+
},
|
|
228
|
+
touchEnd() {
|
|
229
|
+
this.touchmove = false;
|
|
230
|
+
this.touchmoveIndex = -1;
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* 兼容 PC @tian
|
|
235
|
+
*/
|
|
236
|
+
|
|
237
|
+
mousedown(e) {
|
|
238
|
+
if (!this.isPC) return;
|
|
239
|
+
this.touchStart(e);
|
|
240
|
+
},
|
|
241
|
+
mousemove(e) {
|
|
242
|
+
if (!this.isPC) return;
|
|
243
|
+
this.touchMove(e);
|
|
244
|
+
},
|
|
245
|
+
mouseleave(e) {
|
|
246
|
+
if (!this.isPC) return;
|
|
247
|
+
this.touchEnd(e);
|
|
248
|
+
},
|
|
249
|
+
|
|
250
|
+
// #ifdef H5
|
|
251
|
+
IsPC() {
|
|
252
|
+
var userAgentInfo = navigator.userAgent;
|
|
253
|
+
var Agents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'];
|
|
254
|
+
var flag = true;
|
|
255
|
+
for (let v = 0; v < Agents.length - 1; v++) {
|
|
256
|
+
if (userAgentInfo.indexOf(Agents[v]) > 0) {
|
|
257
|
+
flag = false;
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return flag;
|
|
262
|
+
},
|
|
263
|
+
// #endif
|
|
264
|
+
|
|
265
|
+
onClick(e) {
|
|
266
|
+
let { idx, index } = e;
|
|
267
|
+
let obj = {};
|
|
268
|
+
for (let key in this.lists[idx].items[index]) {
|
|
269
|
+
obj[key] = this.lists[idx].items[index][key];
|
|
270
|
+
}
|
|
271
|
+
let select = [];
|
|
272
|
+
if (this.showSelect) {
|
|
273
|
+
this.lists[idx].items[index].checked = !this.lists[idx].items[index].checked;
|
|
274
|
+
this.lists.forEach((value, idx) => {
|
|
275
|
+
value.items.forEach((item, index) => {
|
|
276
|
+
if (item.checked) {
|
|
277
|
+
let obj = {};
|
|
278
|
+
for (let key in this.lists[idx].items[index]) {
|
|
279
|
+
obj[key] = this.lists[idx].items[index][key];
|
|
280
|
+
}
|
|
281
|
+
select.push(obj);
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
this.$emit('click', {
|
|
287
|
+
item: obj,
|
|
288
|
+
select: select
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
</script>
|
|
294
|
+
<style scoped>
|
|
295
|
+
.uni-indexed-list {
|
|
296
|
+
position: absolute;
|
|
297
|
+
left: 0;
|
|
298
|
+
top: 0;
|
|
299
|
+
right: 0;
|
|
300
|
+
bottom: 0;
|
|
301
|
+
/* #ifndef APP-NVUE */
|
|
302
|
+
display: flex;
|
|
303
|
+
/* #endif */
|
|
304
|
+
flex-direction: row;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.uni-indexed-list__scroll {
|
|
308
|
+
flex: 1;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.uni-indexed-list__menu {
|
|
312
|
+
width: 24px;
|
|
313
|
+
background-color: lightgrey;
|
|
314
|
+
/* #ifndef APP-NVUE */
|
|
315
|
+
display: flex;
|
|
316
|
+
/* #endif */
|
|
317
|
+
flex-direction: column;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.uni-indexed-list__menu-item {
|
|
321
|
+
/* #ifndef APP-NVUE */
|
|
322
|
+
display: flex;
|
|
323
|
+
/* #endif */
|
|
324
|
+
flex: 1;
|
|
325
|
+
align-items: center;
|
|
326
|
+
justify-content: center;
|
|
327
|
+
/* #ifdef H5 */
|
|
328
|
+
cursor: pointer;
|
|
329
|
+
/* #endif */
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.uni-indexed-list__menu-text {
|
|
333
|
+
line-height: 20px;
|
|
334
|
+
font-size: 12px;
|
|
335
|
+
text-align: center;
|
|
336
|
+
color: #aaa;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.uni-indexed-list__menu--active {
|
|
340
|
+
background-color: #c8c8c8;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.uni-indexed-list__menu-text--active {
|
|
344
|
+
color: #007aff;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.uni-indexed-list__alert-wrapper {
|
|
348
|
+
position: absolute;
|
|
349
|
+
left: 0;
|
|
350
|
+
top: 0;
|
|
351
|
+
right: 0;
|
|
352
|
+
bottom: 0;
|
|
353
|
+
/* #ifndef APP-NVUE */
|
|
354
|
+
display: flex;
|
|
355
|
+
/* #endif */
|
|
356
|
+
flex-direction: row;
|
|
357
|
+
align-items: center;
|
|
358
|
+
justify-content: center;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.uni-indexed-list__alert {
|
|
362
|
+
width: 80px;
|
|
363
|
+
height: 80px;
|
|
364
|
+
border-radius: 80px;
|
|
365
|
+
text-align: center;
|
|
366
|
+
line-height: 80px;
|
|
367
|
+
font-size: 35px;
|
|
368
|
+
color: #fff;
|
|
369
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
370
|
+
}
|
|
371
|
+
</style>
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
<!-- 清空 -->
|
|
18
18
|
<view class="cv-input__clear" @click="onEmpty" v-if="clearable == true && localVal != ''">X</view>
|
|
19
19
|
<!-- 眼睛-->
|
|
20
|
-
<cv-
|
|
20
|
+
<cv-icon2
|
|
21
21
|
class="cv-input__eyes"
|
|
22
22
|
v-if="localVal != '' && passwordIcon"
|
|
23
23
|
:type="showPassword ? 'eye-slash-filled' : 'eye-filled'"
|
|
24
24
|
:size="18"
|
|
25
25
|
color="rgba(0, 0, 0, 0.4)"
|
|
26
26
|
@click="onEyes"
|
|
27
|
-
></cv-
|
|
27
|
+
></cv-icon2>
|
|
28
28
|
</view>
|
|
29
29
|
</view>
|
|
30
30
|
</template>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- #ifndef APP-NVUE -->
|
|
3
|
+
<view class="uni-list uni-border-top-bottom">
|
|
4
|
+
<view v-if="border" class="uni-list--border-top"></view>
|
|
5
|
+
<slot />
|
|
6
|
+
<view v-if="border" class="uni-list--border-bottom"></view>
|
|
7
|
+
</view>
|
|
8
|
+
<!-- #endif -->
|
|
9
|
+
<!-- #ifdef APP-NVUE -->
|
|
10
|
+
<list class="uni-list" :class="{ 'uni-list--border': border }" :enableBackToTop="enableBackToTop" loadmoreoffset="15">
|
|
11
|
+
<slot />
|
|
12
|
+
</list>
|
|
13
|
+
<!-- #endif -->
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
/**
|
|
18
|
+
* List 列表
|
|
19
|
+
* @description 列表组件
|
|
20
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=24
|
|
21
|
+
* @property {String} border = [true|false] 标题
|
|
22
|
+
*/
|
|
23
|
+
export default {
|
|
24
|
+
name: 'cvList',
|
|
25
|
+
'mp-weixin': {
|
|
26
|
+
options: {
|
|
27
|
+
multipleSlots: false
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
props: {
|
|
31
|
+
enableBackToTop: {
|
|
32
|
+
type: [Boolean, String],
|
|
33
|
+
default: false
|
|
34
|
+
},
|
|
35
|
+
scrollY: {
|
|
36
|
+
type: [Boolean, String],
|
|
37
|
+
default: false
|
|
38
|
+
},
|
|
39
|
+
border: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: true
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
// provide() {
|
|
45
|
+
// return {
|
|
46
|
+
// list: this
|
|
47
|
+
// };
|
|
48
|
+
// },
|
|
49
|
+
created() {
|
|
50
|
+
this.firstChildAppend = false;
|
|
51
|
+
},
|
|
52
|
+
methods: {
|
|
53
|
+
loadMore(e) {
|
|
54
|
+
this.$emit('scrolltolower');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
</script>
|
|
59
|
+
<style scoped>
|
|
60
|
+
.uni-list {
|
|
61
|
+
/* #ifndef APP-NVUE */
|
|
62
|
+
display: flex;
|
|
63
|
+
/* #endif */
|
|
64
|
+
background-color: #ffffff;
|
|
65
|
+
position: relative;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.uni-list--border {
|
|
70
|
+
position: relative;
|
|
71
|
+
/* #ifdef APP-NVUE */
|
|
72
|
+
border-top-color: #e5e5e5;
|
|
73
|
+
border-top-style: solid;
|
|
74
|
+
border-top-width: 0.5px;
|
|
75
|
+
border-bottom-color: #e5e5e5;
|
|
76
|
+
border-bottom-style: solid;
|
|
77
|
+
border-bottom-width: 0.5px;
|
|
78
|
+
/* #endif */
|
|
79
|
+
z-index: -1;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* #ifndef APP-NVUE */
|
|
83
|
+
.uni-list--border-top {
|
|
84
|
+
position: absolute;
|
|
85
|
+
top: 0;
|
|
86
|
+
right: 0;
|
|
87
|
+
left: 0;
|
|
88
|
+
height: 1px;
|
|
89
|
+
-webkit-transform: scaleY(0.5);
|
|
90
|
+
transform: scaleY(0.5);
|
|
91
|
+
background-color: #e5e5e5;
|
|
92
|
+
z-index: 1;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.uni-list--border-bottom {
|
|
96
|
+
position: absolute;
|
|
97
|
+
bottom: 0;
|
|
98
|
+
right: 0;
|
|
99
|
+
left: 0;
|
|
100
|
+
height: 1px;
|
|
101
|
+
-webkit-transform: scaleY(0.5);
|
|
102
|
+
transform: scaleY(0.5);
|
|
103
|
+
background-color: #e5e5e5;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* #endif */
|
|
107
|
+
</style>
|