@kengic/uni 0.3.2-beta.10

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.
Files changed (166) hide show
  1. package/README.md +1 -0
  2. package/dist/index.css +1 -0
  3. package/dist/kengic-uni.js +5 -0
  4. package/dist/src/consts/i18n/en.d.ts +45 -0
  5. package/dist/src/consts/i18n/index.d.ts +90 -0
  6. package/dist/src/consts/i18n/zh_CN.d.ts +45 -0
  7. package/dist/src/consts/index.d.ts +1 -0
  8. package/dist/src/index.d.ts +2 -0
  9. package/dist/src/utils/index.d.ts +1 -0
  10. package/dist/src/utils/kg.util.d.ts +5 -0
  11. package/dist/uni-ui/index.ts +11 -0
  12. package/dist/uni-ui/uni-badge/uni-badge.vue +253 -0
  13. package/dist/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +41 -0
  14. package/dist/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +121 -0
  15. package/dist/uni-ui/uni-calendar/calendar.js +546 -0
  16. package/dist/uni-ui/uni-calendar/i18n/en.json +12 -0
  17. package/dist/uni-ui/uni-calendar/i18n/index.js +8 -0
  18. package/dist/uni-ui/uni-calendar/i18n/zh-Hans.json +12 -0
  19. package/dist/uni-ui/uni-calendar/i18n/zh-Hant.json +12 -0
  20. package/dist/uni-ui/uni-calendar/uni-calendar-item.vue +187 -0
  21. package/dist/uni-ui/uni-calendar/uni-calendar.vue +566 -0
  22. package/dist/uni-ui/uni-calendar/util.js +360 -0
  23. package/dist/uni-ui/uni-card/uni-card.vue +281 -0
  24. package/dist/uni-ui/uni-col/uni-col.vue +317 -0
  25. package/dist/uni-ui/uni-collapse/uni-collapse.vue +147 -0
  26. package/dist/uni-ui/uni-collapse-item/uni-collapse-item.vue +402 -0
  27. package/dist/uni-ui/uni-combox/uni-combox.vue +294 -0
  28. package/dist/uni-ui/uni-countdown/i18n/en.json +6 -0
  29. package/dist/uni-ui/uni-countdown/i18n/index.js +8 -0
  30. package/dist/uni-ui/uni-countdown/i18n/zh-Hans.json +6 -0
  31. package/dist/uni-ui/uni-countdown/i18n/zh-Hant.json +6 -0
  32. package/dist/uni-ui/uni-countdown/uni-countdown.vue +267 -0
  33. package/dist/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +821 -0
  34. package/dist/uni-ui/uni-data-picker/keypress.js +45 -0
  35. package/dist/uni-ui/uni-data-picker/uni-data-picker.vue +551 -0
  36. package/dist/uni-ui/uni-data-pickerview/uni-data-picker.js +622 -0
  37. package/dist/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +323 -0
  38. package/dist/uni-ui/uni-data-select/uni-data-select.vue +517 -0
  39. package/dist/uni-ui/uni-dateformat/date-format.js +200 -0
  40. package/dist/uni-ui/uni-dateformat/uni-dateformat.vue +88 -0
  41. package/dist/uni-ui/uni-datetime-picker/calendar-item.vue +177 -0
  42. package/dist/uni-ui/uni-datetime-picker/calendar.vue +928 -0
  43. package/dist/uni-ui/uni-datetime-picker/i18n/en.json +22 -0
  44. package/dist/uni-ui/uni-datetime-picker/i18n/index.js +8 -0
  45. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +22 -0
  46. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +22 -0
  47. package/dist/uni-ui/uni-datetime-picker/time-picker.vue +934 -0
  48. package/dist/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1026 -0
  49. package/dist/uni-ui/uni-datetime-picker/util.js +403 -0
  50. package/dist/uni-ui/uni-drawer/keypress.js +45 -0
  51. package/dist/uni-ui/uni-drawer/uni-drawer.vue +181 -0
  52. package/dist/uni-ui/uni-easyinput/common.js +56 -0
  53. package/dist/uni-ui/uni-easyinput/uni-easyinput.vue +660 -0
  54. package/dist/uni-ui/uni-fab/uni-fab.vue +491 -0
  55. package/dist/uni-ui/uni-fav/i18n/en.json +4 -0
  56. package/dist/uni-ui/uni-fav/i18n/index.js +8 -0
  57. package/dist/uni-ui/uni-fav/i18n/zh-Hans.json +4 -0
  58. package/dist/uni-ui/uni-fav/i18n/zh-Hant.json +4 -0
  59. package/dist/uni-ui/uni-fav/uni-fav.vue +161 -0
  60. package/dist/uni-ui/uni-file-picker/choose-and-upload-file.js +224 -0
  61. package/dist/uni-ui/uni-file-picker/uni-file-picker.vue +667 -0
  62. package/dist/uni-ui/uni-file-picker/upload-file.vue +325 -0
  63. package/dist/uni-ui/uni-file-picker/upload-image.vue +292 -0
  64. package/dist/uni-ui/uni-file-picker/utils.js +109 -0
  65. package/dist/uni-ui/uni-forms/uni-forms.vue +398 -0
  66. package/dist/uni-ui/uni-forms/utils.js +293 -0
  67. package/dist/uni-ui/uni-forms/validate.js +486 -0
  68. package/dist/uni-ui/uni-forms-item/uni-forms-item.vue +601 -0
  69. package/dist/uni-ui/uni-goods-nav/i18n/en.json +6 -0
  70. package/dist/uni-ui/uni-goods-nav/i18n/index.js +8 -0
  71. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hans.json +6 -0
  72. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hant.json +6 -0
  73. package/dist/uni-ui/uni-goods-nav/uni-goods-nav.vue +229 -0
  74. package/dist/uni-ui/uni-grid/uni-grid.vue +143 -0
  75. package/dist/uni-ui/uni-grid-item/uni-grid-item.vue +129 -0
  76. package/dist/uni-ui/uni-group/uni-group.vue +134 -0
  77. package/dist/uni-ui/uni-icons/icons.js +1169 -0
  78. package/dist/uni-ui/uni-icons/uni-icons.vue +96 -0
  79. package/dist/uni-ui/uni-icons/uniicons.css +663 -0
  80. package/dist/uni-ui/uni-icons/uniicons.ttf +0 -0
  81. package/dist/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +144 -0
  82. package/dist/uni-ui/uni-indexed-list/uni-indexed-list.vue +367 -0
  83. package/dist/uni-ui/uni-link/uni-link.vue +128 -0
  84. package/dist/uni-ui/uni-list/uni-list.vue +123 -0
  85. package/dist/uni-ui/uni-list/uni-refresh.vue +65 -0
  86. package/dist/uni-ui/uni-list/uni-refresh.wxs +87 -0
  87. package/dist/uni-ui/uni-list-ad/uni-list-ad.vue +107 -0
  88. package/dist/uni-ui/uni-list-chat/uni-list-chat.scss +58 -0
  89. package/dist/uni-ui/uni-list-chat/uni-list-chat.vue +593 -0
  90. package/dist/uni-ui/uni-list-item/uni-list-item.vue +534 -0
  91. package/dist/uni-ui/uni-load-more/i18n/en.json +5 -0
  92. package/dist/uni-ui/uni-load-more/i18n/index.js +8 -0
  93. package/dist/uni-ui/uni-load-more/i18n/zh-Hans.json +5 -0
  94. package/dist/uni-ui/uni-load-more/i18n/zh-Hant.json +5 -0
  95. package/dist/uni-ui/uni-load-more/uni-load-more.vue +399 -0
  96. package/dist/uni-ui/uni-nav-bar/uni-nav-bar.vue +357 -0
  97. package/dist/uni-ui/uni-nav-bar/uni-status-bar.vue +24 -0
  98. package/dist/uni-ui/uni-notice-bar/uni-notice-bar.vue +426 -0
  99. package/dist/uni-ui/uni-number-box/uni-number-box.vue +221 -0
  100. package/dist/uni-ui/uni-pagination/i18n/en.json +5 -0
  101. package/dist/uni-ui/uni-pagination/i18n/es.json +5 -0
  102. package/dist/uni-ui/uni-pagination/i18n/fr.json +5 -0
  103. package/dist/uni-ui/uni-pagination/i18n/index.js +12 -0
  104. package/dist/uni-ui/uni-pagination/i18n/zh-Hans.json +5 -0
  105. package/dist/uni-ui/uni-pagination/i18n/zh-Hant.json +5 -0
  106. package/dist/uni-ui/uni-pagination/uni-pagination.vue +465 -0
  107. package/dist/uni-ui/uni-popup/i18n/en.json +7 -0
  108. package/dist/uni-ui/uni-popup/i18n/index.js +9 -0
  109. package/dist/uni-ui/uni-popup/i18n/zh-Hans.json +7 -0
  110. package/dist/uni-ui/uni-popup/i18n/zh-Hant.json +7 -0
  111. package/dist/uni-ui/uni-popup/keypress.js +45 -0
  112. package/dist/uni-ui/uni-popup/popup.js +23 -0
  113. package/dist/uni-ui/uni-popup/uni-popup.vue +464 -0
  114. package/dist/uni-ui/uni-popup-dialog/keypress.js +45 -0
  115. package/dist/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +275 -0
  116. package/dist/uni-ui/uni-popup-message/uni-popup-message.vue +143 -0
  117. package/dist/uni-ui/uni-popup-share/uni-popup-share.vue +187 -0
  118. package/dist/uni-ui/uni-rate/uni-rate.vue +365 -0
  119. package/dist/uni-ui/uni-row/uni-row.vue +190 -0
  120. package/dist/uni-ui/uni-scss/changelog.md +8 -0
  121. package/dist/uni-ui/uni-scss/index.scss +1 -0
  122. package/dist/uni-ui/uni-scss/package.json +82 -0
  123. package/dist/uni-ui/uni-scss/readme.md +4 -0
  124. package/dist/uni-ui/uni-scss/styles/index.scss +7 -0
  125. package/dist/uni-ui/uni-scss/styles/setting/_border.scss +3 -0
  126. package/dist/uni-ui/uni-scss/styles/setting/_color.scss +66 -0
  127. package/dist/uni-ui/uni-scss/styles/setting/_radius.scss +55 -0
  128. package/dist/uni-ui/uni-scss/styles/setting/_space.scss +56 -0
  129. package/dist/uni-ui/uni-scss/styles/setting/_styles.scss +167 -0
  130. package/dist/uni-ui/uni-scss/styles/setting/_text.scss +24 -0
  131. package/dist/uni-ui/uni-scss/styles/setting/_variables.scss +146 -0
  132. package/dist/uni-ui/uni-scss/styles/tools/functions.scss +19 -0
  133. package/dist/uni-ui/uni-scss/theme.scss +31 -0
  134. package/dist/uni-ui/uni-scss/variables.scss +62 -0
  135. package/dist/uni-ui/uni-search-bar/i18n/en.json +4 -0
  136. package/dist/uni-ui/uni-search-bar/i18n/index.js +8 -0
  137. package/dist/uni-ui/uni-search-bar/i18n/zh-Hans.json +4 -0
  138. package/dist/uni-ui/uni-search-bar/i18n/zh-Hant.json +4 -0
  139. package/dist/uni-ui/uni-search-bar/uni-search-bar.vue +298 -0
  140. package/dist/uni-ui/uni-section/uni-section.vue +167 -0
  141. package/dist/uni-ui/uni-segmented-control/uni-segmented-control.vue +145 -0
  142. package/dist/uni-ui/uni-steps/uni-steps.vue +269 -0
  143. package/dist/uni-ui/uni-swipe-action/uni-swipe-action.vue +60 -0
  144. package/dist/uni-ui/uni-swipe-action-item/bindingx.js +302 -0
  145. package/dist/uni-ui/uni-swipe-action-item/isPC.js +12 -0
  146. package/dist/uni-ui/uni-swipe-action-item/mpalipay.js +195 -0
  147. package/dist/uni-ui/uni-swipe-action-item/mpother.js +260 -0
  148. package/dist/uni-ui/uni-swipe-action-item/mpwxs.js +84 -0
  149. package/dist/uni-ui/uni-swipe-action-item/render.js +270 -0
  150. package/dist/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +347 -0
  151. package/dist/uni-ui/uni-swipe-action-item/wx.wxs +341 -0
  152. package/dist/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +218 -0
  153. package/dist/uni-ui/uni-table/uni-table.vue +455 -0
  154. package/dist/uni-ui/uni-tag/uni-tag.vue +252 -0
  155. package/dist/uni-ui/uni-tbody/uni-tbody.vue +29 -0
  156. package/dist/uni-ui/uni-td/uni-td.vue +90 -0
  157. package/dist/uni-ui/uni-th/filter-dropdown.vue +511 -0
  158. package/dist/uni-ui/uni-th/uni-th.vue +285 -0
  159. package/dist/uni-ui/uni-thead/uni-thead.vue +129 -0
  160. package/dist/uni-ui/uni-title/uni-title.vue +171 -0
  161. package/dist/uni-ui/uni-tooltip/uni-tooltip.vue +68 -0
  162. package/dist/uni-ui/uni-tr/table-checkbox.vue +179 -0
  163. package/dist/uni-ui/uni-tr/uni-tr.vue +171 -0
  164. package/dist/uni-ui/uni-transition/createAnimation.js +131 -0
  165. package/dist/uni-ui/uni-transition/uni-transition.vue +281 -0
  166. package/package.json +90 -0
