@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,394 @@
1
+ <template>
2
+ <view v-if="show" class="uni-noticebar" :style="{ backgroundColor: backgroundColor }" @click="onClick">
3
+ <!-- #ifdef MP-ALIPAY -->
4
+ <view v-if="showClose === true || showClose === 'true'" class="uni-noticebar-close uni-cursor-point" @click="close">
5
+ <uni-icons type="closeempty" :color="color" size="12" />
6
+ </view>
7
+ <view v-if="showIcon === true || showIcon === 'true'" class="uni-noticebar-icon">
8
+ <uni-icons type="sound" :color="color" size="14" />
9
+ </view>
10
+ <!-- #endif -->
11
+ <!-- #ifndef MP-ALIPAY -->
12
+ <uni-icons v-if="showClose === true || showClose === 'true'" class="uni-noticebar-close uni-cursor-point" type="closeempty" :color="color" size="12" @click="close" />
13
+ <uni-icons v-if="showIcon === true || showIcon === 'true'" class="uni-noticebar-icon" type="sound" :color="color" size="14" />
14
+ <!-- #endif -->
15
+ <view ref="textBox" class="uni-noticebar__content-wrapper" :class="{'uni-noticebar__content-wrapper--scrollable':scrollable, 'uni-noticebar__content-wrapper--single':!scrollable && (single || moreText)}">
16
+ <view :id="elIdBox" class="uni-noticebar__content" :class="{'uni-noticebar__content--scrollable':scrollable, 'uni-noticebar__content--single':!scrollable && (single || moreText)}">
17
+ <text :id="elId" ref="animationEle" class="uni-noticebar__content-text" :class="{'uni-noticebar__content-text--scrollable':scrollable,'uni-noticebar__content-text--single':!scrollable && (single || moreText)}" :style="{color:color, width:wrapWidth+'px', 'animationDuration': animationDuration, '-webkit-animationDuration': animationDuration ,animationPlayState: webviewHide?'paused':animationPlayState,'-webkit-animationPlayState':webviewHide?'paused':animationPlayState, animationDelay: animationDelay, '-webkit-animationDelay':animationDelay}">{{text}}</text>
18
+ </view>
19
+ </view>
20
+ <view v-if="showGetMore === true || showGetMore === 'true'" class="uni-noticebar__more uni-cursor-point" @click="clickMore">
21
+ <text v-if="moreText" :style="{ color: moreColor }" class="uni-noticebar__more-text">{{ moreText }}</text>
22
+ <uni-icons type="arrowright" :color="moreColor" size="14" />
23
+ </view>
24
+ </view>
25
+ </template>
26
+
27
+ <script>
28
+ // #ifdef APP-NVUE
29
+ const dom = weex.requireModule('dom');
30
+ const animation = weex.requireModule('animation');
31
+ // #endif
32
+
33
+ /**
34
+ * NoticeBar 自定义导航栏
35
+ * @description 通告栏组件
36
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=30
37
+ * @property {Number} speed 文字滚动的速度,默认100px/秒
38
+ * @property {String} text 显示文字
39
+ * @property {String} backgroundColor 背景颜色
40
+ * @property {String} color 文字颜色
41
+ * @property {String} moreColor 查看更多文字的颜色
42
+ * @property {String} moreText 设置“查看更多”的文本
43
+ * @property {Boolean} single = [true|false] 是否单行
44
+ * @property {Boolean} scrollable = [true|false] 是否滚动,为true时,NoticeBar为单行
45
+ * @property {Boolean} showIcon = [true|false] 是否显示左侧喇叭图标
46
+ * @property {Boolean} showClose = [true|false] 是否显示左侧关闭按钮
47
+ * @property {Boolean} showGetMore = [true|false] 是否显示右侧查看更多图标,为true时,NoticeBar为单行
48
+ * @event {Function} click 点击 NoticeBar 触发事件
49
+ * @event {Function} close 关闭 NoticeBar 触发事件
50
+ * @event {Function} getmore 点击”查看更多“时触发事件
51
+ */
52
+
53
+ export default {
54
+ name: 'UniNoticeBar',
55
+ emits: ['click', 'getmore', 'close'],
56
+ props: {
57
+ text: {
58
+ type: String,
59
+ default: ''
60
+ },
61
+ moreText: {
62
+ type: String,
63
+ default: ''
64
+ },
65
+ backgroundColor: {
66
+ type: String,
67
+ default: '#fffbe8'
68
+ },
69
+ speed: {
70
+ // 默认1s滚动100px
71
+ type: Number,
72
+ default: 100
73
+ },
74
+ color: {
75
+ type: String,
76
+ default: '#de8c17'
77
+ },
78
+ moreColor: {
79
+ type: String,
80
+ default: '#999999'
81
+ },
82
+ single: {
83
+ // 是否单行
84
+ type: [Boolean, String],
85
+ default: false
86
+ },
87
+ scrollable: {
88
+ // 是否滚动,添加后控制单行效果取消
89
+ type: [Boolean, String],
90
+ default: false
91
+ },
92
+ showIcon: {
93
+ // 是否显示左侧icon
94
+ type: [Boolean, String],
95
+ default: false
96
+ },
97
+ showGetMore: {
98
+ // 是否显示右侧查看更多
99
+ type: [Boolean, String],
100
+ default: false
101
+ },
102
+ showClose: {
103
+ // 是否显示左侧关闭按钮
104
+ type: [Boolean, String],
105
+ default: false
106
+ }
107
+ },
108
+ data() {
109
+ const elId = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`
110
+ const elIdBox = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`
111
+ return {
112
+ textWidth: 0,
113
+ boxWidth: 0,
114
+ wrapWidth: '',
115
+ webviewHide: false,
116
+ // #ifdef APP-NVUE
117
+ stopAnimation: false,
118
+ // #endif
119
+ elId: elId,
120
+ elIdBox: elIdBox,
121
+ show: true,
122
+ animationDuration: 'none',
123
+ animationPlayState: 'paused',
124
+ animationDelay: '0s'
125
+ }
126
+ },
127
+ mounted() {
128
+ // #ifdef APP-PLUS
129
+ var pages = getCurrentPages();
130
+ var page = pages[pages.length - 1];
131
+ var currentWebview = page.$getAppWebview();
132
+ currentWebview.addEventListener('hide', () => {
133
+ this.webviewHide = true
134
+ })
135
+ currentWebview.addEventListener('show', () => {
136
+ this.webviewHide = false
137
+ })
138
+ // #endif
139
+ this.$nextTick(() => {
140
+ this.initSize()
141
+ })
142
+ },
143
+ // #ifdef APP-NVUE
144
+ beforeDestroy() {
145
+ this.stopAnimation = true
146
+ },
147
+ // #endif
148
+ methods: {
149
+ initSize() {
150
+ if (this.scrollable) {
151
+ // #ifndef APP-NVUE
152
+ let query = [],
153
+ boxWidth = 0,
154
+ textWidth = 0;
155
+ let textQuery = new Promise((resolve, reject) => {
156
+ uni.createSelectorQuery()
157
+ // #ifndef MP-ALIPAY
158
+ .in(this)
159
+ // #endif
160
+ .select(`#${this.elId}`)
161
+ .boundingClientRect()
162
+ .exec(ret => {
163
+ this.textWidth = ret[0].width
164
+ resolve()
165
+ })
166
+ })
167
+ let boxQuery = new Promise((resolve, reject) => {
168
+ uni.createSelectorQuery()
169
+ // #ifndef MP-ALIPAY
170
+ .in(this)
171
+ // #endif
172
+ .select(`#${this.elIdBox}`)
173
+ .boundingClientRect()
174
+ .exec(ret => {
175
+ this.boxWidth = ret[0].width
176
+ resolve()
177
+ })
178
+ })
179
+ query.push(textQuery)
180
+ query.push(boxQuery)
181
+ Promise.all(query).then(() => {
182
+ this.animationDuration = `${this.textWidth / this.speed}s`
183
+ this.animationDelay = `-${this.boxWidth / this.speed}s`
184
+ setTimeout(() => {
185
+ this.animationPlayState = 'running'
186
+ }, 1000)
187
+ })
188
+ // #endif
189
+ // #ifdef APP-NVUE
190
+ dom.getComponentRect(this.$refs['animationEle'], (res) => {
191
+ let winWidth = uni.getSystemInfoSync().windowWidth
192
+ this.textWidth = res.size.width
193
+ animation.transition(this.$refs['animationEle'], {
194
+ styles: {
195
+ transform: `translateX(-${winWidth}px)`
196
+ },
197
+ duration: 0,
198
+ timingFunction: 'linear',
199
+ delay: 0
200
+ }, () => {
201
+ if (!this.stopAnimation) {
202
+ animation.transition(this.$refs['animationEle'], {
203
+ styles: {
204
+ transform: `translateX(-${this.textWidth}px)`
205
+ },
206
+ timingFunction: 'linear',
207
+ duration: (this.textWidth - winWidth) / this.speed * 1000,
208
+ delay: 1000
209
+ }, () => {
210
+ if (!this.stopAnimation) {
211
+ this.loopAnimation()
212
+ }
213
+ });
214
+ }
215
+ });
216
+ })
217
+ // #endif
218
+ }
219
+ // #ifdef APP-NVUE
220
+ if (!this.scrollable && (this.single || this.moreText)) {
221
+ dom.getComponentRect(this.$refs['textBox'], (res) => {
222
+ this.wrapWidth = res.size.width
223
+ })
224
+ }
225
+ // #endif
226
+ },
227
+ loopAnimation() {
228
+ // #ifdef APP-NVUE
229
+ animation.transition(this.$refs['animationEle'], {
230
+ styles: {
231
+ transform: `translateX(0px)`
232
+ },
233
+ duration: 0
234
+ }, () => {
235
+ if (!this.stopAnimation) {
236
+ animation.transition(this.$refs['animationEle'], {
237
+ styles: {
238
+ transform: `translateX(-${this.textWidth}px)`
239
+ },
240
+ duration: this.textWidth / this.speed * 1000,
241
+ timingFunction: 'linear',
242
+ delay: 0
243
+ }, () => {
244
+ if (!this.stopAnimation) {
245
+ this.loopAnimation()
246
+ }
247
+ });
248
+ }
249
+ });
250
+ // #endif
251
+ },
252
+ clickMore() {
253
+ this.$emit('getmore')
254
+ },
255
+ close() {
256
+ this.show = false;
257
+ this.$emit('close')
258
+ },
259
+ onClick() {
260
+ this.$emit('click')
261
+ }
262
+ }
263
+ }
264
+ </script>
265
+
266
+ <style scoped>
267
+ .uni-noticebar {
268
+ /* #ifndef APP-NVUE */
269
+ display: flex;
270
+ width: 100%;
271
+ box-sizing: border-box;
272
+ /* #endif */
273
+ flex-direction: row;
274
+ align-items: center;
275
+ padding: 6px 12px;
276
+ margin-bottom: 10px;
277
+ }
278
+
279
+ .uni-cursor-point {
280
+ /* #ifdef H5 */
281
+ cursor: pointer;
282
+ /* #endif */
283
+ }
284
+
285
+ .uni-noticebar-close {
286
+ margin-right: 5px;
287
+ }
288
+
289
+ .uni-noticebar-icon {
290
+ margin-right: 5px;
291
+ }
292
+
293
+ .uni-noticebar__content-wrapper {
294
+ flex: 1;
295
+ flex-direction: column;
296
+ overflow: hidden;
297
+ }
298
+
299
+ .uni-noticebar__content-wrapper--single {
300
+ /* #ifndef APP-NVUE */
301
+ line-height: 18px;
302
+ /* #endif */
303
+ }
304
+
305
+ .uni-noticebar__content-wrapper--single,
306
+ .uni-noticebar__content-wrapper--scrollable {
307
+ flex-direction: row;
308
+ }
309
+
310
+ /* #ifndef APP-NVUE */
311
+ .uni-noticebar__content-wrapper--scrollable {
312
+ position: relative;
313
+ height: 18px;
314
+ }
315
+
316
+ /* #endif */
317
+ .uni-noticebar__content--scrollable {
318
+ /* #ifdef APP-NVUE */
319
+ flex: 0;
320
+ /* #endif */
321
+ /* #ifndef APP-NVUE */
322
+ flex: 1;
323
+ display: block;
324
+ overflow: hidden;
325
+ /* #endif */
326
+ }
327
+
328
+ .uni-noticebar__content--single {
329
+ /* #ifndef APP-NVUE */
330
+ display: flex;
331
+ flex: none;
332
+ width: 100%;
333
+ justify-content: center;
334
+ /* #endif */
335
+ }
336
+
337
+ .uni-noticebar__content-text {
338
+ font-size: 14px;
339
+ line-height: 18px;
340
+ /* #ifndef APP-NVUE */
341
+ word-break: break-all;
342
+ /* #endif */
343
+ }
344
+
345
+ .uni-noticebar__content-text--single {
346
+ /* #ifdef APP-NVUE */
347
+ lines: 1;
348
+ /* #endif */
349
+ /* #ifndef APP-NVUE */
350
+ display: block;
351
+ width: 100%;
352
+ white-space: nowrap;
353
+ /* #endif */
354
+ overflow: hidden;
355
+ text-overflow: ellipsis;
356
+ }
357
+
358
+ .uni-noticebar__content-text--scrollable {
359
+ /* #ifdef APP-NVUE */
360
+ lines: 1;
361
+ padding-left: 750rpx;
362
+ /* #endif */
363
+ /* #ifndef APP-NVUE */
364
+ position: absolute;
365
+ display: block;
366
+ height: 18px;
367
+ line-height: 18px;
368
+ white-space: nowrap;
369
+ padding-left: 100%;
370
+ animation: notice 10s 0s linear infinite both;
371
+ animation-play-state: paused;
372
+ /* #endif */
373
+ }
374
+
375
+ .uni-noticebar__more {
376
+ /* #ifndef APP-NVUE */
377
+ display: inline-flex;
378
+ /* #endif */
379
+ flex-direction: row;
380
+ flex-wrap: nowrap;
381
+ align-items: center;
382
+ padding-left: 5px;
383
+ }
384
+
385
+ .uni-noticebar__more-text {
386
+ font-size: 14px;
387
+ }
388
+
389
+ @keyframes notice {
390
+ 100% {
391
+ transform: translate3d(-100%, 0, 0);
392
+ }
393
+ }
394
+ </style>
@@ -0,0 +1,224 @@
1
+ <template>
2
+ <view class="uni-numbox">
3
+ <view @click="_calcValue('minus')" class="uni-numbox__minus uni-cursor-point">
4
+ <text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue <= min || disabled }">-</text>
5
+ </view>
6
+ <input :disabled="disabled" @focus="_onFocus" @blur="_onBlur" class="uni-numbox__value" type="number" v-model="inputValue" />
7
+ <view @click="_calcValue('plus')" class="uni-numbox__plus uni-cursor-point">
8
+ <text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue >= max || disabled }">+</text>
9
+ </view>
10
+ </view>
11
+ </template>
12
+ <script>
13
+ /**
14
+ * NumberBox 数字输入框
15
+ * @description 带加减按钮的数字输入框
16
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=31
17
+ * @property {Number} value 输入框当前值
18
+ * @property {Number} min 最小值
19
+ * @property {Number} max 最大值
20
+ * @property {Number} step 每次点击改变的间隔大小
21
+ * @property {Boolean} disabled = [true|false] 是否为禁用状态
22
+ * @event {Function} change 输入框值改变时触发的事件,参数为输入框当前的 value
23
+ */
24
+
25
+ export default {
26
+ name: "UniNumberBox",
27
+ emits: ['change', 'input', 'update:modelValue', 'blur', 'focus'],
28
+ props: {
29
+ value: {
30
+ type: [Number, String],
31
+ default: 1
32
+ },
33
+ modelValue: {
34
+ type: [Number, String],
35
+ default: 1
36
+ },
37
+ min: {
38
+ type: Number,
39
+ default: 0
40
+ },
41
+ max: {
42
+ type: Number,
43
+ default: 100
44
+ },
45
+ step: {
46
+ type: Number,
47
+ default: 1
48
+ },
49
+ disabled: {
50
+ type: Boolean,
51
+ default: false
52
+ }
53
+ },
54
+ data() {
55
+ return {
56
+ inputValue: 0
57
+ };
58
+ },
59
+ watch: {
60
+ value(val) {
61
+ this.inputValue = +val;
62
+ },
63
+ modelValue(val) {
64
+ this.inputValue = +val;
65
+ }
66
+ },
67
+ created() {
68
+ if (this.value === 1) {
69
+ this.inputValue = +this.modelValue;
70
+ }
71
+ if (this.modelValue === 1) {
72
+ this.inputValue = +this.value;
73
+ }
74
+ },
75
+ methods: {
76
+ _calcValue(type) {
77
+ if (this.disabled) {
78
+ return;
79
+ }
80
+ const scale = this._getDecimalScale();
81
+ let value = this.inputValue * scale;
82
+ let step = this.step * scale;
83
+ if (type === "minus") {
84
+ value -= step;
85
+ if (value < (this.min * scale)) {
86
+ return;
87
+ }
88
+ if (value > (this.max * scale)) {
89
+ value = this.max * scale
90
+ }
91
+ }
92
+
93
+ if (type === "plus") {
94
+ value += step;
95
+ if (value > (this.max * scale)) {
96
+ return;
97
+ }
98
+ if (value < (this.min * scale)) {
99
+ value = this.min * scale
100
+ }
101
+ }
102
+
103
+ this.inputValue = (value / scale).toFixed(String(scale).length - 1);
104
+ this.$emit("change", +this.inputValue);
105
+ // TODO vue2 兼容
106
+ this.$emit("input", +this.inputValue);
107
+ // TODO vue3 兼容
108
+ this.$emit("update:modelValue", +this.inputValue);
109
+ },
110
+ _getDecimalScale() {
111
+
112
+ let scale = 1;
113
+ // 浮点型
114
+ if (~~this.step !== this.step) {
115
+ scale = Math.pow(10, String(this.step).split(".")[1].length);
116
+ }
117
+ return scale;
118
+ },
119
+ _onBlur(event) {
120
+ this.$emit('blur', event)
121
+ let value = event.detail.value;
122
+ if (!value) {
123
+ // this.inputValue = 0;
124
+ return;
125
+ }
126
+ value = +value;
127
+ if (value > this.max) {
128
+ value = this.max;
129
+ } else if (value < this.min) {
130
+ value = this.min;
131
+ }
132
+ const scale = this._getDecimalScale();
133
+ this.inputValue = value.toFixed(String(scale).length - 1);
134
+ this.$emit("change", +this.inputValue);
135
+ this.$emit("input", +this.inputValue);
136
+ },
137
+ _onFocus(event) {
138
+ this.$emit('focus', event)
139
+ }
140
+ }
141
+ };
142
+ </script>
143
+ <style scoped>
144
+ /* #ifdef APP-NVUE */
145
+ /* #endif */
146
+ .uni-numbox {
147
+ /* #ifndef APP-NVUE */
148
+ display: flex;
149
+ /* #endif */
150
+ flex-direction: row;
151
+ height: 35px;
152
+ line-height: 35px;
153
+ width: 120px;
154
+ }
155
+
156
+ .uni-cursor-point {
157
+ /* #ifdef H5 */
158
+ cursor: pointer;
159
+ /* #endif */
160
+ }
161
+
162
+ .uni-numbox__value {
163
+ background-color: #ffffff;
164
+ width: 50px;
165
+ height: 35px;
166
+ text-align: center;
167
+ font-size: 16px;
168
+ border-width: 1rpx;
169
+ border-style: solid;
170
+ border-color: #e5e5e5;
171
+ border-left-width: 0;
172
+ border-right-width: 0;
173
+ }
174
+
175
+ .uni-numbox__minus {
176
+ /* #ifndef APP-NVUE */
177
+ display: flex;
178
+ /* #endif */
179
+ flex-direction: row;
180
+ align-items: center;
181
+ justify-content: center;
182
+ width: 35px;
183
+ height: 35px;
184
+ font-size: 20px;
185
+ color: #333;
186
+ background-color: #f8f8f8;
187
+ border-width: 1rpx;
188
+ border-style: solid;
189
+ border-color: #e5e5e5;
190
+ border-top-left-radius: 3px;
191
+ border-bottom-left-radius: 3px;
192
+ border-right-width: 0;
193
+ }
194
+
195
+ .uni-numbox__plus {
196
+ /* #ifndef APP-NVUE */
197
+ display: flex;
198
+ /* #endif */
199
+ flex-direction: row;
200
+ align-items: center;
201
+ justify-content: center;
202
+ width: 35px;
203
+ height: 35px;
204
+ border-width: 1rpx;
205
+ border-style: solid;
206
+ border-color: #e5e5e5;
207
+ border-top-right-radius: 3px;
208
+ border-bottom-right-radius: 3px;
209
+ background-color: #f8f8f8;
210
+ border-left-width: 0;
211
+ }
212
+
213
+ .uni-numbox--text {
214
+ font-size: 20px;
215
+ color: #333;
216
+ }
217
+
218
+ .uni-numbox--disabled {
219
+ color: #c0c0c0;
220
+ /* #ifdef H5 */
221
+ cursor: not-allowed;
222
+ /* #endif */
223
+ }
224
+ </style>