@kyfe/hroa-ui 1.0.6 → 1.0.8-beta.0
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/hroa-ui.common.js +2344 -2381
- package/dist/hroa-ui.css +1 -1
- package/dist/hroa-ui.umd.js +2344 -2381
- package/dist/hroa-ui.umd.min.js +2 -2
- package/lib/h5-iaa/hr-assistant-profile/demo/index.css +1 -0
- package/lib/h5-iaa/hr-assistant-profile/demo/index.js +1 -0
- package/lib/hr-add-list/index.js +1 -1
- package/lib/hr-bottom-button/index.js +1 -1
- package/lib/hr-breadcrumb/index.js +2 -2
- package/lib/hr-button/index.js +1 -1
- package/lib/hr-checkbox/index.js +1 -1
- package/lib/hr-checkbox-group/index.js +1 -1
- package/lib/hr-clipboard/index.js +1 -1
- package/lib/hr-collapse-card/index.js +1 -1
- package/lib/hr-condition-filtrate/index.js +1 -1
- package/lib/hr-condition-filtrate-popup/index.js +1 -1
- package/lib/hr-date-filter/index.css +1 -1
- package/lib/hr-date-filter/index.js +1 -1
- package/lib/hr-dropdown-date/index.css +1 -1
- package/lib/hr-dropdown-date/index.js +1 -1
- package/lib/hr-elasticity-box/index.js +1 -1
- package/lib/hr-elasticity-box-item/index.js +1 -1
- package/lib/hr-emotional-picture/index.js +1 -1
- package/lib/hr-employee-choose/index.js +1 -1
- package/lib/hr-file-list/index.js +1 -1
- package/lib/hr-full-screen/index.js +1 -1
- package/lib/hr-img-list/index.css +1 -1
- package/lib/hr-img-list/index.js +1 -1
- package/lib/hr-info-card/index.js +1 -1
- package/lib/hr-information/index.js +1 -1
- package/lib/hr-license-plate-number/index.js +1 -1
- package/lib/hr-module-card/index.js +1 -1
- package/lib/hr-multiterm-choose/index.css +1 -1
- package/lib/hr-multiterm-choose/index.js +1 -1
- package/lib/hr-no-data/index.js +1 -1
- package/lib/hr-notice-bar/index.js +1 -1
- package/lib/hr-notification-dialog/index.js +1 -1
- package/lib/hr-open-ks/index.js +1 -1
- package/lib/hr-pager/index.js +1 -1
- package/lib/hr-popup/index.js +1 -1
- package/lib/hr-preview-file/index.js +1 -1
- package/lib/hr-radiobox/index.js +1 -1
- package/lib/hr-radiobox-group/index.js +1 -1
- package/lib/hr-rate/index.js +1 -1
- package/lib/hr-reason-textarea/index.js +1 -1
- package/lib/hr-search-input/index.js +1 -1
- package/lib/hr-search-tips/index.js +2 -2
- package/lib/hr-select/index.js +1 -1
- package/lib/hr-select-list/index.js +2 -2
- package/lib/hr-single-choose/index.css +1 -1
- package/lib/hr-single-choose/index.js +1 -1
- package/lib/hr-slide-pager/index.js +1 -1
- package/lib/hr-sort/index.js +1 -1
- package/lib/hr-stack-image/index.js +1 -1
- package/lib/hr-tab-nav/index.js +1 -1
- package/lib/hr-time-picker/index.js +1 -1
- package/lib/hr-view-item/index.js +1 -1
- package/lib/hr-virtual-list/index.js +1 -1
- package/lib/index/index.css +1 -1
- package/lib/index/index.js +2 -2
- package/lib/utils/index.js +1 -1
- package/package.json +82 -71
- package/lib/getJsModule/index.css +0 -1
- package/lib/getJsModule/index.js +0 -9
- package/packages/getJsModule.js +0 -11
- package/packages/hr-add-list/image/add.svg +0 -1
- package/packages/hr-add-list/image/close.svg +0 -1
- package/packages/hr-add-list/index.js +0 -7
- package/packages/hr-add-list/src/index.vue +0 -125
- package/packages/hr-add-list//346/226/260/345/242/236/345/244/232/347/254/224/346/225/260/346/215/256.md +0 -0
- package/packages/hr-bottom-button/index.js +0 -7
- package/packages/hr-bottom-button/src/index.vue +0 -128
- package/packages/hr-breadcrumb/index.js +0 -3
- package/packages/hr-breadcrumb/src/index.vue +0 -87
- package/packages/hr-breadcrumb//351/235/242/345/214/205/345/261/221.md +0 -0
- package/packages/hr-button/index.js +0 -13
- package/packages/hr-button/src/hr-button.vue +0 -39
- package/packages/hr-checkbox/index.js +0 -8
- package/packages/hr-checkbox/src/active-icon.png +0 -0
- package/packages/hr-checkbox/src/checkbox-group.vue +0 -74
- package/packages/hr-checkbox/src/checkbox.vue +0 -226
- package/packages/hr-checkbox/src/data.js +0 -46
- package/packages/hr-checkbox//345/244/215/351/200/211/346/241/206-/345/215/225/351/200/211/346/241/206.md +0 -0
- package/packages/hr-checkbox-group/index.js +0 -8
- package/packages/hr-clipboard/index.js +0 -8
- package/packages/hr-clipboard/src/index.vue +0 -46
- package/packages/hr-clipboard/src/util.js +0 -9
- package/packages/hr-collapse-card/index.js +0 -3
- package/packages/hr-collapse-card/src/images/icon_up.png +0 -0
- package/packages/hr-collapse-card/src/index.vue +0 -151
- package/packages/hr-collapse-card//346/212/230/345/217/240/345/215/241/347/211/207.md +0 -0
- package/packages/hr-condition-filtrate/enum/index.js +0 -11
- package/packages/hr-condition-filtrate/image/arrow-right.png +0 -0
- package/packages/hr-condition-filtrate/index.js +0 -7
- package/packages/hr-condition-filtrate/src/employee-choose/index.vue +0 -101
- package/packages/hr-condition-filtrate/src/index.vue +0 -246
- package/packages/hr-condition-filtrate/src/multiterm-choose/index.vue +0 -167
- package/packages/hr-condition-filtrate/src/org-tree-choose/index.vue +0 -102
- package/packages/hr-condition-filtrate/src/single-choose/index.vue +0 -144
- package/packages/hr-condition-filtrate/src/text-input/index.vue +0 -60
- package/packages/hr-condition-filtrate/src/time-selector/date-range-select.vue +0 -154
- package/packages/hr-condition-filtrate/src/time-selector/images/date-icon.png +0 -0
- package/packages/hr-condition-filtrate/src/time-selector/index.vue +0 -380
- package/packages/hr-condition-filtrate/src/time-selector/utils/constant.js +0 -30
- package/packages/hr-condition-filtrate/src/time-selector/utils/tools.js +0 -213
- package/packages/hr-condition-filtrate-popup/index.js +0 -7
- package/packages/hr-condition-filtrate-popup/src/index.vue +0 -236
- package/packages/hr-date-filter/index.js +0 -7
- package/packages/hr-date-filter/src/date-select.vue +0 -153
- package/packages/hr-date-filter/src/index.vue +0 -243
- package/packages/hr-date-filter/src/style.less +0 -130
- package/packages/hr-date-filter/src/utils.js +0 -109
- package/packages/hr-dropdown-date/index.js +0 -7
- package/packages/hr-dropdown-date/src/calendar/calendar.js +0 -128
- package/packages/hr-dropdown-date/src/calendar/calendar.vue +0 -485
- package/packages/hr-dropdown-date/src/calendar/images/arrow@3x.png +0 -0
- package/packages/hr-dropdown-date/src/calendar/index.js +0 -5
- package/packages/hr-dropdown-date/src/date-picker/date-range-select.vue +0 -92
- package/packages/hr-dropdown-date/src/date-picker/month-range-select.vue +0 -128
- package/packages/hr-dropdown-date/src/date-picker/month-select.vue +0 -98
- package/packages/hr-dropdown-date/src/date-picker/style.less +0 -120
- package/packages/hr-dropdown-date/src/date-picker/utils.js +0 -109
- package/packages/hr-dropdown-date/src/index.vue +0 -482
- package/packages/hr-dropdown-date/src/week.js +0 -194
- package/packages/hr-elasticity-box/index.js +0 -7
- package/packages/hr-elasticity-box/src/elasticity-box-item.vue +0 -61
- package/packages/hr-elasticity-box/src/index.vue +0 -52
- package/packages/hr-elasticity-box-item/index.js +0 -7
- package/packages/hr-emotional-picture/index.js +0 -7
- package/packages/hr-emotional-picture/src/index.vue +0 -66
- package/packages/hr-emotional-picture//346/203/205/346/204/237/345/233/276/347/273/204/344/273/266.md +0 -0
- package/packages/hr-employee-choose/index.js +0 -7
- package/packages/hr-employee-choose/src/image/arrow-right.png +0 -0
- package/packages/hr-employee-choose/src/index.vue +0 -119
- package/packages/hr-file-list/index.js +0 -3
- package/packages/hr-file-list/src/file-type/other.vue +0 -45
- package/packages/hr-file-list/src/file-type/picture.vue +0 -38
- package/packages/hr-file-list/src/file-type/video.vue +0 -60
- package/packages/hr-file-list/src/index.vue +0 -246
- package/packages/hr-file-list/src/utils/enum.js +0 -95
- package/packages/hr-file-list/src/utils/fun.js +0 -16
- package/packages/hr-file-list//346/226/207/344/273/266/345/210/227/350/241/250.md +0 -0
- package/packages/hr-full-screen/index.js +0 -7
- package/packages/hr-full-screen/src/index.vue +0 -117
- package/packages/hr-img-list/index.js +0 -3
- package/packages/hr-img-list/src/index.vue +0 -144
- package/packages/hr-img-list//345/244/232/345/233/276/345/210/227/350/241/250.md +0 -0
- package/packages/hr-info-card/index.js +0 -7
- package/packages/hr-info-card/src/index.vue +0 -67
- package/packages/hr-information/index.js +0 -7
- package/packages/hr-information/src/index.vue +0 -72
- package/packages/hr-license-plate-number/index.js +0 -8
- package/packages/hr-license-plate-number/src/enum.js +0 -44
- package/packages/hr-license-plate-number/src/index.vue +0 -164
- package/packages/hr-license-plate-number/src/vnp-keyboard.vue +0 -182
- package/packages/hr-license-plate-number//350/275/246/347/211/214/345/217/267/345/274/271/347/252/227.md +0 -0
- package/packages/hr-module-card/index.js +0 -13
- package/packages/hr-module-card/src/index.vue +0 -132
- package/packages/hr-module-card//346/250/241/345/235/227/345/215/241/347/211/207/347/273/204/344/273/266.md +0 -29
- package/packages/hr-multiterm-choose/index.js +0 -8
- package/packages/hr-multiterm-choose/src/active-icon.png +0 -0
- package/packages/hr-multiterm-choose/src/index.vue +0 -224
- package/packages/hr-multiterm-choose//345/244/232/351/200/211/346/241/206.md +0 -0
- package/packages/hr-no-data/index.js +0 -7
- package/packages/hr-no-data/src/index.vue +0 -48
- package/packages/hr-notice-bar/index.js +0 -7
- package/packages/hr-notice-bar/src/bem.js +0 -38
- package/packages/hr-notice-bar/src/index.js +0 -52
- package/packages/hr-notice-bar//351/200/232/347/237/245/346/240/217/347/273/204/344/273/266.md +0 -3
- package/packages/hr-notification-dialog/images/header.png +0 -0
- package/packages/hr-notification-dialog/index.js +0 -7
- package/packages/hr-notification-dialog/src/index.vue +0 -293
- package/packages/hr-notification-dialog//345/274/271/347/252/227/346/217/220/347/244/272/347/273/204/344/273/266.md +0 -0
- package/packages/hr-open-ks/index.js +0 -7
- package/packages/hr-open-ks/src/icon.png +0 -0
- package/packages/hr-open-ks/src/index.vue +0 -97
- package/packages/hr-open-ks/src/util.js +0 -31
- package/packages/hr-pager/images/next-page.png +0 -0
- package/packages/hr-pager/images/prev-page.png +0 -0
- package/packages/hr-pager/index.js +0 -7
- package/packages/hr-pager/src/index.vue +0 -120
- package/packages/hr-pager//346/214/211/351/222/256/347/277/273/351/241/265/347/273/204/344/273/266.md +0 -0
- package/packages/hr-popup/index.js +0 -3
- package/packages/hr-popup/src/index.vue +0 -64
- package/packages/hr-popup//345/274/271/345/207/272/345/261/202.md +0 -0
- package/packages/hr-preview-file/index.js +0 -7
- package/packages/hr-preview-file/src/index.vue +0 -58
- package/packages/hr-preview-file/src/util.js +0 -50
- package/packages/hr-radiobox/index.js +0 -8
- package/packages/hr-radiobox/src/data.js +0 -46
- package/packages/hr-radiobox/src/radiobox-group.vue +0 -64
- package/packages/hr-radiobox/src/radiobox.vue +0 -191
- package/packages/hr-radiobox-group/index.js +0 -8
- package/packages/hr-rate/index.js +0 -7
- package/packages/hr-rate/src/index.vue +0 -42
- package/packages/hr-rate//350/257/204/345/210/206/347/273/204/344/273/266/357/274/210/345/270/246/346/226/207/346/241/210/357/274/211.md +0 -0
- package/packages/hr-reason-textarea/index.js +0 -7
- package/packages/hr-reason-textarea/src/index.vue +0 -128
- package/packages/hr-search-input/image/input-close-icon.png +0 -0
- package/packages/hr-search-input/image/search-icon.png +0 -0
- package/packages/hr-search-input/index.js +0 -8
- package/packages/hr-search-input/src/index.vue +0 -144
- package/packages/hr-search-tips/index.js +0 -3
- package/packages/hr-search-tips/src/index.vue +0 -213
- package/packages/hr-search-tips//350/277/234/347/250/213/346/250/241/347/263/212/346/220/234/347/264/242.md +0 -0
- package/packages/hr-select/index.js +0 -7
- package/packages/hr-select/src/index.vue +0 -41
- package/packages/hr-select-list/index.js +0 -3
- package/packages/hr-select-list/src/index.vue +0 -214
- package/packages/hr-select-list//344/270/213/346/213/211/351/200/211/346/213/251(/351/273/230/350/256/244/345/244/232/351/200/211).md +0 -0
- package/packages/hr-single-choose/index.js +0 -8
- package/packages/hr-single-choose/src/index.vue +0 -195
- package/packages/hr-single-choose//345/215/225/351/200/211/346/241/206.md +0 -0
- package/packages/hr-slide-pager/guide/image/turn-left.png +0 -0
- package/packages/hr-slide-pager/guide/image/turn-right.png +0 -0
- package/packages/hr-slide-pager/guide/index.vue +0 -59
- package/packages/hr-slide-pager/guide//346/226/260/346/211/213/346/214/207/345/274/225.md +0 -0
- package/packages/hr-slide-pager/index.js +0 -7
- package/packages/hr-slide-pager/src/index.vue +0 -374
- package/packages/hr-slide-pager//346/273/221/345/212/250/347/277/273/351/241/265/347/273/204/344/273/266.md +0 -0
- package/packages/hr-sort/index.js +0 -3
- package/packages/hr-sort/src/main.vue +0 -133
- package/packages/hr-sort//346/216/222/345/272/217.md +0 -0
- package/packages/hr-stack-image/index.js +0 -3
- package/packages/hr-stack-image/src/main.vue +0 -77
- package/packages/hr-stack-image//345/261/202/345/217/240/345/233/276/347/211/207/347/273/204/344/273/266.md +0 -0
- package/packages/hr-tab-nav/index.js +0 -8
- package/packages/hr-tab-nav/src/index.vue +0 -190
- package/packages/hr-time-picker/index.js +0 -3
- package/packages/hr-time-picker/src/index.vue +0 -85
- package/packages/hr-time-picker//346/227/266/351/227/264/351/200/211/346/213/251/345/231/250.md +0 -0
- package/packages/hr-view-item/index.js +0 -13
- package/packages/hr-view-item/src/index.vue +0 -89
- package/packages/hr-view-item//350/241/250/345/215/225/351/241/271item/345/261/225/347/244/272.md +0 -0
- package/packages/hr-virtual-list/index.js +0 -7
- package/packages/hr-virtual-list/src/cc-item.vue +0 -105
- package/packages/hr-virtual-list/src/index.vue +0 -227
- package/packages/hr-virtual-list//350/231/232/346/213/237/345/210/227/350/241/250.md +0 -0
- package/packages/index.js +0 -23
- package/packages/utils/directive/common.js +0 -0
- package/packages/utils/directive/index.js +0 -2
- package/packages/utils/directive/specific.js +0 -54
- package/packages/utils/index.js +0 -7
- package/packages/utils/tool/common.js +0 -65
- package/packages/utils/tool/index.js +0 -2
- package/packages/utils/tool/specific.js +0 -0
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="user-item-box">
|
|
3
|
-
<div class="user-item">
|
|
4
|
-
<img class="user-img"
|
|
5
|
-
:src="item.employeePhotoUrl" />
|
|
6
|
-
<div class="right-part">
|
|
7
|
-
<div class="name-box">
|
|
8
|
-
<div class="name">{{(item.name || item.employeeName) + '-' + item.duty}}</div>
|
|
9
|
-
<slot name="ccType"></slot>
|
|
10
|
-
</div>
|
|
11
|
-
<div class="dept-duty">
|
|
12
|
-
<span :class="{'department': item.haveRead}">{{item.department || item.departmentName}}</span>
|
|
13
|
-
<span v-if="item.haveRead">{{item.readTime | minute}}</span>
|
|
14
|
-
<div v-if="isShowCountBar"
|
|
15
|
-
class="count-item">
|
|
16
|
-
<span class="label">阅读时长:</span>
|
|
17
|
-
<span class="value">{{item.stayDurationConvert}}</span>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
</div>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<script>
|
|
27
|
-
export default {
|
|
28
|
-
name: 'cc-item', // 抄送人组件
|
|
29
|
-
props: {
|
|
30
|
-
item: {
|
|
31
|
-
type: Object,
|
|
32
|
-
default: () => ({})
|
|
33
|
-
},
|
|
34
|
-
// 是否展示统计栏
|
|
35
|
-
isShowCountBar: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
default: true
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
}
|
|
41
|
-
</script>
|
|
42
|
-
|
|
43
|
-
<style lang="less" scoped>
|
|
44
|
-
.user-item-box {
|
|
45
|
-
padding: 12px;
|
|
46
|
-
border-bottom: 1px solid #eaebf0;
|
|
47
|
-
}
|
|
48
|
-
.user-item {
|
|
49
|
-
display: flex;
|
|
50
|
-
.user-img {
|
|
51
|
-
width: 40px;
|
|
52
|
-
height: 40px;
|
|
53
|
-
border-radius: 8px;
|
|
54
|
-
margin-right: 10px;
|
|
55
|
-
&.hide {
|
|
56
|
-
visibility: hidden;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
.right-part {
|
|
60
|
-
flex-grow: 1;
|
|
61
|
-
.name-box {
|
|
62
|
-
display: flex;
|
|
63
|
-
justify-content: flex-start;
|
|
64
|
-
align-items: center;
|
|
65
|
-
margin-top: 2px;
|
|
66
|
-
.name {
|
|
67
|
-
font-size: 14px;
|
|
68
|
-
color: #000000;
|
|
69
|
-
}
|
|
70
|
-
.visi-count {
|
|
71
|
-
font-size: 16px;
|
|
72
|
-
color: #7653d6;
|
|
73
|
-
}
|
|
74
|
-
.visi-dura {
|
|
75
|
-
font-size: 16px;
|
|
76
|
-
color: #000000;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
.dept-duty {
|
|
80
|
-
font-size: 12px;
|
|
81
|
-
color: #999999;
|
|
82
|
-
margin-top: 4px;
|
|
83
|
-
display: flex;
|
|
84
|
-
justify-content: space-between;
|
|
85
|
-
.department {
|
|
86
|
-
max-width: 140px;
|
|
87
|
-
overflow: hidden;
|
|
88
|
-
text-overflow: ellipsis;
|
|
89
|
-
white-space: nowrap;
|
|
90
|
-
}
|
|
91
|
-
.count-item {
|
|
92
|
-
font-size: 12px;
|
|
93
|
-
color: #999999;
|
|
94
|
-
margin-left: 12px;
|
|
95
|
-
.label {
|
|
96
|
-
color: #999999;
|
|
97
|
-
}
|
|
98
|
-
.value {
|
|
99
|
-
color: #03050d;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
</style>
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div ref="list"
|
|
3
|
-
:style="{height}"
|
|
4
|
-
class="infinite-list-container"
|
|
5
|
-
@scroll="scrollEvent($event)">
|
|
6
|
-
<!-- 虚拟列表滚动条----一个实际列表高度空盒子用于模拟滚动 -->
|
|
7
|
-
<div ref="phantom"
|
|
8
|
-
class="infinite-list-phantom"></div>
|
|
9
|
-
<!-- 可视区域范围的列表展示区域 -->
|
|
10
|
-
<div ref="content"
|
|
11
|
-
class="infinite-list">
|
|
12
|
-
<div class="infinite-list-item"
|
|
13
|
-
ref="items"
|
|
14
|
-
:id="item._index"
|
|
15
|
-
:key="item._index"
|
|
16
|
-
v-for="item in visibleData">
|
|
17
|
-
<slot ref="slot"
|
|
18
|
-
:item="item.item"
|
|
19
|
-
:index="item._index"></slot>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
</template>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<script>
|
|
27
|
-
|
|
28
|
-
export default {
|
|
29
|
-
name: 'HrVirtualList',
|
|
30
|
-
props: {
|
|
31
|
-
// 所有列表数据
|
|
32
|
-
listData: {
|
|
33
|
-
type: Array,
|
|
34
|
-
default: () => []
|
|
35
|
-
},
|
|
36
|
-
// 列表项预估高度
|
|
37
|
-
estimatedItemSize: {
|
|
38
|
-
type: Number,
|
|
39
|
-
required: true
|
|
40
|
-
},
|
|
41
|
-
// 缓冲区比例
|
|
42
|
-
bufferScale: {
|
|
43
|
-
type: Number,
|
|
44
|
-
default: 1
|
|
45
|
-
},
|
|
46
|
-
// 容器高度 100px or 50vh
|
|
47
|
-
height: {
|
|
48
|
-
type: String,
|
|
49
|
-
default: '100%'
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
data () {
|
|
53
|
-
return {
|
|
54
|
-
//可视区域高度
|
|
55
|
-
screenHeight: 0,
|
|
56
|
-
//起始索引
|
|
57
|
-
start: 0,
|
|
58
|
-
//结束索引
|
|
59
|
-
end: 0,
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
created () {
|
|
63
|
-
this.initPositions()
|
|
64
|
-
},
|
|
65
|
-
mounted () {
|
|
66
|
-
this.screenHeight = this.$el.clientHeight;
|
|
67
|
-
this.start = 0;
|
|
68
|
-
this.end = this.start + this.visibleCount;
|
|
69
|
-
},
|
|
70
|
-
watch: {
|
|
71
|
-
listData: {
|
|
72
|
-
handler () {
|
|
73
|
-
console.log('listData 数据变!!!')
|
|
74
|
-
this.initPositions()
|
|
75
|
-
this.reset()
|
|
76
|
-
},
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
computed: {
|
|
80
|
-
_listData () {
|
|
81
|
-
return this.listData.map((item, index) => {
|
|
82
|
-
return {
|
|
83
|
-
_index: `_${index}`,
|
|
84
|
-
item
|
|
85
|
-
}
|
|
86
|
-
})
|
|
87
|
-
},
|
|
88
|
-
// 可展示的列表数量 (根据 可视区域高度/列表项高度 求出)
|
|
89
|
-
visibleCount () {
|
|
90
|
-
return Math.ceil(this.screenHeight / this.estimatedItemSize)
|
|
91
|
-
},
|
|
92
|
-
aboveCount () {
|
|
93
|
-
return Math.min(this.start, this.bufferScale * this.visibleCount)
|
|
94
|
-
},
|
|
95
|
-
belowCount () {
|
|
96
|
-
return Math.min(this.listData.length - this.end, this.bufferScale * this.visibleCount)
|
|
97
|
-
},
|
|
98
|
-
// 可视区域列表数据(根据start、end索引截取原数组获得)
|
|
99
|
-
visibleData () {
|
|
100
|
-
let start = this.start - this.aboveCount
|
|
101
|
-
let end = this.end + this.belowCount
|
|
102
|
-
return this._listData.slice(start, end)
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
updated () {
|
|
106
|
-
this.$nextTick(function () {
|
|
107
|
-
if (!this.$refs.items || !this.$refs.items.length) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
//获取真实元素大小,修改对应的尺寸缓存
|
|
111
|
-
this.updateItemsSize()
|
|
112
|
-
//更新列表总高度
|
|
113
|
-
let height = this.positions[this.positions.length - 1].bottom
|
|
114
|
-
this.$refs.phantom.style.height = height + 'px'
|
|
115
|
-
//更新真实偏移量
|
|
116
|
-
this.setStartOffset()
|
|
117
|
-
})
|
|
118
|
-
},
|
|
119
|
-
methods: {
|
|
120
|
-
reset () {
|
|
121
|
-
// 滚动条高度重置
|
|
122
|
-
this.$refs.phantom.style.height = 0
|
|
123
|
-
// 索引位置重置
|
|
124
|
-
this.start = 0
|
|
125
|
-
this.end = this.start + this.visibleCount
|
|
126
|
-
},
|
|
127
|
-
initPositions () {
|
|
128
|
-
this.positions = this.listData.map((d, index) => ({
|
|
129
|
-
index,
|
|
130
|
-
height: this.estimatedItemSize,
|
|
131
|
-
top: index * this.estimatedItemSize,
|
|
132
|
-
bottom: (index + 1) * this.estimatedItemSize
|
|
133
|
-
})
|
|
134
|
-
);
|
|
135
|
-
},
|
|
136
|
-
//获取列表起始索引
|
|
137
|
-
getStartIndex (scrollTop = 0) {
|
|
138
|
-
//二分法查找
|
|
139
|
-
return this.binarySearch(this.positions, scrollTop)
|
|
140
|
-
},
|
|
141
|
-
binarySearch (list, value) {
|
|
142
|
-
let start = 0;
|
|
143
|
-
let end = list.length - 1;
|
|
144
|
-
let tempIndex = null;
|
|
145
|
-
|
|
146
|
-
while (start <= end) {
|
|
147
|
-
let midIndex = parseInt((start + end) / 2);
|
|
148
|
-
let midValue = list[midIndex].bottom;
|
|
149
|
-
if (midValue === value) {
|
|
150
|
-
return midIndex + 1;
|
|
151
|
-
} else if (midValue < value) {
|
|
152
|
-
start = midIndex + 1;
|
|
153
|
-
} else if (midValue > value) {
|
|
154
|
-
if (tempIndex === null || tempIndex > midIndex) {
|
|
155
|
-
tempIndex = midIndex;
|
|
156
|
-
}
|
|
157
|
-
end = end - 1;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return tempIndex;
|
|
161
|
-
},
|
|
162
|
-
//获取列表项的当前尺寸
|
|
163
|
-
updateItemsSize () {
|
|
164
|
-
let nodes = this.$refs.items
|
|
165
|
-
nodes.forEach((node) => {
|
|
166
|
-
let rect = node.getBoundingClientRect()
|
|
167
|
-
let height = rect.height;
|
|
168
|
-
let index = +node.id.slice(1)
|
|
169
|
-
let oldHeight = this.positions[index].height
|
|
170
|
-
let dValue = oldHeight - height
|
|
171
|
-
//存在差值
|
|
172
|
-
if (dValue) {
|
|
173
|
-
this.positions[index].bottom = this.positions[index].bottom - dValue
|
|
174
|
-
this.positions[index].height = height
|
|
175
|
-
for (let k = index + 1; k < this.positions.length; k++) {
|
|
176
|
-
this.positions[k].top = this.positions[k - 1].bottom
|
|
177
|
-
this.positions[k].bottom = this.positions[k].bottom - dValue
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
})
|
|
182
|
-
},
|
|
183
|
-
//获取当前的偏移量
|
|
184
|
-
setStartOffset () {
|
|
185
|
-
let startOffset
|
|
186
|
-
if (this.start >= 1) {
|
|
187
|
-
let size = this.positions[this.start].top - (this.positions[this.start - this.aboveCount] ? this.positions[this.start - this.aboveCount].top : 0)
|
|
188
|
-
startOffset = this.positions[this.start - 1].bottom - size
|
|
189
|
-
} else {
|
|
190
|
-
startOffset = 0
|
|
191
|
-
}
|
|
192
|
-
this.$refs.content.style.transform = `translate3d(0,${startOffset}px,0)`
|
|
193
|
-
},
|
|
194
|
-
//滚动事件
|
|
195
|
-
scrollEvent () {
|
|
196
|
-
//当前滚动位置
|
|
197
|
-
let scrollTop = this.$refs.list.scrollTop
|
|
198
|
-
// let startBottom = this.positions[this.start - ]
|
|
199
|
-
//此时的开始索引
|
|
200
|
-
this.start = this.getStartIndex(scrollTop)
|
|
201
|
-
//此时的结束索引
|
|
202
|
-
this.end = this.start + this.visibleCount
|
|
203
|
-
//此时的偏移量
|
|
204
|
-
this.setStartOffset()
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
</script>
|
|
209
|
-
|
|
210
|
-
<style lang="less" scoped>
|
|
211
|
-
.infinite-list-container {
|
|
212
|
-
overflow: auto;
|
|
213
|
-
position: relative;
|
|
214
|
-
-webkit-overflow-scrolling: touch;
|
|
215
|
-
.infinite-list {
|
|
216
|
-
left: 0;
|
|
217
|
-
right: 0;
|
|
218
|
-
top: 0;
|
|
219
|
-
position: absolute;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
.infinite-list-item {
|
|
223
|
-
padding: 5px;
|
|
224
|
-
box-sizing: border-box;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
</style>
|
|
File without changes
|
package/packages/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { getJsModuleList } from './getJsModule'
|
|
3
|
-
|
|
4
|
-
const moduleMap = getJsModuleList()
|
|
5
|
-
const tools = require('./utils/tool/index').default
|
|
6
|
-
const directives = require('./utils/directive/index').default
|
|
7
|
-
|
|
8
|
-
// 定义install方法,接受vue作为参数
|
|
9
|
-
const install = function (Vue) {
|
|
10
|
-
// 判断是否安装过了
|
|
11
|
-
if (install.installed) return
|
|
12
|
-
// 遍历注册全局组件
|
|
13
|
-
Object.keys(moduleMap).forEach((key) => {
|
|
14
|
-
Vue.component(key, moduleMap[key])
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default {
|
|
19
|
-
...moduleMap,
|
|
20
|
-
install,
|
|
21
|
-
tools,
|
|
22
|
-
directives,
|
|
23
|
-
}
|
|
File without changes
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// 拖拽元素自定义指令
|
|
2
|
-
export const draggable = {
|
|
3
|
-
bind (el) {
|
|
4
|
-
let isDragging = false
|
|
5
|
-
|
|
6
|
-
let offset = { x: 0, y: 0 }
|
|
7
|
-
let start = { x: 0, y: 0 }
|
|
8
|
-
|
|
9
|
-
el.addEventListener('touchstart', touchstart, false)
|
|
10
|
-
el.addEventListener('touchmove', touchmove, false)
|
|
11
|
-
el.addEventListener('touchend', touchend, false)
|
|
12
|
-
|
|
13
|
-
function touchstart (event) {
|
|
14
|
-
isDragging = true
|
|
15
|
-
|
|
16
|
-
start.x = event.touches[0].clientX
|
|
17
|
-
start.y = event.touches[0].clientY
|
|
18
|
-
|
|
19
|
-
offset.x = el.offsetLeft
|
|
20
|
-
offset.y = el.offsetTop
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function touchmove (event) {
|
|
24
|
-
if (!isDragging) return
|
|
25
|
-
|
|
26
|
-
let x = offset.x + (event.touches[0].clientX - start.x)
|
|
27
|
-
let y = offset.y + (event.touches[0].clientY - start.y)
|
|
28
|
-
|
|
29
|
-
// 边界判断
|
|
30
|
-
if (x < 0) {
|
|
31
|
-
x = 0
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (x > document.documentElement.clientWidth - el.offsetWidth) {
|
|
35
|
-
x = document.documentElement.clientWidth - el.offsetWidth
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (y < 0) {
|
|
39
|
-
y = 0
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (y > document.documentElement.clientHeight - el.offsetHeight) {
|
|
43
|
-
y = document.documentElement.clientHeight - el.offsetHeight
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
el.style.left = x + 'px'
|
|
47
|
-
el.style.top = y + 'px'
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function touchend () {
|
|
51
|
-
isDragging = false
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
package/packages/utils/index.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// 使用原生APP提供的localStorage
|
|
2
|
-
export const ksStorage = {
|
|
3
|
-
setItem: (key, value) => {
|
|
4
|
-
if (window.$__ENV_WEB__) {
|
|
5
|
-
return sessionStorage.setItem(key, value)
|
|
6
|
-
}
|
|
7
|
-
return (
|
|
8
|
-
window.ks.callFunc &&
|
|
9
|
-
window.ks.callFunc({
|
|
10
|
-
method: 'storageSetItem',
|
|
11
|
-
params: {
|
|
12
|
-
key,
|
|
13
|
-
value
|
|
14
|
-
}
|
|
15
|
-
})
|
|
16
|
-
)
|
|
17
|
-
},
|
|
18
|
-
getItem: key => {
|
|
19
|
-
if (window.$__ENV_WEB__) {
|
|
20
|
-
return sessionStorage.getItem(key)
|
|
21
|
-
}
|
|
22
|
-
return (
|
|
23
|
-
window.ks.callFunc &&
|
|
24
|
-
window.ks.callFunc({
|
|
25
|
-
method: 'storageGetItem',
|
|
26
|
-
params: {
|
|
27
|
-
key
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
)
|
|
31
|
-
},
|
|
32
|
-
removeItem: key => {
|
|
33
|
-
return (
|
|
34
|
-
window.ks.callFunc &&
|
|
35
|
-
window.ks.callFunc({
|
|
36
|
-
method: 'storageSetItem',
|
|
37
|
-
params: {
|
|
38
|
-
key,
|
|
39
|
-
value: ''
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// 防抖
|
|
47
|
-
export const debounce = (fn, wait, immediate) => {
|
|
48
|
-
let timer = null
|
|
49
|
-
return function () {
|
|
50
|
-
const context = this
|
|
51
|
-
const args = arguments
|
|
52
|
-
if (timer) {
|
|
53
|
-
clearTimeout(timer)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (immediate) {
|
|
57
|
-
var callNow = !timer
|
|
58
|
-
timer = setTimeout(() => { timer = null }, wait)
|
|
59
|
-
if (callNow) fn.apply(context, args)
|
|
60
|
-
} else {
|
|
61
|
-
timer = setTimeout(() => fn.apply(context, args), wait)
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
File without changes
|