@@ -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" >
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,367 @@
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 :list="list" :loaded="loaded" :idx="idx" :showSelect="showSelect"
12
+ @itemClick="onClick"></indexed-list-item>
13
+ <!-- #ifndef APP-NVUE -->
14
+ </view>
15
+ </scroll-view>
16
+ <!-- #endif -->
17
+ <!-- #ifdef APP-NVUE -->
18
+ </cell>
19
+ </list>
20
+ <!-- #endif -->
21
+ <view class="uni-indexed-list__menu" @touchstart="touchStart" @touchmove.stop.prevent="touchMove"
22
+ @touchend="touchEnd" @mousedown.stop="mousedown" @mousemove.stop.prevent="mousemove"
23
+ @mouseleave.stop="mouseleave">
24
+ <view v-for="(list, key) in lists" :key="key" class="uni-indexed-list__menu-item"
25
+ :class="touchmoveIndex == key ? 'uni-indexed-list__menu--active' : ''">
26
+ <text class="uni-indexed-list__menu-text"
27
+ :class="touchmoveIndex == key ? 'uni-indexed-list__menu-text--active' : ''">{{ list.key }}</text>
28
+ </view>
29
+ </view>
30
+ <view v-if="touchmove" class="uni-indexed-list__alert-wrapper">
31
+ <text class="uni-indexed-list__alert">{{ lists[touchmoveIndex].key }}</text>
32
+ </view>
33
+ </view>
34
+ </template>
35
+ <script>
36
+ import indexedListItem from './uni-indexed-list-item.vue'
37
+ // #ifdef APP-NVUE
38
+ const dom = weex.requireModule('dom');
39
+ // #endif
40
+ // #ifdef APP-PLUS
41
+ function throttle(func, delay) {
42
+ var prev = Date.now();
43
+ return function() {
44
+ var context = this;
45
+ var args = arguments;
46
+ var now = Date.now();
47
+ if (now - prev >= delay) {
48
+ func.apply(context, args);
49
+ prev = Date.now();
50
+ }
51
+ }
52
+ }
53
+
54
+ function touchMove(e) {
55
+ let pageY = e.touches[0].pageY
56
+ let index = Math.floor((pageY - this.winOffsetY) / this.itemHeight)
57
+ if (this.touchmoveIndex === index) {
58
+ return false
59
+ }
60
+ let item = this.lists[index]
61
+ if (item) {
62
+ // #ifndef APP-NVUE
63
+ this.scrollViewId = 'uni-indexed-list-' + index
64
+ this.touchmoveIndex = index
65
+ // #endif
66
+ // #ifdef APP-NVUE
67
+ dom.scrollToElement(this.$refs['uni-indexed-list-' + index][0], {
68
+ animated: false
69
+ })
70
+ this.touchmoveIndex = index
71
+ // #endif
72
+ }
73
+ }
74
+ const throttleTouchMove = throttle(touchMove, 40)
75
+ // #endif
76
+
77
+ /**
78
+ * IndexedList 索引列表
79
+ * @description 用于展示索引列表
80
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=375
81
+ * @property {Boolean} showSelect = [true|false] 展示模式
82
+ * @value true 展示模式
83
+ * @value false 选择模式
84
+ * @property {Object} options 索引列表需要的数据对象
85
+ * @event {Function} click 点击列表事件 ,返回当前选择项的事件对象
86
+ * @example <uni-indexed-list options="" showSelect="false" @click=""></uni-indexed-list>
87
+ */
88
+ export default {
89
+ name: 'UniIndexedList',
90
+ components: {
91
+ indexedListItem
92
+ },
93
+ emits: ['click'],
94
+ props: {
95
+ options: {
96
+ type: Array,
97
+ default () {
98
+ return []
99
+ }
100
+ },
101
+ showSelect: {
102
+ type: Boolean,
103
+ default: false
104
+ }
105
+ },
106
+ data() {
107
+ return {
108
+ lists: [],
109
+ winHeight: 0,
110
+ itemHeight: 0,
111
+ winOffsetY: 0,
112
+ touchmove: false,
113
+ touchmoveIndex: -1,
114
+ scrollViewId: '',
115
+ touchmovable: true,
116
+ loaded: false,
117
+ isPC: false
118
+ }
119
+ },
120
+ watch: {
121
+ options: {
122
+ handler: function() {
123
+ this.setList()
124
+ },
125
+ deep: true
126
+ }
127
+ },
128
+ mounted() {
129
+ // #ifdef H5
130
+ this.isPC = this.IsPC()
131
+ // #endif
132
+ setTimeout(() => {
133
+ this.setList()
134
+ }, 50)
135
+ setTimeout(() => {
136
+ this.loaded = true
137
+ }, 300);
138
+ },
139
+ methods: {
140
+ setList() {
141
+ let index = 0;
142
+ this.lists = []
143
+ this.options.forEach((value) => {
144
+ if (value.data.length === 0) {
145
+ return
146
+ }
147
+ let indexBefore = index
148
+ let items = value.data.map(item => {
149
+ let obj = {}
150
+ obj['key'] = value.letter
151
+ obj['name'] = item
152
+ obj['itemIndex'] = index
153
+ index++
154
+ obj.checked = item.checked ? item.checked : false
155
+ return obj
156
+ })
157
+ this.lists.push({
158
+ title: value.letter,
159
+ key: value.letter,
160
+ items: items,
161
+ itemIndex: indexBefore
162
+ })
163
+ })
164
+ // #ifndef APP-NVUE
165
+ uni.createSelectorQuery()
166
+ .in(this)
167
+ .select('#list')
168
+ .boundingClientRect()
169
+ .exec(ret => {
170
+ this.winOffsetY = ret[0].top
171
+ this.winHeight = ret[0].height
172
+ this.itemHeight = this.winHeight / this.lists.length
173
+ })
174
+ // #endif
175
+ // #ifdef APP-NVUE
176
+ dom.getComponentRect(this.$refs['list'], (res) => {
177
+ this.winOffsetY = res.size.top
178
+ this.winHeight = res.size.height
179
+ this.itemHeight = this.winHeight / this.lists.length
180
+ })
181
+ // #endif
182
+ },
183
+ touchStart(e) {
184
+ this.touchmove = true
185
+ let pageY = this.isPC ? e.pageY : e.touches[0].pageY
186
+ let index = Math.floor((pageY - this.winOffsetY) / this.itemHeight)
187
+ let item = this.lists[index]
188
+ if (item) {
189
+ this.scrollViewId = 'uni-indexed-list-' + index
190
+ this.touchmoveIndex = index
191
+ // #ifdef APP-NVUE
192
+ dom.scrollToElement(this.$refs['uni-indexed-list-' + index][0], {
193
+ animated: false
194
+ })
195
+ // #endif
196
+ }
197
+ },
198
+ touchMove(e) {
199
+ // #ifndef APP-PLUS
200
+ let pageY = this.isPC ? e.pageY : e.touches[0].pageY
201
+ let index = Math.floor((pageY - this.winOffsetY) / this.itemHeight)
202
+ if (this.touchmoveIndex === index) {
203
+ return false
204
+ }
205
+ let item = this.lists[index]
206
+ if (item) {
207
+ this.scrollViewId = 'uni-indexed-list-' + index
208
+ this.touchmoveIndex = index
209
+ }
210
+ // #endif
211
+ // #ifdef APP-PLUS
212
+ throttleTouchMove.call(this, e)
213
+ // #endif
214
+ },
215
+ touchEnd() {
216
+ this.touchmove = false
217
+ // this.touchmoveIndex = -1
218
+ },
219
+
220
+ /**
221
+ * 兼容 PC @tian
222
+ */
223
+
224
+ mousedown(e) {
225
+ if (!this.isPC) return
226
+ this.touchStart(e)
227
+ },
228
+ mousemove(e) {
229
+ if (!this.isPC) return
230
+ this.touchMove(e)
231
+ },
232
+ mouseleave(e) {
233
+ if (!this.isPC) return
234
+ this.touchEnd(e)
235
+ },
236
+
237
+ // #ifdef H5
238
+ IsPC() {
239
+ var userAgentInfo = navigator.userAgent;
240
+ var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
241
+ var flag = true;
242
+ for (let v = 0; v < Agents.length - 1; v++) {
243
+ if (userAgentInfo.indexOf(Agents[v]) > 0) {
244
+ flag = false;
245
+ break;
246
+ }
247
+ }
248
+ return flag;
249
+ },
250
+ // #endif
251
+
252
+
253
+ onClick(e) {
254
+ let {
255
+ idx,
256
+ index
257
+ } = e
258
+ let obj = {}
259
+ for (let key in this.lists[idx].items[index]) {
260
+ obj[key] = this.lists[idx].items[index][key]
261
+ }
262
+ let select = []
263
+ if (this.showSelect) {
264
+ this.lists[idx].items[index].checked = !this.lists[idx].items[index].checked
265
+ this.lists.forEach((value, idx) => {
266
+ value.items.forEach((item, index) => {
267
+ if (item.checked) {
268
+ let obj = {}
269
+ for (let key in this.lists[idx].items[index]) {
270
+ obj[key] = this.lists[idx].items[index][key]
271
+ }
272
+ select.push(obj)
273
+ }
274
+ })
275
+ })
276
+ }
277
+ this.$emit('click', {
278
+ item: obj,
279
+ select: select
280
+ })
281
+ }
282
+ }
283
+ }
284
+ </script>
285
+ <style lang="scss" >
286
+ .uni-indexed-list {
287
+ position: absolute;
288
+ left: 0;
289
+ top: 0;
290
+ right: 0;
291
+ bottom: 0;
292
+ /* #ifndef APP-NVUE */
293
+ display: flex;
294
+ /* #endif */
295
+ flex-direction: row;
296
+ }
297
+
298
+ .uni-indexed-list__scroll {
299
+ flex: 1;
300
+ }
301
+
302
+ .uni-indexed-list__menu {
303
+ width: 24px;
304
+ /* #ifndef APP-NVUE */
305
+ display: flex;
306
+ /* #endif */
307
+ flex-direction: column;
308
+ }
309
+
310
+ .uni-indexed-list__menu-item {
311
+ /* #ifndef APP-NVUE */
312
+ display: flex;
313
+ /* #endif */
314
+ flex: 1;
315
+ align-items: center;
316
+ justify-content: center;
317
+ /* #ifdef H5 */
318
+ cursor: pointer;
319
+ /* #endif */
320
+ }
321
+
322
+ .uni-indexed-list__menu-text {
323
+ font-size: 12px;
324
+ text-align: center;
325
+ color: #aaa;
326
+ }
327
+
328
+ .uni-indexed-list__menu--active {
329
+ // background-color: rgb(200, 200, 200);
330
+ }
331
+
332
+ .uni-indexed-list__menu--active {}
333
+
334
+ .uni-indexed-list__menu-text--active {
335
+ border-radius: 16px;
336
+ width: 16px;
337
+ height: 16px;
338
+ line-height: 16px;
339
+ background-color: #007aff;
340
+ color: #fff;
341
+ }
342
+
343
+ .uni-indexed-list__alert-wrapper {
344
+ position: absolute;
345
+ left: 0;
346
+ top: 0;
347
+ right: 0;
348
+ bottom: 0;
349
+ /* #ifndef APP-NVUE */
350
+ display: flex;
351
+ /* #endif */
352
+ flex-direction: row;
353
+ align-items: center;
354
+ justify-content: center;
355
+ }
356
+
357
+ .uni-indexed-list__alert {
358
+ width: 80px;
359
+ height: 80px;
360
+ border-radius: 80px;
361
+ text-align: center;
362
+ line-height: 80px;
363
+ font-size: 35px;
364
+ color: #fff;
365
+ background-color: rgba(0, 0, 0, 0.5);
366
+ }
367
+ </style>
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <a v-if="isShowA" class="uni-link" :href="href"
3
+ :class="{'uni-link--withline':showUnderLine===true||showUnderLine==='true'}"
4
+ :style="{color,fontSize:fontSize+'px'}" :download="download">
5
+ <slot>{{text}}</slot>
6
+ </a>
7
+ <!-- #ifndef APP-NVUE -->
8
+ <text v-else class="uni-link" :class="{'uni-link--withline':showUnderLine===true||showUnderLine==='true'}"
9
+ :style="{color,fontSize:fontSize+'px'}" @click="openURL">
10
+ <slot>{{text}}</slot>
11
+ </text>
12
+ <!-- #endif -->
13
+ <!-- #ifdef APP-NVUE -->
14
+ <text v-else class="uni-link" :class="{'uni-link--withline':showUnderLine===true||showUnderLine==='true'}"
15
+ :style="{color,fontSize:fontSize+'px'}" @click="openURL">
16
+ {{text}}
17
+ </text>
18
+ <!-- #endif -->
19
+ </template>
20
+
21
+ <script>
22
+ /**
23
+ * Link 外部网页超链接组件
24
+ * @description uni-link是一个外部网页超链接组件,在小程序内复制url,在app内打开外部浏览器,在h5端打开新网页
25
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=1182
26
+ * @property {String} href 点击后打开的外部网页url
27
+ * @property {String} text 显示的文字
28
+ * @property {String} downlaod H5平台下载文件名
29
+ * @property {Boolean} showUnderLine 是否显示下划线
30
+ * @property {String} copyTips 在小程序端复制链接时显示的提示语
31
+ * @property {String} color 链接文字颜色
32
+ * @property {String} fontSize 链接文字大小
33
+ * @example * <uni-link href="https://ext.dcloud.net.cn" text="https://ext.dcloud.net.cn"></uni-link>
34
+ */
35
+ export default {
36
+ name: 'uniLink',
37
+ props: {
38
+ href: {
39
+ type: String,
40
+ default: ''
41
+ },
42
+ text: {
43
+ type: String,
44
+ default: ''
45
+ },
46
+ download: {
47
+ type: String,
48
+ default: ''
49
+ },
50
+ showUnderLine: {
51
+ type: [Boolean, String],
52
+ default: true
53
+ },
54
+ copyTips: {
55
+ type: String,
56
+ default: '已自动复制网址,请在手机浏览器里粘贴该网址'
57
+ },
58
+ color: {
59
+ type: String,
60
+ default: '#999999'
61
+ },
62
+ fontSize: {
63
+ type: [Number, String],
64
+ default: 14
65
+ }
66
+ },
67
+ computed: {
68
+ isShowA() {
69
+ // #ifdef H5
70
+ this._isH5 = true;
71
+ // #endif
72
+ if ((this.isMail() || this.isTel()) && this._isH5 === true) {
73
+ return true;
74
+ }
75
+ return false;
76
+ }
77
+ },
78
+ created() {
79
+ this._isH5 = null;
80
+ },
81
+ methods: {
82
+ isMail() {
83
+ return this.href.startsWith('mailto:');
84
+ },
85
+ isTel() {
86
+ return this.href.startsWith('tel:');
87
+ },
88
+ openURL() {
89
+ // #ifdef APP-PLUS
90
+ if (this.isTel()) {
91
+ this.makePhoneCall(this.href.replace('tel:', ''));
92
+ } else {
93
+ plus.runtime.openURL(this.href);
94
+ }
95
+ // #endif
96
+ // #ifdef H5
97
+ window.open(this.href)
98
+ // #endif
99
+ // #ifdef MP
100
+ uni.setClipboardData({
101
+ data: this.href
102
+ });
103
+ uni.showModal({
104
+ content: this.copyTips,
105
+ showCancel: false
106
+ });
107
+ // #endif
108
+ },
109
+ makePhoneCall(phoneNumber) {
110
+ uni.makePhoneCall({
111
+ phoneNumber
112
+ })
113
+ }
114
+ }
115
+ }
116
+ </script>
117
+
118
+ <style>
119
+ /* #ifndef APP-NVUE */
120
+ .uni-link {
121
+ cursor: pointer;
122
+ }
123
+
124
+ /* #endif */
125
+ .uni-link--withline {
126
+ text-decoration: underline;
127
+ }
128
+ </style>