@10yun/cv-mobile-ui 0.4.2 → 0.4.4

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 (168) hide show
  1. package/package.json +1 -1
  2. package/ui-cv/cv-form-item/cv-form-item.vue +1 -1
  3. package/ui-cv/cv-input-password/cv-input-password.vue +2 -2
  4. package/ui-uni/amap-wx/js/util.js +166 -158
  5. package/ui-uni/page-foot/page-foot.vue +38 -0
  6. package/ui-uni/page-head/page-head.vue +16 -0
  7. package/ui-uni/product.vue +52 -52
  8. package/ui-uni/u-charts/u-charts.js +743 -1092
  9. package/ui-uni/u-link/u-link.vue +59 -0
  10. package/ui-uni/uni-badge/uni-badge.vue +250 -0
  11. package/ui-uni/uni-calendar/calendar.js +546 -0
  12. package/ui-uni/uni-calendar/uni-calendar-item.vue +171 -0
  13. package/ui-uni/uni-calendar/uni-calendar.vue +504 -0
  14. package/{ui-cv/cv-calendar → ui-uni/uni-calendar}/util.js +0 -0
  15. package/ui-uni/uni-card/uni-card.vue +420 -0
  16. package/ui-uni/uni-col/uni-col.vue +2968 -0
  17. package/ui-uni/uni-collapse/uni-collapse.vue +146 -0
  18. package/ui-uni/uni-collapse-item/uni-collapse-item.vue +378 -0
  19. package/ui-uni/uni-combox/uni-combox.vue +237 -0
  20. package/ui-uni/uni-countdown/uni-countdown.vue +234 -0
  21. package/ui-uni/uni-data-checkbox/uni-data-checkbox.vue +792 -0
  22. package/{ui-cv/cv-data-indexed-list → ui-uni/uni-data-indexed-list}/clientdb.js +0 -0
  23. package/ui-uni/uni-data-indexed-list/uni-data-indexed-list-item.vue +142 -0
  24. package/ui-uni/uni-data-indexed-list/uni-data-indexed-list.vue +364 -0
  25. package/{ui-cv/cv-data-picker → ui-uni/uni-data-picker}/keypress.js +0 -0
  26. package/ui-uni/uni-data-picker/uni-data-picker.vue +468 -0
  27. package/{ui-cv/cv-data-pickerview/cv-data-picker.js → ui-uni/uni-data-pickerview/uni-data-picker.js} +0 -0
  28. package/ui-uni/uni-data-pickerview/uni-data-pickerview.vue +298 -0
  29. package/{ui-cv/cv-dateformat → ui-uni/uni-dateformat}/date-format.js +0 -0
  30. package/ui-uni/uni-dateformat/uni-dateformat.vue +88 -0
  31. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/calendar-item.vue +0 -0
  32. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/calendar.js +0 -0
  33. package/ui-uni/uni-datetime-picker/calendar.vue +747 -0
  34. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/keypress.js +0 -0
  35. package/ui-uni/uni-datetime-picker/time-picker.vue +899 -0
  36. package/ui-uni/uni-datetime-picker/uni-datetime-picker.vue +874 -0
  37. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/util.js +0 -0
  38. package/ui-uni/uni-drawer/keypress.js +45 -0
  39. package/ui-uni/uni-drawer/uni-drawer.vue +178 -0
  40. package/{ui-cv/cv-easyinput → ui-uni/uni-easyinput}/common.js +0 -0
  41. package/ui-uni/uni-easyinput/uni-easyinput.vue +438 -0
  42. package/ui-uni/uni-fab/uni-fab.vue +443 -0
  43. package/{ui-cv/cv-fab/cv-fab.vue.bak → ui-uni/uni-fab/uni-fab.vue.bak} +2 -2
  44. package/ui-uni/uni-fav/uni-fav.vue +136 -0
  45. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/choose-and-upload-file.js +0 -0
  46. package/ui-uni/uni-file-picker/uni-file-picker.vue +614 -0
  47. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/upload-file.vue +0 -0
  48. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/upload-image.vue +0 -0
  49. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/utils.js +0 -0
  50. package/ui-uni/uni-forms/uni-forms.vue +467 -0
  51. package/ui-uni/uni-forms/validate.js +486 -0
  52. package/ui-uni/uni-forms-item/uni-forms-item.vue +500 -0
  53. package/{ui-cv/cv-goods-nav/cv-goods-nav.vue → ui-uni/uni-goods-nav/uni-goods-nav.vue} +1 -1
  54. package/ui-uni/uni-grid/uni-grid.vue +141 -0
  55. package/ui-uni/uni-grid-item/uni-grid-item.vue +123 -0
  56. package/ui-uni/uni-group/uni-group.vue +123 -0
  57. package/ui-uni/uni-icons/icons.js +132 -0
  58. package/ui-uni/uni-icons/uni-icons.vue +72 -0
  59. package/{ui-cv/cv-icon2 → ui-uni/uni-icons}/uni.ttf +0 -0
  60. package/ui-uni/uni-indexed-list/uni-indexed-list-item.vue +142 -0
  61. package/ui-uni/uni-indexed-list/uni-indexed-list.vue +357 -0
  62. package/ui-uni/uni-link/uni-link.vue +117 -0
  63. package/ui-uni/uni-list/uni-list.vue +107 -0
  64. package/ui-uni/uni-list/uni-refresh.vue +65 -0
  65. package/{ui-cv/cv-list → ui-uni/uni-list}/uni-refresh.wxs +0 -0
  66. package/ui-uni/uni-list-ad/uni-list-ad.vue +106 -0
  67. package/{ui-cv/cv-list-chat/cv-list-chat.scss → ui-uni/uni-list-chat/uni-list-chat.scss} +0 -0
  68. package/{ui-cv/cv-list-chat/cv-list-chat.vue → ui-uni/uni-list-chat/uni-list-chat.vue} +0 -0
  69. package/ui-uni/uni-list-item/uni-list-item.vue +428 -0
  70. package/ui-uni/uni-load-more/uni-load-more.vue +366 -0
  71. package/ui-uni/uni-nav-bar/uni-nav-bar.vue +244 -0
  72. package/{ui-cv/cv-nav-bar/cv-status-bar.vue → ui-uni/uni-nav-bar/uni-status-bar.vue} +0 -0
  73. package/ui-uni/uni-notice-bar/uni-notice-bar.vue +394 -0
  74. package/ui-uni/uni-number-box/uni-number-box.vue +224 -0
  75. package/ui-uni/uni-pagination/uni-pagination.vue +376 -0
  76. package/{ui-cv/cv-popup → ui-uni/uni-popup}/keypress.js +0 -0
  77. package/{ui-cv/cv-popup → ui-uni/uni-popup}/popup.js +0 -0
  78. package/ui-uni/uni-popup/uni-popup.vue +412 -0
  79. package/{ui-cv/cv-popup-dialog → ui-uni/uni-popup-dialog}/keypress.js +0 -0
  80. package/{ui-cv/cv-popup-dialog/cv-popup-dialog.vue → ui-uni/uni-popup-dialog/uni-popup-dialog.vue} +0 -0
  81. package/ui-uni/uni-popup-message/uni-popup-message.vue +143 -0
  82. package/{ui-cv/cv-popup-share/cv-popup-share.vue → ui-uni/uni-popup-share/uni-popup-share.vue} +0 -0
  83. package/ui-uni/uni-rate/uni-rate.vue +357 -0
  84. package/ui-uni/uni-row/uni-row.vue +155 -0
  85. package/ui-uni/uni-search-bar/uni-search-bar.vue +262 -0
  86. package/{ui-cv/cv-section/cv-section.vue → ui-uni/uni-section/uni-section.vue} +0 -0
  87. package/{ui-cv/cv-segmented-control/cv-segmented-control.vue → ui-uni/uni-segmented-control/uni-segmented-control.vue} +0 -0
  88. package/{ui-cv/cv-status-bar/cv-status-bar.vue → ui-uni/uni-status-bar/uni-status-bar.vue} +0 -0
  89. package/ui-uni/uni-steps/uni-steps.vue +250 -0
  90. package/{ui-cv/cv-swipe-action/cv-swipe-action.vue → ui-uni/uni-swipe-action/uni-swipe-action.vue} +0 -0
  91. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/bindingx.js +0 -0
  92. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/index.wxs +0 -0
  93. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/isPC.js +0 -0
  94. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpalipay.js +0 -0
  95. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpother.js +0 -0
  96. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpwxs.js +0 -0
  97. package/{ui-cv/cv-swipe-action-item/cv-swipe-action-item.vue → ui-uni/uni-swipe-action-item/uni-swipe-action-item.vue} +0 -0
  98. package/ui-uni/uni-swiper-dot/uni-swiper-dot.vue +205 -0
  99. package/ui-uni/uni-table/uni-table.vue +455 -0
  100. package/ui-uni/uni-tag/uni-tag.vue +283 -0
  101. package/ui-uni/uni-tbody/uni-tbody.vue +30 -0
  102. package/ui-uni/uni-td/uni-td.vue +88 -0
  103. package/{ui-cv/cv-test/cv-test.vue → ui-uni/uni-test/uni-test.vue} +0 -0
  104. package/{ui-cv/cv-th → ui-uni/uni-th}/filter-dropdown.vue +0 -0
  105. package/ui-uni/uni-th/uni-th.vue +259 -0
  106. package/ui-uni/uni-thead/uni-thead.vue +114 -0
  107. package/ui-uni/uni-title/uni-title.vue +171 -0
  108. package/{ui-cv/cv-tr → ui-uni/uni-tr}/table-checkbox.vue +0 -0
  109. package/ui-uni/uni-tr/uni-tr.vue +156 -0
  110. package/{ui-cv/cv-transition → ui-uni/uni-transition}/createAnimation.js +0 -0
  111. package/ui-uni/uni-transition/uni-transition.vue +287 -0
  112. package/ui-cv/cv-badge/cv-badge.vue +0 -249
  113. package/ui-cv/cv-calendar/calendar.js +0 -963
  114. package/ui-cv/cv-calendar/cv-calendar-item.vue +0 -198
  115. package/ui-cv/cv-calendar/cv-calendar.vue +0 -508
  116. package/ui-cv/cv-card/cv-card.vue +0 -427
  117. package/ui-cv/cv-col/cv-col.vue +0 -2965
  118. package/ui-cv/cv-collapse/cv-collapse.vue +0 -146
  119. package/ui-cv/cv-collapse-item/cv-collapse-item.vue +0 -395
  120. package/ui-cv/cv-combox/cv-combox.vue +0 -250
  121. package/ui-cv/cv-countdown/cv-countdown.vue +0 -245
  122. package/ui-cv/cv-data-checkbox/cv-data-checkbox.vue +0 -841
  123. package/ui-cv/cv-data-indexed-list/cv-data-indexed-list-item.vue +0 -154
  124. package/ui-cv/cv-data-indexed-list/cv-data-indexed-list.vue +0 -376
  125. package/ui-cv/cv-data-picker/cv-data-picker.vue +0 -486
  126. package/ui-cv/cv-data-pickerview/cv-data-pickerview.vue +0 -304
  127. package/ui-cv/cv-dateformat/cv-dateformat.vue +0 -86
  128. package/ui-cv/cv-datetime-picker/calendar.vue +0 -761
  129. package/ui-cv/cv-datetime-picker/cv-datetime-picker.vue +0 -958
  130. package/ui-cv/cv-datetime-picker/time-picker.vue +0 -907
  131. package/ui-cv/cv-drawer/cv-drawer.vue +0 -185
  132. package/ui-cv/cv-drawer/keypress.js +0 -45
  133. package/ui-cv/cv-easyinput/cv-easyinput.vue +0 -514
  134. package/ui-cv/cv-fab/cv-fab.vue +0 -465
  135. package/ui-cv/cv-fav/cv-fav.vue +0 -150
  136. package/ui-cv/cv-file-picker/cv-file-picker.vue +0 -619
  137. package/ui-cv/cv-form-base/cv-form-base.vue +0 -470
  138. package/ui-cv/cv-form-base/validate.js +0 -477
  139. package/ui-cv/cv-grid-group/cv-grid-group.vue +0 -148
  140. package/ui-cv/cv-grid-item/cv-grid-item.vue +0 -132
  141. package/ui-cv/cv-icon2/cv-icon2.vue +0 -78
  142. package/ui-cv/cv-icon2/icons.js +0 -132
  143. package/ui-cv/cv-indexed-list/cv-indexed-list-item.vue +0 -154
  144. package/ui-cv/cv-indexed-list/cv-indexed-list.vue +0 -371
  145. package/ui-cv/cv-link2/cv-link2.vue +0 -130
  146. package/ui-cv/cv-list/cv-list.vue +0 -107
  147. package/ui-cv/cv-list/cv-refresh.vue +0 -65
  148. package/ui-cv/cv-list-ad/cv-list-ad.vue +0 -113
  149. package/ui-cv/cv-list-item/cv-list-item.vue +0 -449
  150. package/ui-cv/cv-nav-bar/cv-nav-bar.vue +0 -256
  151. package/ui-cv/cv-notice-bar/cv-notice-bar.vue +0 -453
  152. package/ui-cv/cv-number-box/cv-number-box.vue +0 -223
  153. package/ui-cv/cv-pagination/cv-pagination.vue +0 -397
  154. package/ui-cv/cv-popup/cv-popup.vue +0 -429
  155. package/ui-cv/cv-popup-message/cv-popup-message.vue +0 -143
  156. package/ui-cv/cv-row/cv-row.vue +0 -157
  157. package/ui-cv/cv-search-bar/cv-search-bar.vue +0 -280
  158. package/ui-cv/cv-steps/cv-steps.vue +0 -293
  159. package/ui-cv/cv-swiper-dot/cv-swiper-dot.vue +0 -255
  160. package/ui-cv/cv-table/cv-table.vue +0 -460
  161. package/ui-cv/cv-tag/cv-tag.vue +0 -276
  162. package/ui-cv/cv-tbody/cv-tbody.vue +0 -28
  163. package/ui-cv/cv-td/cv-td.vue +0 -93
  164. package/ui-cv/cv-th/cv-th.vue +0 -270
  165. package/ui-cv/cv-thead/cv-thead.vue +0 -114
  166. package/ui-cv/cv-title/cv-title.vue +0 -168
  167. package/ui-cv/cv-tr/cv-tr.vue +0 -166
  168. package/ui-cv/cv-transition/cv-transition.vue +0 -279
