@vtj/materials 0.10.1-alpha.6 → 0.10.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/assets/antdv/index.umd.js +2 -2
- package/dist/assets/charts/index.umd.js +2 -2
- package/dist/assets/element/index.umd.js +2 -2
- package/dist/assets/ui/index.umd.js +2 -2
- package/dist/assets/uni-h5/index.umd.js +2 -2
- package/dist/assets/uni-ui/index.umd.js +3 -3
- package/dist/assets/vant/index.umd.js +5 -5
- package/dist/deps/@vtj/charts/index.umd.js +2 -2
- package/dist/deps/@vtj/icons/index.umd.js +2 -2
- package/dist/deps/@vtj/ui/index.umd.js +2 -2
- package/dist/deps/@vtj/utils/index.umd.js +2 -2
- package/dist/deps/uni-ui/index.umd.js +1 -1
- package/dist/deps/uni-ui/style.css +1 -1
- package/package.json +6 -6
- package/src/uni-ui/components/badge.ts +5 -1
- package/src/uni-ui/components/breadcrumb.ts +76 -0
- package/src/uni-ui/components/calendar.ts +63 -0
- package/src/uni-ui/components/card.ts +113 -0
- package/src/uni-ui/components/collapse.ts +118 -0
- package/src/uni-ui/components/combox.ts +51 -0
- package/src/uni-ui/components/countdown.ts +92 -0
- package/src/uni-ui/components/dataCheckbox.ts +104 -0
- package/src/uni-ui/components/dataPicker.ts +146 -0
- package/src/uni-ui/components/dataSelect.ts +68 -0
- package/src/uni-ui/components/dateformat.ts +42 -0
- package/src/uni-ui/components/datetimePicker.ts +103 -0
- package/src/uni-ui/components/drawer.ts +38 -0
- package/src/uni-ui/components/easyinput.ts +159 -0
- package/src/uni-ui/components/fab.ts +89 -0
- package/src/uni-ui/components/fav.ts +65 -0
- package/src/uni-ui/components/filePicker.ts +127 -0
- package/src/uni-ui/components/forms.ts +209 -0
- package/src/uni-ui/components/goodsNav.ts +31 -0
- package/src/uni-ui/components/grid.ts +104 -0
- package/src/uni-ui/components/group.ts +50 -0
- package/src/uni-ui/components/icons.ts +47 -0
- package/src/uni-ui/components/index.ts +89 -1
- package/src/uni-ui/components/indexedList.ts +51 -0
- package/src/uni-ui/components/link.ts +60 -0
- package/src/uni-ui/components/list.ts +259 -0
- package/src/uni-ui/components/loadMore.ts +61 -0
- package/src/uni-ui/components/navbar.ts +121 -0
- package/src/uni-ui/components/noticeBar.ts +83 -0
- package/src/uni-ui/components/numberbox.ts +49 -0
- package/src/uni-ui/components/pagination.ts +59 -0
- package/src/uni-ui/components/popup.ts +206 -0
- package/src/uni-ui/components/rate.ts +89 -0
- package/src/uni-ui/components/row.ts +126 -0
- package/src/uni-ui/components/searchBar.ts +84 -0
- package/src/uni-ui/components/section.ts +68 -0
- package/src/uni-ui/components/segmentedControl.ts +48 -0
- package/src/uni-ui/components/steps.ts +55 -0
- package/src/uni-ui/components/swipeAction.ts +133 -0
- package/src/uni-ui/components/swiperDot.ts +114 -0
- package/src/uni-ui/components/table.ts +132 -0
- package/src/uni-ui/components/tag.ts +56 -0
- package/src/uni-ui/components/title.ts +49 -0
- package/src/uni-ui/components/tooltip.ts +32 -0
- package/src/uni-ui/components/transition.ts +49 -0
- package/src/uni-ui/index.ts +30 -13
- package/src/uni-ui/lib/uni-col/uni-col.vue +324 -0
- package/src/uni-ui/lib/uni-data-select/uni-data-select.vue +590 -0
- package/src/uni-ui/lib/uni-datetime-picker/calendar-item.vue +177 -177
- package/src/uni-ui/lib/uni-datetime-picker/calendar.vue +947 -947
- package/src/uni-ui/lib/uni-datetime-picker/i18n/en.json +22 -22
- package/src/uni-ui/lib/uni-datetime-picker/i18n/index.js +7 -7
- package/src/uni-ui/lib/uni-datetime-picker/time-picker.vue +939 -939
- package/src/uni-ui/lib/uni-datetime-picker/util.js +419 -419
- package/src/uni-ui/lib/uni-easyinput/common.js +54 -0
- package/src/uni-ui/lib/uni-easyinput/uni-easyinput.vue +790 -0
- package/src/uni-ui/lib/uni-forms/uni-forms.vue +416 -416
- package/src/uni-ui/lib/uni-forms/utils.js +281 -281
- package/src/uni-ui/lib/uni-forms/validate.js +485 -485
- package/src/uni-ui/lib/uni-forms-item/uni-forms-item.vue +630 -0
- package/src/uni-ui/lib/uni-goods-nav/i18n/en.json +6 -0
- package/src/uni-ui/lib/uni-goods-nav/i18n/index.js +8 -0
- package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hans.json +6 -0
- package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hant.json +6 -0
- package/src/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +231 -0
- package/src/uni-ui/lib/uni-icons/uni-icons.uvue +91 -0
- package/src/uni-ui/lib/uni-icons/uni-icons.vue +114 -0
- package/src/uni-ui/lib/uni-icons/uniicons.css +664 -0
- package/src/uni-ui/lib/uni-icons/uniicons.ttf +0 -0
- package/src/uni-ui/lib/uni-icons/uniicons_file.ts +664 -0
- package/src/uni-ui/lib/uni-icons/uniicons_file_vue.js +649 -0
- package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +144 -0
- package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +404 -0
- package/src/uni-ui/lib/uni-list/uni-list.vue +123 -0
- package/src/uni-ui/lib/uni-list/uni-refresh.vue +65 -0
- package/src/uni-ui/lib/uni-list/uni-refresh.wxs +87 -0
- package/src/uni-ui/lib/uni-popup-dialog/keypress.js +45 -0
- package/src/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +324 -0
- package/src/uni-ui/lib/uni-rate/uni-rate.vue +361 -0
- package/src/uni-ui/lib/uni-table/uni-table.vue +496 -0
- package/src/uni-ui/lib/uni-td/uni-td.vue +99 -0
- package/src/uni-ui/lib/uni-th/uni-th.vue +310 -283
- package/src/uni-ui/lib/uni-tr/uni-tr.vue +194 -170
- package/src/version.ts +2 -2
|
@@ -0,0 +1,144 @@
|
|
|
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 v-for="(item, index) in list.items" :key="index" class="uni-indexed-list__item" hover-class="uni-indexed-list__item--hover">
|
|
8
|
+
<view class="uni-indexed-list__item-container" @click="onClick(idx, index)">
|
|
9
|
+
<view class="uni-indexed-list__item-border" :class="{'uni-indexed-list__item-border--last':index===list.items.length-1}">
|
|
10
|
+
<view v-if="showSelect" style="margin-right: 20rpx;">
|
|
11
|
+
<uni-icons :type="item.checked ? 'checkbox-filled' : 'circle'" :color="item.checked ? '#007aff' : '#C0C0C0'" size="24" />
|
|
12
|
+
</view>
|
|
13
|
+
<text class="uni-indexed-list__item-content">{{ item.name }}</text>
|
|
14
|
+
</view>
|
|
15
|
+
</view>
|
|
16
|
+
</view>
|
|
17
|
+
</view>
|
|
18
|
+
</view>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
export default {
|
|
23
|
+
name: 'UniIndexedList',
|
|
24
|
+
emits:['itemClick'],
|
|
25
|
+
props: {
|
|
26
|
+
loaded: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
},
|
|
30
|
+
idx: {
|
|
31
|
+
type: Number,
|
|
32
|
+
default: 0
|
|
33
|
+
},
|
|
34
|
+
list: {
|
|
35
|
+
type: Object,
|
|
36
|
+
default () {
|
|
37
|
+
return {}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
showSelect: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
methods: {
|
|
46
|
+
onClick(idx, index) {
|
|
47
|
+
this.$emit("itemClick", {
|
|
48
|
+
idx,
|
|
49
|
+
index
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<style lang="scss" scoped>
|
|
57
|
+
.uni-indexed-list__list {
|
|
58
|
+
background-color: $uni-bg-color;
|
|
59
|
+
/* #ifndef APP-NVUE */
|
|
60
|
+
display: flex;
|
|
61
|
+
/* #endif */
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
border-top-style: solid;
|
|
64
|
+
border-top-width: 1px;
|
|
65
|
+
border-top-color: #DEDEDE;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.uni-indexed-list__item {
|
|
69
|
+
font-size: 14px;
|
|
70
|
+
/* #ifndef APP-NVUE */
|
|
71
|
+
display: flex;
|
|
72
|
+
/* #endif */
|
|
73
|
+
flex: 1;
|
|
74
|
+
flex-direction: row;
|
|
75
|
+
justify-content: space-between;
|
|
76
|
+
align-items: center;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.uni-indexed-list__item-container {
|
|
80
|
+
padding-left: 15px;
|
|
81
|
+
flex: 1;
|
|
82
|
+
position: relative;
|
|
83
|
+
/* #ifndef APP-NVUE */
|
|
84
|
+
display: flex;
|
|
85
|
+
box-sizing: border-box;
|
|
86
|
+
/* #endif */
|
|
87
|
+
flex-direction: row;
|
|
88
|
+
justify-content: space-between;
|
|
89
|
+
align-items: center;
|
|
90
|
+
/* #ifdef H5 */
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
/* #endif */
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.uni-indexed-list__item-border {
|
|
96
|
+
flex: 1;
|
|
97
|
+
position: relative;
|
|
98
|
+
/* #ifndef APP-NVUE */
|
|
99
|
+
display: flex;
|
|
100
|
+
box-sizing: border-box;
|
|
101
|
+
/* #endif */
|
|
102
|
+
flex-direction: row;
|
|
103
|
+
justify-content: space-between;
|
|
104
|
+
align-items: center;
|
|
105
|
+
height: 50px;
|
|
106
|
+
padding: 25px;
|
|
107
|
+
padding-left: 0;
|
|
108
|
+
border-bottom-style: solid;
|
|
109
|
+
border-bottom-width: 1px;
|
|
110
|
+
border-bottom-color: #DEDEDE;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.uni-indexed-list__item-border--last {
|
|
114
|
+
border-bottom-width: 0px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.uni-indexed-list__item-content {
|
|
118
|
+
flex: 1;
|
|
119
|
+
font-size: 14px;
|
|
120
|
+
color: #191919;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.uni-indexed-list {
|
|
124
|
+
/* #ifndef APP-NVUE */
|
|
125
|
+
display: flex;
|
|
126
|
+
/* #endif */
|
|
127
|
+
flex-direction: row;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.uni-indexed-list__title-wrapper {
|
|
131
|
+
/* #ifndef APP-NVUE */
|
|
132
|
+
display: flex;
|
|
133
|
+
width: 100%;
|
|
134
|
+
/* #endif */
|
|
135
|
+
background-color: #f7f7f7;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.uni-indexed-list__title {
|
|
139
|
+
padding: 6px 12px;
|
|
140
|
+
line-height: 24px;
|
|
141
|
+
font-size: 16px;
|
|
142
|
+
font-weight: 500;
|
|
143
|
+
}
|
|
144
|
+
</style>
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-indexed-list" ref="list" id="list">
|
|
3
|
+
<!-- #ifdef APP-NVUE -->
|
|
4
|
+
<list
|
|
5
|
+
class="uni-indexed-list__scroll"
|
|
6
|
+
scrollable="true"
|
|
7
|
+
show-scrollbar="false">
|
|
8
|
+
<cell
|
|
9
|
+
v-for="(list, idx) in lists"
|
|
10
|
+
:key="idx"
|
|
11
|
+
:ref="'uni-indexed-list-' + idx">
|
|
12
|
+
<!-- #endif -->
|
|
13
|
+
<!-- #ifndef APP-NVUE -->
|
|
14
|
+
<!-- <scroll-view
|
|
15
|
+
:scroll-into-view="scrollViewId"
|
|
16
|
+
class="uni-indexed-list__scroll"
|
|
17
|
+
scroll-y>
|
|
18
|
+
<view
|
|
19
|
+
v-for="(list, idx) in lists"
|
|
20
|
+
:key="idx"
|
|
21
|
+
:id="'uni-indexed-list-' + idx"> -->
|
|
22
|
+
<!-- #endif -->
|
|
23
|
+
<indexed-list-item
|
|
24
|
+
:list="list"
|
|
25
|
+
:loaded="loaded"
|
|
26
|
+
:idx="idx"
|
|
27
|
+
:showSelect="showSelect"
|
|
28
|
+
@itemClick="onClick"></indexed-list-item>
|
|
29
|
+
<!-- #ifndef APP-NVUE -->
|
|
30
|
+
<!-- </view>
|
|
31
|
+
</scroll-view> -->
|
|
32
|
+
<!-- #endif -->
|
|
33
|
+
<!-- #ifdef APP-NVUE -->
|
|
34
|
+
</cell>
|
|
35
|
+
</list>
|
|
36
|
+
<!-- #endif -->
|
|
37
|
+
<view
|
|
38
|
+
class="uni-indexed-list__menu"
|
|
39
|
+
@touchstart="touchStart"
|
|
40
|
+
@touchmove.stop.prevent="touchMove"
|
|
41
|
+
@touchend="touchEnd"
|
|
42
|
+
@mousedown.stop="mousedown"
|
|
43
|
+
@mousemove.stop.prevent="mousemove"
|
|
44
|
+
@mouseleave.stop="mouseleave">
|
|
45
|
+
<view
|
|
46
|
+
v-for="(list, key) in lists"
|
|
47
|
+
:key="key"
|
|
48
|
+
class="uni-indexed-list__menu-item"
|
|
49
|
+
:class="touchmoveIndex == key ? 'uni-indexed-list__menu--active' : ''">
|
|
50
|
+
<text
|
|
51
|
+
class="uni-indexed-list__menu-text"
|
|
52
|
+
:class="
|
|
53
|
+
touchmoveIndex == key ? 'uni-indexed-list__menu-text--active' : ''
|
|
54
|
+
"
|
|
55
|
+
>{{ list.key }}</text
|
|
56
|
+
>
|
|
57
|
+
</view>
|
|
58
|
+
</view>
|
|
59
|
+
<view v-if="touchmove" class="uni-indexed-list__alert-wrapper">
|
|
60
|
+
<text class="uni-indexed-list__alert">{{
|
|
61
|
+
lists[touchmoveIndex].key
|
|
62
|
+
}}</text>
|
|
63
|
+
</view>
|
|
64
|
+
</view>
|
|
65
|
+
</template>
|
|
66
|
+
<script>
|
|
67
|
+
import indexedListItem from './uni-indexed-list-item.vue';
|
|
68
|
+
// #ifdef APP-NVUE
|
|
69
|
+
const dom = weex.requireModule('dom');
|
|
70
|
+
// #endif
|
|
71
|
+
// #ifdef APP-PLUS
|
|
72
|
+
function throttle(func, delay) {
|
|
73
|
+
var prev = Date.now();
|
|
74
|
+
return function () {
|
|
75
|
+
var context = this;
|
|
76
|
+
var args = arguments;
|
|
77
|
+
var now = Date.now();
|
|
78
|
+
if (now - prev >= delay) {
|
|
79
|
+
func.apply(context, args);
|
|
80
|
+
prev = Date.now();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function touchMove(e) {
|
|
86
|
+
let pageY = e.touches[0].pageY;
|
|
87
|
+
let index = Math.floor((pageY - this.winOffsetY) / this.itemHeight);
|
|
88
|
+
if (this.touchmoveIndex === index) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
let item = this.lists[index];
|
|
92
|
+
if (item) {
|
|
93
|
+
// #ifndef APP-NVUE
|
|
94
|
+
this.scrollViewId = 'uni-indexed-list-' + index;
|
|
95
|
+
this.touchmoveIndex = index;
|
|
96
|
+
// #endif
|
|
97
|
+
// #ifdef APP-NVUE
|
|
98
|
+
dom.scrollToElement(this.$refs['uni-indexed-list-' + index][0], {
|
|
99
|
+
animated: false
|
|
100
|
+
});
|
|
101
|
+
this.touchmoveIndex = index;
|
|
102
|
+
// #endif
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const throttleTouchMove = throttle(touchMove, 40);
|
|
106
|
+
// #endif
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* IndexedList 索引列表
|
|
110
|
+
* @description 用于展示索引列表
|
|
111
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=375
|
|
112
|
+
* @property {Boolean} showSelect = [true|false] 展示模式
|
|
113
|
+
* @value true 展示模式
|
|
114
|
+
* @value false 选择模式
|
|
115
|
+
* @property {Object} options 索引列表需要的数据对象
|
|
116
|
+
* @event {Function} click 点击列表事件 ,返回当前选择项的事件对象
|
|
117
|
+
* @example <uni-indexed-list options="" showSelect="false" @click=""></uni-indexed-list>
|
|
118
|
+
*/
|
|
119
|
+
export default {
|
|
120
|
+
name: 'UniIndexedList',
|
|
121
|
+
components: {
|
|
122
|
+
indexedListItem
|
|
123
|
+
},
|
|
124
|
+
emits: ['click'],
|
|
125
|
+
props: {
|
|
126
|
+
options: {
|
|
127
|
+
type: Array,
|
|
128
|
+
default() {
|
|
129
|
+
return [];
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
showSelect: {
|
|
133
|
+
type: Boolean,
|
|
134
|
+
default: false
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
data() {
|
|
138
|
+
return {
|
|
139
|
+
lists: [],
|
|
140
|
+
winHeight: 0,
|
|
141
|
+
itemHeight: 0,
|
|
142
|
+
winOffsetY: 0,
|
|
143
|
+
touchmove: false,
|
|
144
|
+
touchmoveIndex: -1,
|
|
145
|
+
scrollViewId: '',
|
|
146
|
+
touchmovable: true,
|
|
147
|
+
loaded: false,
|
|
148
|
+
isPC: false
|
|
149
|
+
};
|
|
150
|
+
},
|
|
151
|
+
watch: {
|
|
152
|
+
options: {
|
|
153
|
+
handler: function () {
|
|
154
|
+
this.setList();
|
|
155
|
+
},
|
|
156
|
+
deep: true
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
mounted() {
|
|
160
|
+
// #ifdef H5
|
|
161
|
+
this.isPC = this.IsPC();
|
|
162
|
+
// #endif
|
|
163
|
+
setTimeout(() => {
|
|
164
|
+
this.setList();
|
|
165
|
+
}, 50);
|
|
166
|
+
setTimeout(() => {
|
|
167
|
+
this.loaded = true;
|
|
168
|
+
}, 300);
|
|
169
|
+
},
|
|
170
|
+
methods: {
|
|
171
|
+
setList() {
|
|
172
|
+
let index = 0;
|
|
173
|
+
this.lists = [];
|
|
174
|
+
this.options.forEach((value, index) => {
|
|
175
|
+
if (value.data.length === 0) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
let indexBefore = index;
|
|
179
|
+
let items = value.data.map((item) => {
|
|
180
|
+
let obj = {};
|
|
181
|
+
obj['key'] = value.letter;
|
|
182
|
+
obj['name'] = item;
|
|
183
|
+
obj['itemIndex'] = index;
|
|
184
|
+
index++;
|
|
185
|
+
obj.checked = item.checked ? item.checked : false;
|
|
186
|
+
return obj;
|
|
187
|
+
});
|
|
188
|
+
this.lists.push({
|
|
189
|
+
title: value.letter,
|
|
190
|
+
key: value.letter,
|
|
191
|
+
items: items,
|
|
192
|
+
itemIndex: indexBefore
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
// #ifndef APP-NVUE
|
|
196
|
+
uni
|
|
197
|
+
.createSelectorQuery()
|
|
198
|
+
.in(this)
|
|
199
|
+
.select('#list')
|
|
200
|
+
.boundingClientRect()
|
|
201
|
+
.exec((ret) => {
|
|
202
|
+
this.winOffsetY = ret[0].top;
|
|
203
|
+
this.winHeight = ret[0].height;
|
|
204
|
+
this.itemHeight = this.winHeight / this.lists.length;
|
|
205
|
+
});
|
|
206
|
+
// #endif
|
|
207
|
+
// #ifdef APP-NVUE
|
|
208
|
+
dom.getComponentRect(this.$refs['list'], (res) => {
|
|
209
|
+
this.winOffsetY = res.size.top;
|
|
210
|
+
this.winHeight = res.size.height;
|
|
211
|
+
this.itemHeight = this.winHeight / this.lists.length;
|
|
212
|
+
});
|
|
213
|
+
// #endif
|
|
214
|
+
},
|
|
215
|
+
touchStart(e) {
|
|
216
|
+
this.touchmove = true;
|
|
217
|
+
let pageY = this.isPC ? e.pageY : e.touches[0].pageY;
|
|
218
|
+
let index = Math.floor((pageY - this.winOffsetY) / this.itemHeight);
|
|
219
|
+
let item = this.lists[index];
|
|
220
|
+
if (item) {
|
|
221
|
+
this.scrollViewId = 'uni-indexed-list-' + index;
|
|
222
|
+
this.touchmoveIndex = index;
|
|
223
|
+
// #ifdef APP-NVUE
|
|
224
|
+
dom.scrollToElement(this.$refs['uni-indexed-list-' + index][0], {
|
|
225
|
+
animated: false
|
|
226
|
+
});
|
|
227
|
+
// #endif
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
touchMove(e) {
|
|
231
|
+
// #ifndef APP-PLUS
|
|
232
|
+
let pageY = this.isPC ? e.pageY : e.touches[0].pageY;
|
|
233
|
+
let index = Math.floor((pageY - this.winOffsetY) / this.itemHeight);
|
|
234
|
+
if (this.touchmoveIndex === index) {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
let item = this.lists[index];
|
|
238
|
+
if (item) {
|
|
239
|
+
this.scrollViewId = 'uni-indexed-list-' + index;
|
|
240
|
+
this.touchmoveIndex = index;
|
|
241
|
+
}
|
|
242
|
+
// #endif
|
|
243
|
+
// #ifdef APP-PLUS
|
|
244
|
+
throttleTouchMove.call(this, e);
|
|
245
|
+
// #endif
|
|
246
|
+
},
|
|
247
|
+
touchEnd() {
|
|
248
|
+
this.touchmove = false;
|
|
249
|
+
// this.touchmoveIndex = -1
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* 兼容 PC @tian
|
|
254
|
+
*/
|
|
255
|
+
|
|
256
|
+
mousedown(e) {
|
|
257
|
+
if (!this.isPC) return;
|
|
258
|
+
this.touchStart(e);
|
|
259
|
+
},
|
|
260
|
+
mousemove(e) {
|
|
261
|
+
if (!this.isPC) return;
|
|
262
|
+
this.touchMove(e);
|
|
263
|
+
},
|
|
264
|
+
mouseleave(e) {
|
|
265
|
+
if (!this.isPC) return;
|
|
266
|
+
this.touchEnd(e);
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
// #ifdef H5
|
|
270
|
+
IsPC() {
|
|
271
|
+
var userAgentInfo = navigator.userAgent;
|
|
272
|
+
var Agents = [
|
|
273
|
+
'Android',
|
|
274
|
+
'iPhone',
|
|
275
|
+
'SymbianOS',
|
|
276
|
+
'Windows Phone',
|
|
277
|
+
'iPad',
|
|
278
|
+
'iPod'
|
|
279
|
+
];
|
|
280
|
+
var flag = true;
|
|
281
|
+
for (let v = 0; v < Agents.length - 1; v++) {
|
|
282
|
+
if (userAgentInfo.indexOf(Agents[v]) > 0) {
|
|
283
|
+
flag = false;
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return flag;
|
|
288
|
+
},
|
|
289
|
+
// #endif
|
|
290
|
+
|
|
291
|
+
onClick(e) {
|
|
292
|
+
let { idx, index } = e;
|
|
293
|
+
let obj = {};
|
|
294
|
+
for (let key in this.lists[idx].items[index]) {
|
|
295
|
+
obj[key] = this.lists[idx].items[index][key];
|
|
296
|
+
}
|
|
297
|
+
let select = [];
|
|
298
|
+
if (this.showSelect) {
|
|
299
|
+
this.lists[idx].items[index].checked =
|
|
300
|
+
!this.lists[idx].items[index].checked;
|
|
301
|
+
this.lists.forEach((value, idx) => {
|
|
302
|
+
value.items.forEach((item, index) => {
|
|
303
|
+
if (item.checked) {
|
|
304
|
+
let obj = {};
|
|
305
|
+
for (let key in this.lists[idx].items[index]) {
|
|
306
|
+
obj[key] = this.lists[idx].items[index][key];
|
|
307
|
+
}
|
|
308
|
+
select.push(obj);
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
this.$emit('click', {
|
|
314
|
+
item: obj,
|
|
315
|
+
select: select
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
</script>
|
|
321
|
+
<style lang="scss" scoped>
|
|
322
|
+
.uni-indexed-list {
|
|
323
|
+
position: absolute;
|
|
324
|
+
left: 0;
|
|
325
|
+
top: 0;
|
|
326
|
+
right: 0;
|
|
327
|
+
bottom: 0;
|
|
328
|
+
/* #ifndef APP-NVUE */
|
|
329
|
+
display: flex;
|
|
330
|
+
/* #endif */
|
|
331
|
+
flex-direction: row;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.uni-indexed-list__scroll {
|
|
335
|
+
flex: 1;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.uni-indexed-list__menu {
|
|
339
|
+
width: 24px;
|
|
340
|
+
/* #ifndef APP-NVUE */
|
|
341
|
+
display: flex;
|
|
342
|
+
/* #endif */
|
|
343
|
+
flex-direction: column;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.uni-indexed-list__menu-item {
|
|
347
|
+
/* #ifndef APP-NVUE */
|
|
348
|
+
display: flex;
|
|
349
|
+
/* #endif */
|
|
350
|
+
flex: 1;
|
|
351
|
+
align-items: center;
|
|
352
|
+
justify-content: center;
|
|
353
|
+
/* #ifdef H5 */
|
|
354
|
+
cursor: pointer;
|
|
355
|
+
/* #endif */
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.uni-indexed-list__menu-text {
|
|
359
|
+
font-size: 12px;
|
|
360
|
+
text-align: center;
|
|
361
|
+
color: #aaa;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.uni-indexed-list__menu--active {
|
|
365
|
+
// background-color: rgb(200, 200, 200);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.uni-indexed-list__menu--active {
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.uni-indexed-list__menu-text--active {
|
|
372
|
+
border-radius: 16px;
|
|
373
|
+
width: 16px;
|
|
374
|
+
height: 16px;
|
|
375
|
+
line-height: 16px;
|
|
376
|
+
background-color: #007aff;
|
|
377
|
+
color: #fff;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.uni-indexed-list__alert-wrapper {
|
|
381
|
+
position: absolute;
|
|
382
|
+
left: 0;
|
|
383
|
+
top: 0;
|
|
384
|
+
right: 0;
|
|
385
|
+
bottom: 0;
|
|
386
|
+
/* #ifndef APP-NVUE */
|
|
387
|
+
display: flex;
|
|
388
|
+
/* #endif */
|
|
389
|
+
flex-direction: row;
|
|
390
|
+
align-items: center;
|
|
391
|
+
justify-content: center;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.uni-indexed-list__alert {
|
|
395
|
+
width: 80px;
|
|
396
|
+
height: 80px;
|
|
397
|
+
border-radius: 80px;
|
|
398
|
+
text-align: center;
|
|
399
|
+
line-height: 80px;
|
|
400
|
+
font-size: 35px;
|
|
401
|
+
color: #fff;
|
|
402
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
403
|
+
}
|
|
404
|
+
</style>
|
|
@@ -0,0 +1,123 @@
|
|
|
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 :bounce="false" :scrollable="true" show-scrollbar :render-reverse="renderReverse" @scroll="scroll" class="uni-list" :class="{ 'uni-list--border': border }" :enableBackToTop="enableBackToTop"
|
|
11
|
+
loadmoreoffset="15">
|
|
12
|
+
<slot />
|
|
13
|
+
</list> -->
|
|
14
|
+
<!-- #endif -->
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
/**
|
|
19
|
+
* List 列表
|
|
20
|
+
* @description 列表组件
|
|
21
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=24
|
|
22
|
+
* @property {String} border = [true|false] 标题
|
|
23
|
+
*/
|
|
24
|
+
export default {
|
|
25
|
+
name: 'uniList',
|
|
26
|
+
'mp-weixin': {
|
|
27
|
+
options: {
|
|
28
|
+
multipleSlots: false
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
props: {
|
|
32
|
+
stackFromEnd: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
enableBackToTop: {
|
|
37
|
+
type: [Boolean, String],
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
scrollY: {
|
|
41
|
+
type: [Boolean, String],
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
border: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: true
|
|
47
|
+
},
|
|
48
|
+
renderReverse: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
// provide() {
|
|
54
|
+
// return {
|
|
55
|
+
// list: this
|
|
56
|
+
// };
|
|
57
|
+
// },
|
|
58
|
+
created() {
|
|
59
|
+
this.firstChildAppend = false;
|
|
60
|
+
},
|
|
61
|
+
methods: {
|
|
62
|
+
loadMore(e) {
|
|
63
|
+
this.$emit('scrolltolower');
|
|
64
|
+
},
|
|
65
|
+
scroll(e) {
|
|
66
|
+
this.$emit('scroll', e);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
</script>
|
|
71
|
+
<style lang="scss">
|
|
72
|
+
$uni-bg-color: #ffffff;
|
|
73
|
+
$uni-border-color: #e5e5e5;
|
|
74
|
+
|
|
75
|
+
.uni-list {
|
|
76
|
+
/* #ifndef APP-NVUE */
|
|
77
|
+
display: flex;
|
|
78
|
+
/* #endif */
|
|
79
|
+
background-color: $uni-bg-color;
|
|
80
|
+
position: relative;
|
|
81
|
+
flex-direction: column;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.uni-list--border {
|
|
85
|
+
position: relative;
|
|
86
|
+
/* #ifdef APP-NVUE */
|
|
87
|
+
border-top-color: $uni-border-color;
|
|
88
|
+
border-top-style: solid;
|
|
89
|
+
border-top-width: 0.5px;
|
|
90
|
+
border-bottom-color: $uni-border-color;
|
|
91
|
+
border-bottom-style: solid;
|
|
92
|
+
border-bottom-width: 0.5px;
|
|
93
|
+
/* #endif */
|
|
94
|
+
z-index: -1;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* #ifndef APP-NVUE */
|
|
98
|
+
|
|
99
|
+
.uni-list--border-top {
|
|
100
|
+
position: absolute;
|
|
101
|
+
top: 0;
|
|
102
|
+
right: 0;
|
|
103
|
+
left: 0;
|
|
104
|
+
height: 1px;
|
|
105
|
+
-webkit-transform: scaleY(0.5);
|
|
106
|
+
transform: scaleY(0.5);
|
|
107
|
+
background-color: $uni-border-color;
|
|
108
|
+
z-index: 1;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.uni-list--border-bottom {
|
|
112
|
+
position: absolute;
|
|
113
|
+
bottom: 0;
|
|
114
|
+
right: 0;
|
|
115
|
+
left: 0;
|
|
116
|
+
height: 1px;
|
|
117
|
+
-webkit-transform: scaleY(0.5);
|
|
118
|
+
transform: scaleY(0.5);
|
|
119
|
+
background-color: $uni-border-color;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/* #endif */
|
|
123
|
+
</style>
|