@@ -0,0 +1,106 @@
1
+ <template>
2
+ <!-- #ifdef APP-NVUE -->
3
+ <cell>
4
+ <!-- #endif -->
5
+ <view class="uni-list-ad">
6
+ <view v-if="borderShow" :class="{'uni-list--border':border,'uni-list-item--first':isFirstChild}"></view>
7
+ <ad style="width: 200px;height: 300px;border-width: 1px;border-color: red;border-style: solid;" adpid="1111111111" unit-id="" appid="" apid="" type="feed" @error="aderror" @close="closeAd"></ad>
8
+ </view>
9
+ <!-- #ifdef APP-NVUE -->
10
+ </cell>
11
+ <!-- #endif -->
12
+
13
+ </template>
14
+
15
+ <script>
16
+ // #ifdef APP-NVUE
17
+ const dom = uni.requireNativePlugin('dom');
18
+ // #endif
19
+ export default {
20
+ name: 'UniListAd',
21
+ props: {
22
+ title: {
23
+ type: String,
24
+ default: '',
25
+
26
+ }
27
+ },
28
+ // inject: ['list'],
29
+ data() {
30
+ return {
31
+ isFirstChild: false,
32
+ border: false,
33
+ borderShow: true,
34
+ }
35
+ },
36
+
37
+ mounted() {
38
+ this.list = this.getForm()
39
+ if (this.list) {
40
+ if (!this.list.firstChildAppend) {
41
+ this.list.firstChildAppend = true
42
+ this.isFirstChild = true
43
+ }
44
+ this.border = this.list.border
45
+ }
46
+ },
47
+ methods: {
48
+ /**
49
+ * 获取父元素实例
50
+ */
51
+ getForm(name = 'uniList') {
52
+ let parent = this.$parent;
53
+ let parentName = parent.$options.name;
54
+ while (parentName !== name) {
55
+ parent = parent.$parent;
56
+ if (!parent) return false
57
+ parentName = parent.$options.name;
58
+ }
59
+ return parent;
60
+ },
61
+ aderror(e) {
62
+ console.log("aderror: " + JSON.stringify(e.detail));
63
+ },
64
+ closeAd(e) {
65
+ this.borderShow = false
66
+ }
67
+ }
68
+ }
69
+ </script>
70
+
71
+ <style scoped>
72
+ .uni-list-ad {
73
+ position: relative;
74
+ border: 1px red solid;
75
+ }
76
+
77
+ .uni-list--border {
78
+ position: relative;
79
+ padding-bottom: 1px;
80
+ /* #ifdef APP-PLUS */
81
+ border-top-color: #e5e5e5;
82
+ border-top-style: solid;
83
+ border-top-width: 0.5px;
84
+ /* #endif */
85
+ margin-left: 15px;
86
+ }
87
+
88
+ /* #ifndef APP-NVUE */
89
+ .uni-list--border:after {
90
+ position: absolute;
91
+ top: 0;
92
+ right: 0;
93
+ left: 0;
94
+ height: 1px;
95
+ content: "";
96
+ -webkit-transform: scaleY(0.5);
97
+ transform: scaleY(0.5);
98
+ background-color: #e5e5e5;
99
+ }
100
+
101
+ .uni-list-item--first:after {
102
+ height: 0px;
103
+ }
104
+
105
+ /* #endif */
106
+ </style>
@@ -0,0 +1,428 @@
1
+ <template>
2
+ <!-- #ifdef APP-NVUE -->
3
+ <cell>
4
+ <!-- #endif -->
5
+
6
+ <view :class="{ 'uni-list-item--disabled': disabled }" :hover-class="(!clickable && !link) || disabled || showSwitch ? '' : 'uni-list-item--hover'" class="uni-list-item" @click="onClick">
7
+ <view v-if="!isFirstChild" class="border--left" :class="{ 'uni-list--border': border }"></view>
8
+ <view class="uni-list-item__container" :class="{ 'container--right': showArrow || link, 'flex--direction': direction === 'column' }">
9
+ <slot name="header">
10
+ <view class="uni-list-item__header">
11
+ <view v-if="thumb" class="uni-list-item__icon">
12
+ <image :src="thumb" class="uni-list-item__icon-img" :class="['uni-list--' + thumbSize]" />
13
+ </view>
14
+ <view v-else-if="showExtraIcon" class="uni-list-item__icon">
15
+ <uni-icons :color="extraIcon.color" :size="extraIcon.size" :type="extraIcon.type" />
16
+ </view>
17
+ </view>
18
+ </slot>
19
+ <slot name="body">
20
+ <view class="uni-list-item__content" :class="{ 'uni-list-item__content--center': thumb || showExtraIcon || showBadge || showSwitch }">
21
+ <text v-if="title" class="uni-list-item__content-title" :class="[ellipsis !== 0 && ellipsis <= 2 ? 'uni-ellipsis-' + ellipsis : '']">{{ title }}</text>
22
+ <text v-if="note" class="uni-list-item__content-note">{{ note }}</text>
23
+ </view>
24
+ </slot>
25
+ <slot name="footer">
26
+ <view v-if="rightText || showBadge || showSwitch" class="uni-list-item__extra" :class="{ 'flex--justify': direction === 'column' }">
27
+ <text v-if="rightText" class="uni-list-item__extra-text">{{ rightText }}</text>
28
+ <uni-badge v-if="showBadge" :type="badgeType" :text="badgeText" />
29
+ <switch v-if="showSwitch" :disabled="disabled" :checked="switchChecked" @change="onSwitchChange" />
30
+ </view>
31
+ </slot>
32
+ </view>
33
+ <uni-icons v-if="showArrow || link" :size="16" class="uni-icon-wrapper" color="#bbb" type="arrowright" />
34
+ </view>
35
+ <!-- #ifdef APP-NVUE -->
36
+ </cell>
37
+ <!-- #endif -->
38
+ </template>
39
+
40
+ <script>
41
+ /**
42
+ * ListItem 列表子组件
43
+ * @description 列表子组件
44
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=24
45
+ * @property {String} title 标题
46
+ * @property {String} note 描述
47
+ * @property {String} thumb 左侧缩略图,若thumb有值,则不会显示扩展图标
48
+ * @property {String} thumbSize = [lg|base|sm] 略缩图大小
49
+ * @value lg 大图
50
+ * @value base 一般
51
+ * @value sm 小图
52
+ * @property {String} badgeText 数字角标内容
53
+ * @property {String} badgeType 数字角标类型,参考[uni-icons](https://ext.dcloud.net.cn/plugin?id=21)
54
+ * @property {String} rightText 右侧文字内容
55
+ * @property {Boolean} disabled = [true|false] 是否禁用
56
+ * @property {Boolean} clickable = [true|false] 是否开启点击反馈
57
+ * @property {String} link = [navigateTo|redirectTo|reLaunch|switchTab] 是否展示右侧箭头并开启点击反馈
58
+ * @value navigateTo 同 uni.navigateTo()
59
+ * @value redirectTo 同 uni.redirectTo()
60
+ * @value reLaunch 同 uni.reLaunch()
61
+ * @value switchTab 同 uni.switchTab()
62
+ * @property {String | PageURIString} to 跳转目标页面
63
+ * @property {Boolean} showBadge = [true|false] 是否显示数字角标
64
+ * @property {Boolean} showSwitch = [true|false] 是否显示Switch
65
+ * @property {Boolean} switchChecked = [true|false] Switch是否被选中
66
+ * @property {Boolean} showExtraIcon = [true|false] 左侧是否显示扩展图标
67
+ * @property {Object} extraIcon 扩展图标参数,格式为 {color: '#4cd964',size: '22',type: 'spinner'}
68
+ * @property {String} direction = [row|column] 排版方向
69
+ * @value row 水平排列
70
+ * @value column 垂直排列
71
+ * @event {Function} click 点击 uniListItem 触发事件
72
+ * @event {Function} switchChange 点击切换 Switch 时触发
73
+ */
74
+ export default {
75
+ name: 'UniListItem',
76
+ emits: ['click', 'switchChange'],
77
+ props: {
78
+ direction: {
79
+ type: String,
80
+ default: 'row'
81
+ },
82
+ title: {
83
+ type: String,
84
+ default: ''
85
+ },
86
+ note: {
87
+ type: String,
88
+ default: ''
89
+ },
90
+ ellipsis: {
91
+ type: [Number],
92
+ default: 0
93
+ },
94
+ disabled: {
95
+ type: [Boolean, String],
96
+ default: false
97
+ },
98
+ clickable: {
99
+ type: Boolean,
100
+ default: false
101
+ },
102
+ showArrow: {
103
+ type: [Boolean, String],
104
+ default: false
105
+ },
106
+ link: {
107
+ type: [Boolean, String],
108
+ default: false
109
+ },
110
+ to: {
111
+ type: String,
112
+ default: ''
113
+ },
114
+ showBadge: {
115
+ type: [Boolean, String],
116
+ default: false
117
+ },
118
+ showSwitch: {
119
+ type: [Boolean, String],
120
+ default: false
121
+ },
122
+ switchChecked: {
123
+ type: [Boolean, String],
124
+ default: false
125
+ },
126
+ badgeText: {
127
+ type: String,
128
+ default: ''
129
+ },
130
+ badgeType: {
131
+ type: String,
132
+ default: 'success'
133
+ },
134
+ rightText: {
135
+ type: String,
136
+ default: ''
137
+ },
138
+ thumb: {
139
+ type: String,
140
+ default: ''
141
+ },
142
+ thumbSize: {
143
+ type: String,
144
+ default: 'base'
145
+ },
146
+ showExtraIcon: {
147
+ type: [Boolean, String],
148
+ default: false
149
+ },
150
+ extraIcon: {
151
+ type: Object,
152
+ default () {
153
+ return {
154
+ type: 'contact',
155
+ color: '#000000',
156
+ size: 20
157
+ };
158
+ }
159
+ },
160
+ border: {
161
+ type: Boolean,
162
+ default: true
163
+ }
164
+ },
165
+ // inject: ['list'],
166
+ data() {
167
+ return {
168
+ isFirstChild: false
169
+ };
170
+ },
171
+ mounted() {
172
+ this.list = this.getForm()
173
+ // 判断是否存在 uni-list 组件
174
+ if (this.list) {
175
+ if (!this.list.firstChildAppend) {
176
+ this.list.firstChildAppend = true;
177
+ this.isFirstChild = true;
178
+ }
179
+ }
180
+ },
181
+ methods: {
182
+ /**
183
+ * 获取父元素实例
184
+ */
185
+ getForm(name = 'uniList') {
186
+ let parent = this.$parent;
187
+ let parentName = parent.$options.name;
188
+ while (parentName !== name) {
189
+ parent = parent.$parent;
190
+ if (!parent) return false
191
+ parentName = parent.$options.name;
192
+ }
193
+ return parent;
194
+ },
195
+ onClick() {
196
+ if (this.to !== '') {
197
+ this.openPage();
198
+ return;
199
+ }
200
+ if (this.clickable || this.link) {
201
+ this.$emit('click', {
202
+ data: {}
203
+ });
204
+ }
205
+ },
206
+ onSwitchChange(e) {
207
+ this.$emit('switchChange', e.detail);
208
+ },
209
+ openPage() {
210
+ if (['navigateTo', 'redirectTo', 'reLaunch', 'switchTab'].indexOf(this.link) !== -1) {
211
+ this.pageApi(this.link);
212
+ } else {
213
+ this.pageApi('navigateTo');
214
+ }
215
+ },
216
+ pageApi(api) {
217
+ uni[api]({
218
+ url: this.to,
219
+ success: res => {
220
+ this.$emit('click', {
221
+ data: res
222
+ });
223
+ },
224
+ fail: err => {
225
+ this.$emit('click', {
226
+ data: err
227
+ });
228
+ console.error(err.errMsg);
229
+ }
230
+ });
231
+ }
232
+ }
233
+ };
234
+ </script>
235
+
236
+ <style scoped>
237
+ .uni-list-item {
238
+ /* #ifndef APP-NVUE */
239
+ display: flex;
240
+ /* #endif */
241
+ font-size: 16px;
242
+ position: relative;
243
+ justify-content: space-between;
244
+ align-items: center;
245
+ background-color: #fff;
246
+ flex-direction: row;
247
+ /* #ifdef H5 */
248
+ cursor: pointer;
249
+ /* #endif */
250
+ }
251
+
252
+ .uni-list-item--disabled {
253
+ opacity: 0.3;
254
+ }
255
+
256
+ .uni-list-item--hover {
257
+ background-color: #f1f1f1;
258
+ }
259
+
260
+ .uni-list-item__container {
261
+ position: relative;
262
+ /* #ifndef APP-NVUE */
263
+ display: flex;
264
+ /* #endif */
265
+ flex-direction: row;
266
+ padding: 12px 15px;
267
+ padding-left: 15px;
268
+ flex: 1;
269
+ overflow: hidden;
270
+ }
271
+
272
+ .container--right {
273
+ padding-right: 0;
274
+ }
275
+
276
+ .uni-list--border {
277
+ position: absolute;
278
+ top: 0;
279
+ right: 0;
280
+ left: 0;
281
+ /* #ifdef APP-NVUE */
282
+ border-top-color: #e5e5e5;
283
+ border-top-style: solid;
284
+ border-top-width: 0.5px;
285
+ /* #endif */
286
+ }
287
+
288
+ /* #ifndef APP-NVUE */
289
+ .uni-list--border:after {
290
+ position: absolute;
291
+ top: 0;
292
+ right: 0;
293
+ left: 0;
294
+ height: 1px;
295
+ content: "";
296
+ -webkit-transform: scaleY(0.5);
297
+ transform: scaleY(0.5);
298
+ background-color: #e5e5e5;
299
+ }
300
+
301
+ /* #endif */
302
+ .uni-list-item__content {
303
+ /* #ifndef APP-NVUE */
304
+ display: flex;
305
+ /* #endif */
306
+ padding-right: 8px;
307
+ flex: 1;
308
+ color: #3b4144;
309
+ flex-direction: column;
310
+ justify-content: space-between;
311
+ overflow: hidden;
312
+ }
313
+
314
+ .uni-list-item__content--center {
315
+ justify-content: center;
316
+ }
317
+
318
+ .uni-list-item__content-title {
319
+ font-size: 14px;
320
+ color: #3b4144;
321
+ overflow: hidden;
322
+ }
323
+
324
+ .uni-list-item__content-note {
325
+ margin-top: 6rpx;
326
+ color: #999;
327
+ font-size: 12px;
328
+ overflow: hidden;
329
+ }
330
+
331
+ .uni-list-item__extra {
332
+ /* #ifndef APP-NVUE */
333
+ display: flex;
334
+ /* #endif */
335
+ flex-direction: row;
336
+ justify-content: flex-end;
337
+ align-items: center;
338
+ }
339
+
340
+ .uni-list-item__header {
341
+ /* #ifndef APP-NVUE */
342
+ display: flex;
343
+ /* #endif */
344
+ flex-direction: row;
345
+ align-items: center;
346
+ }
347
+
348
+ .uni-list-item__icon {
349
+ margin-right: 18rpx;
350
+ flex-direction: row;
351
+ justify-content: center;
352
+ align-items: center;
353
+ }
354
+
355
+ .uni-list-item__icon-img {
356
+ /* #ifndef APP-NVUE */
357
+ display: block;
358
+ /* #endif */
359
+ height: 26px;
360
+ width: 26px;
361
+ margin-right: 10px;
362
+ }
363
+
364
+ .uni-icon-wrapper {
365
+ /* #ifndef APP-NVUE */
366
+ display: flex;
367
+ /* #endif */
368
+ align-items: center;
369
+ padding: 0 10px;
370
+ }
371
+
372
+ .flex--direction {
373
+ flex-direction: column;
374
+ /* #ifndef APP-NVUE */
375
+ align-items: initial;
376
+ /* #endif */
377
+ }
378
+
379
+ .flex--justify {
380
+ /* #ifndef APP-NVUE */
381
+ justify-content: initial;
382
+ /* #endif */
383
+ }
384
+
385
+ .uni-list--lg {
386
+ height: 40px;
387
+ width: 40px;
388
+ }
389
+
390
+ .uni-list--base {
391
+ height: 26px;
392
+ width: 26px;
393
+ }
394
+
395
+ .uni-list--sm {
396
+ height: 20px;
397
+ width: 20px;
398
+ }
399
+
400
+ .uni-list-item__extra-text {
401
+ color: #999;
402
+ font-size: 12px;
403
+ }
404
+
405
+ .uni-ellipsis-1 {
406
+ /* #ifndef APP-NVUE */
407
+ overflow: hidden;
408
+ white-space: nowrap;
409
+ text-overflow: ellipsis;
410
+ /* #endif */
411
+ /* #ifdef APP-NVUE */
412
+ lines: 1;
413
+ /* #endif */
414
+ }
415
+
416
+ .uni-ellipsis-2 {
417
+ /* #ifndef APP-NVUE */
418
+ overflow: hidden;
419
+ text-overflow: ellipsis;
420
+ display: -webkit-box;
421
+ -webkit-line-clamp: 2;
422
+ -webkit-box-orient: vertical;
423
+ /* #endif */
424
+ /* #ifdef APP-NVUE */
425
+ lines: 2;
426
+ /* #endif */
427
+ }
428
+ </style>